From 3d2000505624a86d0328decf98f2e48c76c982a5 Mon Sep 17 00:00:00 2001 From: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com> Date: Sat, 12 Oct 2024 16:09:49 -0500 Subject: [PATCH] Make: Override `MACOSX_DEPLOYMENT_TARGET` --- .github/workflows/prerelease.yml | 2 ++ .github/workflows/release.yml | 1 + pyproject.toml | 19 +++++++++++-------- setup.py | 4 ++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 94d6928c..bdf400a4 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -324,6 +324,8 @@ jobs: python -m pip install --upgrade pip pip install pytest pytest-repeat numpy pyarrow python -m pip install . + env: + CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0 - name: Test Python run: pytest scripts/test.py -s -x diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6767394..b3ec2ec3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -98,6 +98,7 @@ jobs: run: cibuildwheel --output-dir wheelhouse env: CIBW_BUILD: cp${{ matrix.python-version }}-* + CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0 - name: Upload wheels uses: actions/upload-artifact@v4 with: diff --git a/pyproject.toml b/pyproject.toml index 8fcdcfb9..38bca547 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,40 +79,43 @@ before-build = ["rd /s /q {project}\\build || echo Done"] [[tool.cibuildwheel.overrides]] select = "*-win_amd64" inherit.environment = "append" -environment.SZ_X86_64="1" +environment.SZ_X86_64 = "1" [[tool.cibuildwheel.overrides]] select = "*-manylinux*_x86_64" inherit.environment = "append" -environment.SZ_X86_64="1" +environment.SZ_X86_64 = "1" [[tool.cibuildwheel.overrides]] select = "*-musllinux*_x86_64" inherit.environment = "append" -environment.SZ_X86_64="1" +environment.SZ_X86_64 = "1" [[tool.cibuildwheel.overrides]] select = "*-macos*_x86_64" inherit.environment = "append" -environment.SZ_X86_64="1" +environment.SZ_X86_64 = "1" # Detect ARM 64-bit builds [[tool.cibuildwheel.overrides]] select = "*-win_arm64" inherit.environment = "append" -environment.SZ_ARM64="1" +environment.SZ_ARM64 = "1" [[tool.cibuildwheel.overrides]] select = "*-manylinux*_aarch64" inherit.environment = "append" -environment.SZ_ARM64="1" +environment.SZ_ARM64 = "1" [[tool.cibuildwheel.overrides]] select = "*-musllinux*_aarch64" inherit.environment = "append" -environment.SZ_ARM64="1" +environment.SZ_ARM64 = "1" [[tool.cibuildwheel.overrides]] select = "*-macos*_arm64" inherit.environment = "append" -environment.SZ_ARM64="1" +environment.SZ_ARM64 = "1" + +[tool.cibuildwheel.macos.environment] +MACOSX_DEPLOYMENT_TARGET = "10.11" diff --git a/setup.py b/setup.py index 1b3339a9..651ae185 100644 --- a/setup.py +++ b/setup.py @@ -65,6 +65,10 @@ def linux_settings() -> Tuple[List[str], List[str], List[Tuple[str]]]: def darwin_settings() -> Tuple[List[str], List[str], List[Tuple[str]]]: + # Ensure we are targeting macOS 11.0 or later + macos_deployment_target = os.environ.get("MACOSX_DEPLOYMENT_TARGET", "11.0") + os.environ["MACOSX_DEPLOYMENT_TARGET"] = macos_deployment_target + compile_args = [ "-std=c99", # use the C 99 language dialect "-pedantic", # stick close to the C language standard, avoid compiler extensions