[SCons] Add "optimize" and "debug_symbols" options

optimize = auto|none|debug|speed|size|0|1|2|3
debug_symbol = True|False

optimize == "auto" will produce:
- "debug" for "debug" builds
- "speed" for "release" builds
This commit is contained in:
Fabio Alessandrelli
2022-09-11 19:25:22 +02:00
parent 024b6d2d9e
commit 2bf983e638
8 changed files with 71 additions and 28 deletions

View File

@@ -25,12 +25,13 @@ def generate(env):
env["is_msvc"] = True
msvc.generate(env)
env.Append(CPPDEFINES=["TYPED_METHOD_BIND", "NOMINMAX"])
env.Append(CCFLAGS=["/EHsc"])
env.Append(LINKFLAGS=["/WX"])
if env["target"] == "debug":
env.Append(CCFLAGS=["/Z7", "/Od", "/EHsc", "/D_DEBUG", "/MDd"])
env.Append(LINKFLAGS=["/DEBUG:FULL"])
elif env["target"] == "release":
env.Append(CCFLAGS=["/O2", "/EHsc", "/DNDEBUG", "/MD"])
if env["debug_symbols"] or env["target"] == "debug":
env.Append(CCFLAGS=["/MDd"])
else:
env.Append(CCFLAGS=["/MD"])
if env["use_clang_cl"]:
env["CC"] = "clang-cl"
env["CXX"] = "clang-cl"