Enable macos cross-compiling in setup.py

scikit-build
Andrew Cassidy 2 years ago
parent e488dbcbff
commit d1346ca11d

@ -92,6 +92,7 @@ jobs:
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_24"
CIBW_TEST_EXTRAS: "tests"
CIBW_TEST_COMMAND: nosetests {project}/tests -d
CIBW_TEST_SKIP: "*-macosx_arm64"
- name: Upload Wheels
uses: actions/upload-artifact@v2

@ -1,4 +1,5 @@
import os
import re
import sys
import glob
import subprocess
@ -84,6 +85,12 @@ class CMakeBuild(build_ext):
]
build_args += ["--config", cfg]
if sys.platform.startswith("darwin"):
# Cross-compile support for macOS - respect ARCHFLAGS if set
archs = re.findall(r"-arch (\S+)", os.environ.get("ARCHFLAGS", ""))
if archs:
cmake_args += ["-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))]
# Set CMAKE_BUILD_PARALLEL_LEVEL to control the parallel build level
# across all generators.
if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ:

Loading…
Cancel
Save