summaryrefslogtreecommitdiffstats
path: root/SConstruct
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-07-09 01:15:32 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-07-09 09:34:02 +0200
commit7d708626a37be77067fc69c4060d50bacf21cfa7 (patch)
tree792d7618cb7c8c379ac1f1cfe6db3df01e2ea4cf /SConstruct
parent82cedc83c9069125207c128f9a07ce3d82c317cc (diff)
downloadredot-engine-7d708626a37be77067fc69c4060d50bacf21cfa7.tar.gz
SCons: Pass optimization flags to the linker too, needed by Emscripten
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct15
1 files changed, 11 insertions, 4 deletions
diff --git a/SConstruct b/SConstruct
index 8e9a536bdc..00cf479dea 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"])
@@ -731,17 +730,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":