Skip to content

Commit

Permalink
Fix xwin cross compile on non-Windows system
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Dec 18, 2024
1 parent 5146dcd commit f859943
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,16 @@ fn cargo_build_command(
#[cfg(feature = "xwin")]
{
// Don't use xwin if the Windows MSVC compiler can compile to the target
let native_compile = cc::Build::new()
.opt_level(0)
.host(target.host_triple())
.target(target_triple)
.cargo_metadata(false)
.cargo_warnings(false)
.cargo_output(false)
.try_get_compiler()
.is_ok();
let native_compile = target.host_triple().contains("windows-msvc")
&& cc::Build::new()
.opt_level(0)
.host(target.host_triple())
.target(target_triple)
.cargo_metadata(false)
.cargo_warnings(false)
.cargo_output(false)
.try_get_compiler()
.is_ok();
let force_xwin = env::var("MATURIN_USE_XWIN").ok().as_deref() == Some("1");
if !native_compile || force_xwin {
println!("🛠️ Using xwin for cross-compiling to {target_triple}");
Expand Down

0 comments on commit f859943

Please sign in to comment.