diff --git a/test-crates/bin/Cargo.lock b/test-crates/bin/Cargo.lock index 50977b5..4447dcb 100644 --- a/test-crates/bin/Cargo.lock +++ b/test-crates/bin/Cargo.lock @@ -6,6 +6,7 @@ version = 3 name = "bin" version = "0.1.0" dependencies = [ + "cfg-if", "exports", "libloading", "rubicon", diff --git a/test-crates/bin/Cargo.toml b/test-crates/bin/Cargo.toml index 96fda1f..8b5f6e7 100644 --- a/test-crates/bin/Cargo.toml +++ b/test-crates/bin/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] +cfg-if = "1.0.0" exports = { version = "0.1.0", path = "../exports" } libloading = "0.8.4" rubicon = { path = "../../rubicon" } diff --git a/test-crates/bin/src/main.rs b/test-crates/bin/src/main.rs index 9ec6976..a05ff3d 100644 --- a/test-crates/bin/src/main.rs +++ b/test-crates/bin/src/main.rs @@ -21,10 +21,15 @@ fn main() { for module in modules { soprintln!("building {module}"); - #[cfg(target_os = "macos")] - let rustflags = "-Clink-arg=-undefined -Clink-arg=dynamic_lookup"; - #[cfg(not(target_os = "macos"))] - let rustflags = ""; + cfg_if::cfg_if! { + if #[cfg(target_os = "macos")] { + let rustflags = "-Clink-arg=-undefined -Clink-arg=dynamic_lookup"; + } else if #[cfg(target_os = "windows")] { + let rustflags = "-Clink-arg=/FORCE:UNRESOLVED"; + } else { + let rustflags = ""; + } + } let output = std::process::Command::new("cargo") .arg("b")