Skip to content

Commit

Permalink
Fix windows build.
Browse files Browse the repository at this point in the history
Add necessary flags to link with the appropriate libraries (and not
link with the inappropriate libraries) for build and debug.
  • Loading branch information
mutexlox-signal authored and kinetiknz committed Sep 19, 2024
1 parent 34cd9b0 commit 0a73433
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cubeb-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@ fn main() {

println!("cargo:rustc-link-lib=static=cubeb");
if windows {
let debug = env::var("DEBUG").unwrap().parse::<bool>().unwrap();
println!("cargo:rustc-link-lib=dylib=avrt");
println!("cargo:rustc-link-lib=dylib=ksuser");
println!("cargo:rustc-link-lib=dylib=ole32");
println!("cargo:rustc-link-lib=dylib=user32");
println!("cargo:rustc-link-lib=dylib=winmm");
println!("cargo:rustc-link-search=native={}/lib", dst.display());
if debug {
println!("cargo:rustc-link-lib=msvcrtd");
}
} else if darwin {
println!("cargo:rustc-link-lib=framework=AudioUnit");
println!("cargo:rustc-link-lib=framework=CoreAudio");
Expand Down
8 changes: 8 additions & 0 deletions systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ use std::path::PathBuf;
fn main() {
let root = PathBuf::from(env::var_os("DEP_CUBEB_ROOT").unwrap());

let target = env::var("TARGET").unwrap();
let windows = target.contains("windows");
let debug = env::var("DEBUG").unwrap().parse::<bool>().unwrap();

if windows && debug {
println!("cargo:rustc-link-lib=msvcrtd");
}

let mut cfg = ctest2::TestGenerator::new();

// Include the header files where the C APIs are defined
Expand Down

0 comments on commit 0a73433

Please sign in to comment.