Skip to content

Commit

Permalink
Merge pull request #181 from glandium/apple
Browse files Browse the repository at this point in the history
Really try dylib when compiling for Apple platforms
  • Loading branch information
Byron committed Feb 1, 2024
2 parents a7d8a82 + 2135741 commit 82b4a80
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions build.rs
Expand Up @@ -67,11 +67,10 @@ fn main() {
// Apple platforms have libz.1.dylib, and it's usually available even when
// cross compiling (via fat binary or in the target's Xcode SDK)
let cross_compiling = target != host;
let apple_to_apple = host.contains("-apple-") && target.contains("-apple-");
if target.contains("msvc")
|| target.contains("pc-windows-gnu")
|| want_static
|| (cross_compiling && !apple_to_apple)
|| (cross_compiling && !target.contains("-apple-"))
{
return build_zlib(&mut cfg, &target);
}
Expand Down Expand Up @@ -185,7 +184,11 @@ fn try_vcpkg() -> bool {

fn zlib_installed(cfg: &mut cc::Build) -> bool {
let mut cmd = cfg.get_compiler().to_command();
cmd.arg("src/smoke.c").arg("-o").arg("/dev/null").arg("-lz");
cmd.arg("src/smoke.c")
.arg("-g0")
.arg("-o")
.arg("/dev/null")
.arg("-lz");

println!("running {:?}", cmd);
if let Ok(status) = cmd.status() {
Expand Down

0 comments on commit 82b4a80

Please sign in to comment.