Add support for compiling with VS clang-cl toolset
This commit is contained in:
15
SConstruct
15
SConstruct
@ -803,7 +803,7 @@ elif env.msvc:
|
||||
env.Append(CXXFLAGS=["/EHsc"])
|
||||
|
||||
# Configure compiler warnings
|
||||
if env.msvc: # MSVC
|
||||
if env.msvc and not methods.using_clang(env): # MSVC
|
||||
if env["warnings"] == "no":
|
||||
env.Append(CCFLAGS=["/w"])
|
||||
else:
|
||||
@ -853,8 +853,11 @@ else: # GCC, Clang
|
||||
# for putting them in `Set` or `Map`. We don't mind about unreliable ordering.
|
||||
common_warnings += ["-Wno-ordered-compare-function-pointers"]
|
||||
|
||||
# clang-cl will interpret `-Wall` as `-Weverything`, workaround with compatibility cast
|
||||
W_ALL = "-Wall" if not env.msvc else "-W3"
|
||||
|
||||
if env["warnings"] == "extra":
|
||||
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wwrite-strings", "-Wno-unused-parameter"] + common_warnings)
|
||||
env.Append(CCFLAGS=[W_ALL, "-Wextra", "-Wwrite-strings", "-Wno-unused-parameter"] + common_warnings)
|
||||
env.Append(CXXFLAGS=["-Wctor-dtor-privacy", "-Wnon-virtual-dtor"])
|
||||
if methods.using_gcc(env):
|
||||
env.Append(
|
||||
@ -876,9 +879,9 @@ else: # GCC, Clang
|
||||
elif methods.using_clang(env) or methods.using_emcc(env):
|
||||
env.Append(CCFLAGS=["-Wimplicit-fallthrough"])
|
||||
elif env["warnings"] == "all":
|
||||
env.Append(CCFLAGS=["-Wall"] + common_warnings)
|
||||
env.Append(CCFLAGS=[W_ALL] + common_warnings)
|
||||
elif env["warnings"] == "moderate":
|
||||
env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + common_warnings)
|
||||
env.Append(CCFLAGS=[W_ALL, "-Wno-unused"] + common_warnings)
|
||||
else: # 'no'
|
||||
env.Append(CCFLAGS=["-w"])
|
||||
|
||||
@ -1032,7 +1035,9 @@ if env["vsproj"]:
|
||||
if env["compiledb"]:
|
||||
if env.scons_version < (4, 0, 0):
|
||||
# Generating the compilation DB (`compile_commands.json`) requires SCons 4.0.0 or later.
|
||||
print_error("The `compiledb=yes` option requires SCons 4.0 or later, but your version is %s." % scons_raw_version)
|
||||
print_error(
|
||||
"The `compiledb=yes` option requires SCons 4.0 or later, but your version is %s." % scons_raw_version
|
||||
)
|
||||
Exit(255)
|
||||
|
||||
env.Tool("compilation_db")
|
||||
|
||||
Reference in New Issue
Block a user