SCons: Set DEBUG_ENABLED
and DEV_ENABLED
in SConstruct
They're the same for all platforms so they don't need to be repeated in all
platform definitions.
(cherry picked from commit cd21cc683a
)
This commit is contained in:
parent
8c6e341876
commit
9657559b66
10 changed files with 15 additions and 36 deletions
14
SConstruct
14
SConstruct
|
@ -297,11 +297,19 @@ env_base.Prepend(CPPPATH=["#"])
|
||||||
env_base.platform_exporters = platform_exporters
|
env_base.platform_exporters = platform_exporters
|
||||||
env_base.platform_apis = platform_apis
|
env_base.platform_apis = platform_apis
|
||||||
|
|
||||||
if env_base["use_precise_math_checks"]:
|
# Build type defines - more platform-specific ones can be in detect.py.
|
||||||
env_base.Append(CPPDEFINES=["PRECISE_MATH_CHECKS"])
|
if env_base["target"] == "release_debug" or env_base["target"] == "debug":
|
||||||
|
# DEBUG_ENABLED enables debugging *features* and debug-only code, which is intended
|
||||||
|
# to give *users* extra debugging information for their game development.
|
||||||
|
env_base.Append(CPPDEFINES=["DEBUG_ENABLED"])
|
||||||
|
|
||||||
if env_base["target"] == "debug":
|
if env_base["target"] == "debug":
|
||||||
env_base.Append(CPPDEFINES=["DEBUG_MEMORY_ALLOC", "DISABLE_FORCED_INLINE"])
|
# DEV_ENABLED enables *engine developer* code which should only be compiled for those
|
||||||
|
# working on the engine itself.
|
||||||
|
env_base.Append(CPPDEFINES=["DEV_ENABLED"])
|
||||||
|
|
||||||
|
if env_base["use_precise_math_checks"]:
|
||||||
|
env_base.Append(CPPDEFINES=["PRECISE_MATH_CHECKS"])
|
||||||
|
|
||||||
if env_base["no_editor_splash"]:
|
if env_base["no_editor_splash"]:
|
||||||
env_base.Append(CPPDEFINES=["NO_EDITOR_SPLASH"])
|
env_base.Append(CPPDEFINES=["NO_EDITOR_SPLASH"])
|
||||||
|
|
|
@ -59,10 +59,9 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//should always inline, except in some cases because it makes debugging harder
|
// Should always inline, except in dev builds because it makes debugging harder.
|
||||||
#ifndef _FORCE_INLINE_
|
#ifndef _FORCE_INLINE_
|
||||||
|
#ifdef DEV_ENABLED
|
||||||
#ifdef DISABLE_FORCED_INLINE
|
|
||||||
#define _FORCE_INLINE_ inline
|
#define _FORCE_INLINE_ inline
|
||||||
#else
|
#else
|
||||||
#define _FORCE_INLINE_ _ALWAYS_INLINE_
|
#define _FORCE_INLINE_ _ALWAYS_INLINE_
|
||||||
|
|
|
@ -202,12 +202,10 @@ def configure(env):
|
||||||
env.Append(CPPDEFINES=["NDEBUG"])
|
env.Append(CPPDEFINES=["NDEBUG"])
|
||||||
if can_vectorize:
|
if can_vectorize:
|
||||||
env.Append(CCFLAGS=["-ftree-vectorize"])
|
env.Append(CCFLAGS=["-ftree-vectorize"])
|
||||||
if env["target"] == "release_debug":
|
|
||||||
env.Append(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
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", "DEV_ENABLED"])
|
env.Append(CPPDEFINES=["_DEBUG"])
|
||||||
env.Append(CPPFLAGS=["-UNDEBUG"])
|
env.Append(CPPFLAGS=["-UNDEBUG"])
|
||||||
|
|
||||||
# Compiler configuration
|
# Compiler configuration
|
||||||
|
|
|
@ -57,12 +57,9 @@ def configure(env):
|
||||||
env.Append(CCFLAGS=["-Os", "-ftree-vectorize"])
|
env.Append(CCFLAGS=["-Os", "-ftree-vectorize"])
|
||||||
env.Append(LINKFLAGS=["-Os"])
|
env.Append(LINKFLAGS=["-Os"])
|
||||||
|
|
||||||
if env["target"] == "release_debug":
|
|
||||||
env.Append(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
|
|
||||||
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", "DEV_ENABLED"])
|
env.Append(CPPDEFINES=["_DEBUG", ("DEBUG", 1)])
|
||||||
|
|
||||||
if env["use_lto"]:
|
if env["use_lto"]:
|
||||||
env.Append(CCFLAGS=["-flto"])
|
env.Append(CCFLAGS=["-flto"])
|
||||||
|
|
|
@ -76,12 +76,9 @@ def configure(env):
|
||||||
env.Append(LINKFLAGS=["-Os"])
|
env.Append(LINKFLAGS=["-Os"])
|
||||||
|
|
||||||
if env["target"] == "release_debug":
|
if env["target"] == "release_debug":
|
||||||
env.Append(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
# Retain function names for backtraces at the cost of file size.
|
# Retain function names for backtraces at the cost of file size.
|
||||||
env.Append(LINKFLAGS=["--profiling-funcs"])
|
env.Append(LINKFLAGS=["--profiling-funcs"])
|
||||||
else: # "debug"
|
else: # "debug"
|
||||||
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
|
||||||
|
|
|
@ -58,15 +58,11 @@ def configure(env):
|
||||||
elif env["optimize"] == "size": # optimize for size
|
elif env["optimize"] == "size": # optimize for size
|
||||||
env.Prepend(CCFLAGS=["-Os"])
|
env.Prepend(CCFLAGS=["-Os"])
|
||||||
|
|
||||||
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
|
|
||||||
if env["debug_symbols"]:
|
if env["debug_symbols"]:
|
||||||
env.Prepend(CCFLAGS=["-g2"])
|
env.Prepend(CCFLAGS=["-g2"])
|
||||||
|
|
||||||
elif env["target"] == "debug":
|
elif env["target"] == "debug":
|
||||||
env.Prepend(CCFLAGS=["-g3"])
|
env.Prepend(CCFLAGS=["-g3"])
|
||||||
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
env.Prepend(CPPDEFINES=["DEV_ENABLED"])
|
|
||||||
env.Prepend(LINKFLAGS=["-Xlinker", "-no_deduplicate"])
|
env.Prepend(LINKFLAGS=["-Xlinker", "-no_deduplicate"])
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
|
@ -66,15 +66,12 @@ def configure(env):
|
||||||
env.Prepend(CCFLAGS=["-O2"])
|
env.Prepend(CCFLAGS=["-O2"])
|
||||||
elif env["optimize"] == "size": # optimize for size
|
elif env["optimize"] == "size": # optimize for size
|
||||||
env.Prepend(CCFLAGS=["-Os"])
|
env.Prepend(CCFLAGS=["-Os"])
|
||||||
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
|
|
||||||
if env["debug_symbols"]:
|
if env["debug_symbols"]:
|
||||||
env.Prepend(CCFLAGS=["-g2"])
|
env.Prepend(CCFLAGS=["-g2"])
|
||||||
|
|
||||||
elif env["target"] == "debug":
|
elif env["target"] == "debug":
|
||||||
env.Prepend(CCFLAGS=["-g3"])
|
env.Prepend(CCFLAGS=["-g3"])
|
||||||
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
env.Prepend(CPPDEFINES=["DEV_ENABLED"])
|
|
||||||
env.Append(LINKFLAGS=["-rdynamic"])
|
env.Append(LINKFLAGS=["-rdynamic"])
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
|
@ -63,15 +63,12 @@ def configure(env):
|
||||||
elif env["target"] == "release_debug":
|
elif env["target"] == "release_debug":
|
||||||
env.Append(CCFLAGS=["/MD"])
|
env.Append(CCFLAGS=["/MD"])
|
||||||
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
|
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
|
||||||
env.Append(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
if env["optimize"] != "none":
|
if env["optimize"] != "none":
|
||||||
env.Append(CCFLAGS=["/O2", "/Zi"])
|
env.Append(CCFLAGS=["/O2", "/Zi"])
|
||||||
|
|
||||||
elif env["target"] == "debug":
|
elif env["target"] == "debug":
|
||||||
env.Append(CCFLAGS=["/Zi"])
|
env.Append(CCFLAGS=["/Zi"])
|
||||||
env.Append(CCFLAGS=["/MDd"])
|
env.Append(CCFLAGS=["/MDd"])
|
||||||
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"])
|
||||||
|
|
||||||
|
|
|
@ -193,13 +193,10 @@ def configure_msvc(env, manual_msvc_config):
|
||||||
elif env["optimize"] == "size": # optimize for size
|
elif env["optimize"] == "size": # optimize for size
|
||||||
env.Append(CCFLAGS=["/O1"])
|
env.Append(CCFLAGS=["/O1"])
|
||||||
env.Append(LINKFLAGS=["/OPT:REF"])
|
env.Append(LINKFLAGS=["/OPT:REF"])
|
||||||
env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
|
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
|
||||||
|
|
||||||
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=["DEV_ENABLED"])
|
|
||||||
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
|
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
|
||||||
env.Append(LINKFLAGS=["/DEBUG"])
|
env.Append(LINKFLAGS=["/DEBUG"])
|
||||||
|
|
||||||
|
@ -324,7 +321,6 @@ def configure_mingw(env):
|
||||||
|
|
||||||
elif env["target"] == "release_debug":
|
elif env["target"] == "release_debug":
|
||||||
env.Append(CCFLAGS=["-O2"])
|
env.Append(CCFLAGS=["-O2"])
|
||||||
env.Append(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
if env["debug_symbols"]:
|
if env["debug_symbols"]:
|
||||||
env.Prepend(CCFLAGS=["-g2"])
|
env.Prepend(CCFLAGS=["-g2"])
|
||||||
if env["optimize"] == "speed": # optimize for speed (default)
|
if env["optimize"] == "speed": # optimize for speed (default)
|
||||||
|
@ -334,8 +330,6 @@ 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=["DEV_ENABLED"])
|
|
||||||
|
|
||||||
## Compiler configuration
|
## Compiler configuration
|
||||||
|
|
||||||
|
|
|
@ -104,16 +104,12 @@ def configure(env):
|
||||||
elif env["optimize"] == "size": # optimize for size
|
elif env["optimize"] == "size": # optimize for size
|
||||||
env.Prepend(CCFLAGS=["-Os"])
|
env.Prepend(CCFLAGS=["-Os"])
|
||||||
|
|
||||||
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
|
|
||||||
if env["debug_symbols"]:
|
if env["debug_symbols"]:
|
||||||
env.Prepend(CCFLAGS=["-g2"])
|
env.Prepend(CCFLAGS=["-g2"])
|
||||||
|
|
||||||
elif env["target"] == "debug":
|
elif env["target"] == "debug":
|
||||||
env.Prepend(CCFLAGS=["-ggdb"])
|
env.Prepend(CCFLAGS=["-ggdb"])
|
||||||
env.Prepend(CCFLAGS=["-g3"])
|
env.Prepend(CCFLAGS=["-g3"])
|
||||||
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
|
|
||||||
env.Prepend(CPPDEFINES=["DEV_ENABLED"])
|
|
||||||
env.Append(LINKFLAGS=["-rdynamic"])
|
env.Append(LINKFLAGS=["-rdynamic"])
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
Loading…
Reference in a new issue