From 713b7b118fce8fdb38ad2897d88189acabf6cef9 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sun, 29 Jan 2023 12:05:01 -0500 Subject: [PATCH] [SCons] Enforce minimum MACOS_DEPLOYMENT_TARGET 10.15 or newer is required for C++17 support --- SConstruct | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 7ed8eb459..80dc70861 100644 --- a/SConstruct +++ b/SConstruct @@ -1900,13 +1900,20 @@ if env["python_package"] == "full" and env["OS"] == "Darwin": # the name of the wheel file for the Python module. If this is not specified by the # MACOSX_DEPLOYMENT_TARGET environment variable, get the value from the Python # installation and use that. - if not env["ENV"].get("MACOSX_DEPLOYMENT_TARGET", False): + mac_target = env["ENV"].get("MACOSX_DEPLOYMENT_TARGET", None) + if not mac_target: info = get_command_output( env["python_cmd"], "-c", "import sysconfig; print(sysconfig.get_platform())" ) - env["ENV"]["MACOSX_DEPLOYMENT_TARGET"] = info.split("-")[1] + mac_target = info.split("-")[1] + if parse_version(mac_target) < parse_version('10.15'): + # macOS 10.15 is the minimum version with C++17 support + mac_target = '10.15' + + env["ENV"]["MACOSX_DEPLOYMENT_TARGET"] = mac_target + logger.info(f"MACOSX_DEPLOYMENT_TARGET = {mac_target}") # Matlab Toolbox settings if env["matlab_path"] != "" and env["matlab_toolbox"] == "default":