diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-11 00:27:17 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-11 00:27:17 +0200 |
commit | 543f694e2c2f53b62203dab26294d3f7ab3e532c (patch) | |
tree | dcdd6b0c22d1ed0980d3529bf2c2f2bd9248b2b8 /SConstruct | |
parent | 73422df05e531c8834aaaa4c33572d82e82ce831 (diff) | |
parent | 7d708626a37be77067fc69c4060d50bacf21cfa7 (diff) | |
download | redot-engine-543f694e2c2f53b62203dab26294d3f7ab3e532c.tar.gz |
Merge pull request #94109 from akien-mga/scons-linker-optflags
SCons: Pass optimization flags to the linker too, needed by Emscripten
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/SConstruct b/SConstruct index cf6d46855c..f3331f3b0d 100644 --- a/SConstruct +++ b/SConstruct @@ -700,12 +700,11 @@ if env.msvc: else: env.Append(LINKFLAGS=["/DEBUG:NONE"]) - if env["optimize"] == "speed": + if env["optimize"].startswith("speed"): env.Append(CCFLAGS=["/O2"]) env.Append(LINKFLAGS=["/OPT:REF"]) - elif env["optimize"] == "speed_trace": - env.Append(CCFLAGS=["/O2"]) - env.Append(LINKFLAGS=["/OPT:REF", "/OPT:NOICF"]) + if env["optimize"] == "speed_trace": + env.Append(LINKFLAGS=["/OPT:NOICF"]) elif env["optimize"] == "size": env.Append(CCFLAGS=["/O1"]) env.Append(LINKFLAGS=["/OPT:REF"]) @@ -737,17 +736,25 @@ else: else: 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": env.Append(CCFLAGS=["-O3"]) + env.Append(LINKFLAGS=["-O3"]) # `-O2` is friendlier to debuggers than `-O3`, leading to better crash backtraces. elif env["optimize"] == "speed_trace": env.Append(CCFLAGS=["-O2"]) + env.Append(LINKFLAGS=["-O2"]) elif env["optimize"] == "size": env.Append(CCFLAGS=["-Os"]) + env.Append(LINKFLAGS=["-Os"]) elif env["optimize"] == "debug": env.Append(CCFLAGS=["-Og"]) + env.Append(LINKFLAGS=["-Og"]) elif env["optimize"] == "none": env.Append(CCFLAGS=["-O0"]) + env.Append(LINKFLAGS=["-O0"]) # Needs to happen after configure to handle "auto". if env["lto"] != "none": |