Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default macOS deployment target version if not specified #1251

Merged
merged 1 commit into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fix auditwheel `libpython` check on Python 3.7 and older versions in [#1229](https://github.com/PyO3/maturin/pull/1229)
* Use generic tags when `sys.implementation.name` != `platform.python_implementation()` in [#1232](https://github.com/PyO3/maturin/pull/1232).
Fixes the compatibility tags for Pyston.
* Set default macOS deployment target version if `MACOSX_DEPLOYMENT_TARGET` isn't specified in [#1251](https://github.com/PyO3/maturin/pull/1251)

## [0.13.7] - 2022-10-29

Expand Down
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