Skip to content

Commit

Permalink
Set default macOS deployment target version if not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Nov 5, 2022
1 parent d6c6bed commit ad46119
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/compile.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::build_context::BridgeModel;
use crate::target::RUST_1_64_0;
use crate::target::{Arch, RUST_1_64_0};
use crate::{BuildContext, PlatformTag, PythonInterpreter, Target};
use anyhow::{anyhow, bail, Context, Result};
use fat_macho::FatWriter;
Expand Down Expand Up @@ -384,6 +384,15 @@ fn compile_target(
build_command.env("PYO3_CROSS_LIB_DIR", lib_dir);
}

// Set default macOS deployment target version
if target.is_macos() && env::var_os("MACOSX_DEPLOYMENT_TARGET").is_none() {
let min_version = match target.target_arch() {
Arch::Aarch64 => "11.0",
_ => "10.7",
};
build_command.env("MACOSX_DEPLOYMENT_TARGET", min_version);
}

let mut cargo_build = build_command
.spawn()
.context("Failed to run `cargo rustc`")?;
Expand Down

0 comments on commit ad46119

Please sign in to comment.