Skip to content

Commit

Permalink
qt-build-utils: only run qmlcachegen when there are QML files
Browse files Browse the repository at this point in the history
Otherwise we have a build failure as qmlcache_loader.cpp file
does not exist.
  • Loading branch information
ahayzen-kdab committed Nov 24, 2023
1 parent 7c74709 commit aac8317
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions crates/qt-build-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,22 +739,26 @@ prefer :/qt/qml/{qml_uri_dirs}/
qmlcachegen_loader.clone(),
];

let cmd = Command::new(qmlcachegen_executable)
.args(
common_args
.iter()
.chain(&specific_args)
.chain(&qml_file_qrc_paths),
)
.output()
.unwrap_or_else(|_| panic!("qmlcachegen failed for QML module {uri}"));
if !cmd.status.success() {
panic!(
"qmlcachegen failed for QML module {uri}:\n{}",
String::from_utf8_lossy(&cmd.stderr)
);
// If there are no QML files there is nothing for qmlcachegen to run with
if !qml_files.is_empty()
{
let cmd = Command::new(qmlcachegen_executable)
.args(
common_args
.iter()
.chain(&specific_args)
.chain(&qml_file_qrc_paths),
)
.output()
.unwrap_or_else(|_| panic!("qmlcachegen failed for QML module {uri}"));
if !cmd.status.success() {
panic!(
"qmlcachegen failed for QML module {uri}:\n{}",
String::from_utf8_lossy(&cmd.stderr)
);
}
qmlcachegen_file_paths.push(PathBuf::from(&qmlcachegen_loader));
}
qmlcachegen_file_paths.push(PathBuf::from(&qmlcachegen_loader));
}

// Run qmltyperegistrar
Expand Down

0 comments on commit aac8317

Please sign in to comment.