Merge pull request #782 from Kev/build/support-clang-cl

Add clang-cl support
pull/788/head
Fabio Alessandrelli 2022-07-12 21:58:24 +02:00 committed by GitHub
commit cdc8f74939
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -8,6 +8,7 @@ from SCons.Variables import *
def options(opts): def options(opts):
opts.Add(BoolVariable("use_mingw", "Use the MinGW compiler instead of MSVC - only effective on Windows", False)) opts.Add(BoolVariable("use_mingw", "Use the MinGW compiler instead of MSVC - only effective on Windows", False))
opts.Add(BoolVariable("use_clang_cl", "Use the clang driver instead of MSVC - only effective on Windows", False))
def exists(env): def exists(env):
@ -29,6 +30,9 @@ def generate(env):
env.Append(CCFLAGS=["/Z7", "/Od", "/EHsc", "/D_DEBUG", "/MDd"]) env.Append(CCFLAGS=["/Z7", "/Od", "/EHsc", "/D_DEBUG", "/MDd"])
elif env["target"] == "release": elif env["target"] == "release":
env.Append(CCFLAGS=["/O2", "/EHsc", "/DNDEBUG", "/MD"]) env.Append(CCFLAGS=["/O2", "/EHsc", "/DNDEBUG", "/MD"])
if env["use_clang_cl"]:
env["CC"] = "clang-cl"
env["CXX"] = "clang-cl"
elif sys.platform == "win32" or sys.platform == "msys": elif sys.platform == "win32" or sys.platform == "msys":
env["use_mingw"] = True env["use_mingw"] = True