mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
SCons: Refactor LTO options with lto=<none|thin|full>
Adds support for LTO on macOS and Android. We don't have much experience with LTO on these platforms so for now we keep it disabled by default even when `production=yes` is set. Similarly for iOS where we ship object files for the user to link in Xcode so LTO makes builds extremely slow to link. `production=yes` defaults to full LTO. ThinLTO is much faster for LLVM-based compilers but seems to produce bigger binaries (at least for the Web platform).
This commit is contained in:
parent
69233093d7
commit
c2c659db32
7 changed files with 94 additions and 60 deletions
|
@ -31,7 +31,6 @@ def get_opts():
|
|||
return [
|
||||
("initial_memory", "Initial WASM memory (in MiB)", 32),
|
||||
BoolVariable("use_assertions", "Use Emscripten runtime assertions", False),
|
||||
BoolVariable("use_thinlto", "Use ThinLTO", False),
|
||||
BoolVariable("use_ubsan", "Use Emscripten undefined behavior sanitizer (UBSAN)", False),
|
||||
BoolVariable("use_asan", "Use Emscripten address sanitizer (ASAN)", False),
|
||||
BoolVariable("use_lsan", "Use Emscripten leak sanitizer (LSAN)", False),
|
||||
|
@ -110,12 +109,13 @@ def configure(env):
|
|||
env["ENV"] = os.environ
|
||||
|
||||
# LTO
|
||||
if env["use_thinlto"]:
|
||||
env.Append(CCFLAGS=["-flto=thin"])
|
||||
env.Append(LINKFLAGS=["-flto=thin"])
|
||||
elif env["use_lto"]:
|
||||
env.Append(CCFLAGS=["-flto=full"])
|
||||
env.Append(LINKFLAGS=["-flto=full"])
|
||||
if env["lto"] != "none":
|
||||
if env["lto"] == "thin":
|
||||
env.Append(CCFLAGS=["-flto=thin"])
|
||||
env.Append(LINKFLAGS=["-flto=thin"])
|
||||
else:
|
||||
env.Append(CCFLAGS=["-flto"])
|
||||
env.Append(LINKFLAGS=["-flto"])
|
||||
|
||||
# Sanitizers
|
||||
if env["use_ubsan"]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue