Skip to content

Commit 82320ae

Browse files
Fix compiler warning on macOS
1 parent ddd7a3f commit 82320ae

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

setup.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,22 @@
6161
or n.endswith(".pxd")]
6262
thin_depends.append(base_pxd)
6363

64-
# if the platform is macOS, add arguments required for cross-compilation for
65-
# both x86_64 and arm64 architectures if the python interpreter is a
66-
# universal2 version.
64+
# if the platform is macOS:
65+
# - target the minimim OS version that current Python packages work with.
66+
# (Use 'otool -l /path/to/python' and look for 'version' in the
67+
# LC_VERSION_MIN_MACOSX section)
68+
# - add argument required for cross-compilation for both x86_64 and arm64
69+
# architectures if the python interpreter is a universal2 version.
70+
6771
extra_compile_args = []
68-
if sys.platform == "darwin" and "universal2" in sysconfig.get_platform():
69-
if platform.machine() == "x86_64":
70-
target = "arm64-apple-macos"
71-
else:
72-
target = "x86_64-apple-macos"
73-
extra_compile_args.extend(["-target", target])
72+
if sys.platform == "darwin":
73+
extra_compile_args.extend(["-mmacosx-version-min=10.9"])
74+
if "universal2" in sysconfig.get_platform():
75+
if platform.machine() == "x86_64":
76+
target = "arm64-apple-macos"
77+
else:
78+
target = "x86_64-apple-macos"
79+
extra_compile_args.extend(["-target", target])
7480

7581
setup(
7682
ext_modules=[

0 commit comments

Comments
 (0)