Skip to content

Commit

Permalink
cxx-qt-lib: hack around Windows build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Aug 2, 2022
1 parent 83c0d4a commit a7fd284
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions cxx-qt-lib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ fn main() {
if let Ok(target_dir) = env::var("CARGO_TARGET_DIR") {
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
std::fs::create_dir_all(&format!("{}/cxxbridge/cxx-qt-lib/include", target_dir)).unwrap();
std::fs::copy(
&format!("{}/include/qt_types.h", manifest_dir),
&format!("{}/cxxbridge/cxx-qt-lib/include/qt_types.h", target_dir),
)
.unwrap();
// FIXME: Horrible hack around this sometimes failing because
// Windows doesn't allow multiple processes to access a file by default.
while true {
match std::fs::copy(
&format!("{}/include/qt_types.h", manifest_dir),
&format!("{}/cxxbridge/cxx-qt-lib/include/qt_types.h", target_dir),
) {
Ok(_) => break,
#[cfg(windows)]
Err(e) if e.raw_os_error() == Some(32) => continue,
Err(e) => panic!("Error copying qt_types.h: {e:?}"),
}
}
}

let bridge_files = [
Expand Down

0 comments on commit a7fd284

Please sign in to comment.