From 134f4241cea560b4ad0414d55bae7ad6887c9478 Mon Sep 17 00:00:00 2001 From: messense Date: Sat, 5 Nov 2022 16:25:55 +0800 Subject: [PATCH] Set default macOS deployment target version if not specified --- Changelog.md | 1 + src/compile.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 5ad9b9387..a37eb41e0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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 diff --git a/src/compile.rs b/src/compile.rs index 9a4bc3600..456249f08 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -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; @@ -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`")?;