Merge pull request #4974 from radarhere/sdk

Added macOS SDK install path to library and include directories
This commit is contained in:
Hugo van Kemenade 2020-10-14 16:39:10 +03:00 committed by GitHub
commit 1a66e2f338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -475,6 +475,18 @@ class pil_build_ext(build_ext):
_add_directory(library_dirs, "/usr/X11/lib")
_add_directory(include_dirs, "/usr/X11/include")
# SDK install path
try:
sdk_path = (
subprocess.check_output(["xcrun", "--show-sdk-path"])
.strip()
.decode("latin1")
)
except Exception:
sdk_path = None
if sdk_path:
_add_directory(library_dirs, os.path.join(sdk_path, "usr", "lib"))
_add_directory(include_dirs, os.path.join(sdk_path, "usr", "include"))
elif (
sys.platform.startswith("linux")
or sys.platform.startswith("gnu")