[SCons] Add "optimize" and "debug_symbols" options

optimize = auto|none|debug|speed|size|0|1|2|3
debug_symbol = True|False

optimize == "auto" will produce:
- "debug" for "debug" builds
- "speed" for "release" builds
This commit is contained in:
Fabio Alessandrelli
2022-09-11 19:25:22 +02:00
parent 024b6d2d9e
commit 2bf983e638
8 changed files with 71 additions and 28 deletions

View File

@@ -102,6 +102,10 @@ architecture_aliases = {
}
opts.Add(EnumVariable("arch", "CPU architecture", "", architecture_array, architecture_aliases))
# Targets flags tool (optimizations, debug symbols)
target_tool = Tool("targets", toolpath=["tools"])
target_tool.options(opts)
opts.Update(env)
Help(opts.GenerateHelpText(env))
@@ -135,6 +139,7 @@ if tool is None or not tool.exists(env):
raise ValueError("Required toolchain not found for platform " + env["platform"])
tool.generate(env)
target_tool.generate(env)
# Detect and print a warning listing unknown SCons variables to ease troubleshooting.
unknown = opts.UnknownVariables()