1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

SCons: Add DEV_ENABLED defines for target=debug builds

This will allow adding developer checks which will be fully compiled out in
user builds, unlike `DEBUG_ENABLED` which is included in debug tempates and
the editor builds.

This define is not used yet, but we'll soon add code that uses it, and change
some existing `DEBUG_ENABLED` checks to be performed only in dev builds.

Related to https://github.com/godotengine/godot-proposals/issues/3371.
This commit is contained in:
Rémi Verschelde
2021-10-04 11:24:58 +02:00
parent 2b642d68c1
commit e292d79fb3
8 changed files with 9 additions and 2 deletions

View File

@@ -207,7 +207,7 @@ def configure(env):
elif env["target"] == "debug": elif env["target"] == "debug":
env.Append(LINKFLAGS=["-O0"]) env.Append(LINKFLAGS=["-O0"])
env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"]) env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"])
env.Append(CPPDEFINES=["_DEBUG", "DEBUG_ENABLED"]) env.Append(CPPDEFINES=["_DEBUG", "DEBUG_ENABLED", "DEV_ENABLED"])
env.Append(CPPFLAGS=["-UNDEBUG"]) env.Append(CPPFLAGS=["-UNDEBUG"])
# Compiler configuration # Compiler configuration

View File

@@ -62,7 +62,7 @@ def configure(env):
elif env["target"] == "debug": elif env["target"] == "debug":
env.Append(CCFLAGS=["-gdwarf-2", "-O0"]) env.Append(CCFLAGS=["-gdwarf-2", "-O0"])
env.Append(CPPDEFINES=["_DEBUG", ("DEBUG", 1), "DEBUG_ENABLED"]) env.Append(CPPDEFINES=["_DEBUG", ("DEBUG", 1), "DEBUG_ENABLED", "DEV_ENABLED"])
if env["use_lto"]: if env["use_lto"]:
env.Append(CCFLAGS=["-flto"]) env.Append(CCFLAGS=["-flto"])

View File

@@ -81,6 +81,7 @@ def configure(env):
env.Append(LINKFLAGS=["--profiling-funcs"]) env.Append(LINKFLAGS=["--profiling-funcs"])
else: # "debug" else: # "debug"
env.Append(CPPDEFINES=["DEBUG_ENABLED"]) env.Append(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(CPPDEFINES=["DEV_ENABLED"])
env.Append(CCFLAGS=["-O1", "-g"]) env.Append(CCFLAGS=["-O1", "-g"])
env.Append(LINKFLAGS=["-O1", "-g"]) env.Append(LINKFLAGS=["-O1", "-g"])
env["use_assertions"] = True env["use_assertions"] = True

View File

@@ -66,6 +66,7 @@ def configure(env):
elif env["target"] == "debug": elif env["target"] == "debug":
env.Prepend(CCFLAGS=["-g3"]) env.Prepend(CCFLAGS=["-g3"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
env.Prepend(CPPDEFINES=["DEV_ENABLED"])
env.Prepend(LINKFLAGS=["-Xlinker", "-no_deduplicate"]) env.Prepend(LINKFLAGS=["-Xlinker", "-no_deduplicate"])
## Architecture ## Architecture

View File

@@ -74,6 +74,7 @@ def configure(env):
elif env["target"] == "debug": elif env["target"] == "debug":
env.Prepend(CCFLAGS=["-g3"]) env.Prepend(CCFLAGS=["-g3"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
env.Prepend(CPPDEFINES=["DEV_ENABLED"])
env.Append(LINKFLAGS=["-rdynamic"]) env.Append(LINKFLAGS=["-rdynamic"])
## Architecture ## Architecture

View File

@@ -71,6 +71,7 @@ def configure(env):
env.Append(CCFLAGS=["/Zi"]) env.Append(CCFLAGS=["/Zi"])
env.Append(CCFLAGS=["/MDd"]) env.Append(CCFLAGS=["/MDd"])
env.Append(CPPDEFINES=["DEBUG_ENABLED"]) env.Append(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(CPPDEFINES=["DEV_ENABLED"])
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"]) env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
env.Append(LINKFLAGS=["/DEBUG"]) env.Append(LINKFLAGS=["/DEBUG"])

View File

@@ -199,6 +199,7 @@ def configure_msvc(env, manual_msvc_config):
elif env["target"] == "debug": elif env["target"] == "debug":
env.AppendUnique(CCFLAGS=["/Zi", "/FS", "/Od", "/EHsc"]) env.AppendUnique(CCFLAGS=["/Zi", "/FS", "/Od", "/EHsc"])
env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED"]) env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED"])
env.AppendUnique(CPPDEFINES=["DEV_ENABLED"])
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"]) env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
env.Append(LINKFLAGS=["/DEBUG"]) env.Append(LINKFLAGS=["/DEBUG"])
@@ -334,6 +335,7 @@ def configure_mingw(env):
elif env["target"] == "debug": elif env["target"] == "debug":
env.Append(CCFLAGS=["-g3"]) env.Append(CCFLAGS=["-g3"])
env.Append(CPPDEFINES=["DEBUG_ENABLED"]) env.Append(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(CPPDEFINES=["DEV_ENABLED"])
## Compiler configuration ## Compiler configuration

View File

@@ -113,6 +113,7 @@ def configure(env):
env.Prepend(CCFLAGS=["-ggdb"]) env.Prepend(CCFLAGS=["-ggdb"])
env.Prepend(CCFLAGS=["-g3"]) env.Prepend(CCFLAGS=["-g3"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
env.Prepend(CPPDEFINES=["DEV_ENABLED"])
env.Append(LINKFLAGS=["-rdynamic"]) env.Append(LINKFLAGS=["-rdynamic"])
## Architecture ## Architecture