SCons: Pass optimization flags to the linker too, needed by Emscripten
This commit is contained in:
parent
82cedc83c9
commit
7d708626a3
15
SConstruct
15
SConstruct
|
@ -700,12 +700,11 @@ if env.msvc:
|
||||||
else:
|
else:
|
||||||
env.Append(LINKFLAGS=["/DEBUG:NONE"])
|
env.Append(LINKFLAGS=["/DEBUG:NONE"])
|
||||||
|
|
||||||
if env["optimize"] == "speed":
|
if env["optimize"].startswith("speed"):
|
||||||
env.Append(CCFLAGS=["/O2"])
|
env.Append(CCFLAGS=["/O2"])
|
||||||
env.Append(LINKFLAGS=["/OPT:REF"])
|
env.Append(LINKFLAGS=["/OPT:REF"])
|
||||||
elif env["optimize"] == "speed_trace":
|
if env["optimize"] == "speed_trace":
|
||||||
env.Append(CCFLAGS=["/O2"])
|
env.Append(LINKFLAGS=["/OPT:NOICF"])
|
||||||
env.Append(LINKFLAGS=["/OPT:REF", "/OPT:NOICF"])
|
|
||||||
elif env["optimize"] == "size":
|
elif env["optimize"] == "size":
|
||||||
env.Append(CCFLAGS=["/O1"])
|
env.Append(CCFLAGS=["/O1"])
|
||||||
env.Append(LINKFLAGS=["/OPT:REF"])
|
env.Append(LINKFLAGS=["/OPT:REF"])
|
||||||
|
@ -731,17 +730,25 @@ else:
|
||||||
else:
|
else:
|
||||||
env.Append(LINKFLAGS=["-s"])
|
env.Append(LINKFLAGS=["-s"])
|
||||||
|
|
||||||
|
# Linker needs optimization flags too, at least for Emscripten.
|
||||||
|
# For other toolchains, this _may_ be useful for LTO too to disambiguate.
|
||||||
|
|
||||||
if env["optimize"] == "speed":
|
if env["optimize"] == "speed":
|
||||||
env.Append(CCFLAGS=["-O3"])
|
env.Append(CCFLAGS=["-O3"])
|
||||||
|
env.Append(LINKFLAGS=["-O3"])
|
||||||
# `-O2` is friendlier to debuggers than `-O3`, leading to better crash backtraces.
|
# `-O2` is friendlier to debuggers than `-O3`, leading to better crash backtraces.
|
||||||
elif env["optimize"] == "speed_trace":
|
elif env["optimize"] == "speed_trace":
|
||||||
env.Append(CCFLAGS=["-O2"])
|
env.Append(CCFLAGS=["-O2"])
|
||||||
|
env.Append(LINKFLAGS=["-O2"])
|
||||||
elif env["optimize"] == "size":
|
elif env["optimize"] == "size":
|
||||||
env.Append(CCFLAGS=["-Os"])
|
env.Append(CCFLAGS=["-Os"])
|
||||||
|
env.Append(LINKFLAGS=["-Os"])
|
||||||
elif env["optimize"] == "debug":
|
elif env["optimize"] == "debug":
|
||||||
env.Append(CCFLAGS=["-Og"])
|
env.Append(CCFLAGS=["-Og"])
|
||||||
|
env.Append(LINKFLAGS=["-Og"])
|
||||||
elif env["optimize"] == "none":
|
elif env["optimize"] == "none":
|
||||||
env.Append(CCFLAGS=["-O0"])
|
env.Append(CCFLAGS=["-O0"])
|
||||||
|
env.Append(LINKFLAGS=["-O0"])
|
||||||
|
|
||||||
# Needs to happen after configure to handle "auto".
|
# Needs to happen after configure to handle "auto".
|
||||||
if env["lto"] != "none":
|
if env["lto"] != "none":
|
||||||
|
|
Loading…
Reference in New Issue