replace the debug flag with a release flag

This commit is contained in:
2024-11-27 11:55:08 -06:00
committed by Celtic Minstrel
parent f3e83290cb
commit dd347a5f79
5 changed files with 17 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ opts = Variables(None, ARGUMENTS)
opts.Add(EnumVariable('OS', "Target platform", str(Platform()), ('darwin', 'win32', 'posix')))
opts.Add('toolset', "Toolset to pass to the SCons builder", 'default')
opts.Add(BoolVariable('debug', "Build with debug symbols and no optimization", True))
opts.Add(BoolVariable('release', "Build with optimization and no debug symbols", False))
opts.Add(EnumVariable('bits', "Build for 32-bit or 64-bit architectures", '64', ('32', '64')))
# Partial build flags -- by default, all targets will be built,
@@ -36,6 +36,16 @@ opts.Add("LINKFLAGS", "Custom flags for the linker")
env = Environment(variables=opts, ENV=os.environ)
Help(opts.GenerateHelpText(env))
# Source: https://github.com/godotengine/godot-cpp/blob/a42b3634d20b4e7088be721792bba1199277362c/SConstruct#L36
if opts.UnknownVariables():
unknown = opts.UnknownVariables()
if unknown:
print("WARNING: Unknown SCons variables were passed and will be ignored:")
for item in unknown.items():
print(" " + item[0] + "=" + item[1])
if item[0] == 'debug':
print(' NOTE: Debug builds are now the default. Pass `release=true` if you need a release build.')
platform = env['OS']
toolset = env['toolset']
arch = 'x86_64' if (env['bits'] == '64') else 'x86'
@@ -75,7 +85,7 @@ env.VariantDir('#build/obj', 'src')
env.VariantDir('#build/obj/test', 'test')
env.VariantDir('#build/obj/test/deps', 'deps')
if env['debug']:
if not env['release']:
if platform in ['posix', 'darwin']:
env.Append(CCFLAGS=['-g','-O0'])
elif platform == 'win32':