We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e76c920 commit d0a546bCopy full SHA for d0a546b
1 file changed
setup.py
@@ -1,4 +1,5 @@
1
import os
2
+import re
3
import sys
4
import subprocess
5
from pathlib import Path
@@ -28,6 +29,12 @@ def build_extension(self, ext: CMakeExtension) -> None:
28
29
30
build_args = ["--config", "Release"]
31
32
+ # On macOS, respect ARCHFLAGS for cross-compilation (e.g. x86_64 on arm64)
33
+ archflags = os.environ.get("ARCHFLAGS", "")
34
+ archs = re.findall(r"-arch (\S+)", archflags)
35
+ if archs:
36
+ cmake_args.append(f"-DCMAKE_OSX_ARCHITECTURES={';'.join(archs)}")
37
+
38
# On Windows, use Ninja if no generator is specified to avoid
39
# Visual Studio multi-config generator issues with pybind11
40
if sys.platform == "win32" and not cmake_generator:
0 commit comments