mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
fix: min macos (#2622)
This commit is contained in:
parent
139c05dafa
commit
06a54018c8
@ -45,6 +45,7 @@ import shutil
|
|||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
|
import platform
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -177,10 +178,14 @@ class Pybind11Extension(_Extension):
|
|||||||
|
|
||||||
if MACOS and "MACOSX_DEPLOYMENT_TARGET" not in os.environ:
|
if MACOS and "MACOSX_DEPLOYMENT_TARGET" not in os.environ:
|
||||||
# C++17 requires a higher min version of macOS. An earlier version
|
# C++17 requires a higher min version of macOS. An earlier version
|
||||||
# can be set manually via environment variable if you are careful
|
# (10.12 or 10.13) can be set manually via environment variable if
|
||||||
# in your feature usage, but 10.14 is the safest setting for
|
# you are careful in your feature usage, but 10.14 is the safest
|
||||||
# general use.
|
# setting for general use. However, never set higher than the
|
||||||
macosx_min = "-mmacosx-version-min=" + ("10.9" if level < 17 else "10.14")
|
# current macOS version!
|
||||||
|
current_macos = tuple(int(x) for x in platform.mac_ver()[0].split(".")[:2])
|
||||||
|
desired_macos = (10, 9) if level < 17 else (10, 14)
|
||||||
|
macos_string = ".".join(str(x) for x in min(current_macos, desired_macos))
|
||||||
|
macosx_min = "-mmacosx-version-min=" + macos_string
|
||||||
self.extra_compile_args.append(macosx_min)
|
self.extra_compile_args.append(macosx_min)
|
||||||
self.extra_link_args.append(macosx_min)
|
self.extra_link_args.append(macosx_min)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user