Scons: fixed build for vanilla clang in mac os x

This commit is contained in:
Nickolai Korshunov 2020-02-24 12:03:58 +03:00
parent 128a55a597
commit c491232ae2
2 changed files with 17 additions and 4 deletions

View File

@ -353,10 +353,16 @@ if selected_platform in platform_list:
elif methods.using_clang(env): elif methods.using_clang(env):
# Apple LLVM versions differ from upstream LLVM version \o/, compare # Apple LLVM versions differ from upstream LLVM version \o/, compare
# in https://en.wikipedia.org/wiki/Xcode#Toolchain_versions # in https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
if (env["platform"] == "osx" or env["platform"] == "iphone") and major < 10: if env["platform"] == "osx" or env["platform"] == "iphone":
print("Detected Apple Clang version older than 10, which does not fully " vanilla = methods.is_vanilla_clang(env)
"support C++17. Supported versions are Apple Clang 10 and later.") if vanilla and major < 6:
sys.exit(255) print("Detected Clang version older than 6, which does not fully support "
"C++17. Supported versions are Clang 6 and later.")
sys.exit(255)
elif not vanilla and major < 10:
print("Detected Apple Clang version older than 10, which does not fully "
"support C++17. Supported versions are Apple Clang 10 and later.")
sys.exit(255)
elif major < 6: elif major < 6:
print("Detected Clang version older than 6, which does not fully support " print("Detected Clang version older than 6, which does not fully support "
"C++17. Supported versions are Clang 6 and later.") "C++17. Supported versions are Clang 6 and later.")

View File

@ -549,6 +549,13 @@ def detect_darwin_sdk_path(platform, env):
print("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name)) print("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name))
raise raise
def is_vanilla_clang(env):
if not using_clang(env):
return False
version = decode_utf8(subprocess.check_output([env['CXX'], '--version']).strip())
return not version.startswith("Apple")
def get_compiler_version(env): def get_compiler_version(env):
if using_gcc(env): if using_gcc(env):
version = decode_utf8(subprocess.check_output([env['CXX'], '-dumpversion']).strip()) version = decode_utf8(subprocess.check_output([env['CXX'], '-dumpversion']).strip())