Skip to content

Commit

Permalink
Merge pull request #932 from Faless/build/4.x_msvc_runtime
Browse files Browse the repository at this point in the history
[SCons] Link MSVC debug runtime for optimize=none|debug only.
  • Loading branch information
akien-mga committed Nov 21, 2022
2 parents 17170fe + edf02f8 commit 6bebaa3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 7 additions & 3 deletions tools/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def generate(env):
env["optimize"] = ARGUMENTS.get("optimize", opt_level)
env["debug_symbols"] = get_cmdline_bool("debug_symbols", env.dev_build)

if "is_msvc" in env and env["is_msvc"]:
if env.get("is_msvc", False):
if env["debug_symbols"]:
env.Append(CCFLAGS=["/Zi", "/FS"])
env.Append(LINKFLAGS=["/DEBUG:FULL"])
Expand All @@ -66,8 +66,12 @@ def generate(env):
elif env["optimize"] == "size":
env.Append(CCFLAGS=["/O1"])
env.Append(LINKFLAGS=["/OPT:REF"])
elif env["optimize"] == "debug" or env["optimize"] == "none":
env.Append(CCFLAGS=["/Od"])

if env["optimize"] == "debug" or env["optimize"] == "none":
env.Append(CCFLAGS=["/MDd", "/Od"])
else:
env.Append(CCFLAGS=["/MD"])

else:
if env["debug_symbols"]:
if env.dev_build:
Expand Down
4 changes: 0 additions & 4 deletions tools/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ def generate(env):
env.Append(CPPDEFINES=["TYPED_METHOD_BIND", "NOMINMAX"])
env.Append(CCFLAGS=["/EHsc"])
env.Append(LINKFLAGS=["/WX"])
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"
Expand Down

0 comments on commit 6bebaa3

Please sign in to comment.