Skip to content

Commit 130379e

Browse files
committed
Override for debug_features in SCons and CMake
Add debug_features/GODOTCPP_DEBUG_FEATURES as an option to override the conditional use of DEBUG_ENABLED and DEBUG_METHODS_ENABLED
1 parent f08e781 commit 130379e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

cmake/godotcpp.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,8 @@ function(godotcpp_generate)
290290

291291
# Transform options into generator expressions
292292
set(HOT_RELOAD-UNSET "$<STREQUAL:${GODOTCPP_USE_HOT_RELOAD},>")
293-
293+
set(DEBUG_FEATURES-UNSET "$<STREQUAL:${GODOTCPP_DEBUG_FEATURES},>")
294294
set(DISABLE_EXCEPTIONS "$<BOOL:${GODOTCPP_DISABLE_EXCEPTIONS}>")
295-
296295
set(THREADS_ENABLED "$<BOOL:${GODOTCPP_THREADS}>")
297296

298297
# GODOTCPP_DEV_BUILD
@@ -308,10 +307,10 @@ function(godotcpp_generate)
308307
endif()
309308
set(IS_DEV_BUILD "$<BOOL:${GODOTCPP_DEV_BUILD}>")
310309

311-
### Define our godot-cpp library targets
312310
# Generator Expressions that rely on the target
313-
set(DEBUG_FEATURES "$<NOT:$<STREQUAL:${GODOTCPP_TARGET},template_release>>")
314-
set(HOT_RELOAD "$<IF:${HOT_RELOAD-UNSET},${DEBUG_FEATURES},$<BOOL:${GODOTCPP_USE_HOT_RELOAD}>>")
311+
set(TEMPLATE_RELEASE "$<STREQUAL:${TARGET_ALIAS},template_release>")
312+
set(DEBUG_FEATURES "$<IF:${DEBUG_FEATURES-UNSET},$<NOT:${TEMPLATE_RELEASE}>,$<BOOL:${GODOTCPP_DEBUG_FEATURES}>>")
313+
set(HOT_RELOAD "$<IF:${HOT_RELOAD-UNSET},$<NOT:${TEMPLATE_RELEASE}>,$<BOOL:${GODOTCPP_USE_HOT_RELOAD}>>")
315314

316315
# Suffix
317316
string(

tools/godotcpp.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,14 @@ def options(opts, env):
337337
)
338338
)
339339

340+
opts.Add(
341+
BoolVariable(
342+
key="debug_features",
343+
help="Enable the DEBUG_ENABLED and DEBUG_METHODS_ENABLED pre-processor defines.",
344+
default=env.get("debug_features", None),
345+
)
346+
)
347+
340348
opts.Add(
341349
BoolVariable(
342350
"disable_exceptions", "Force disabling exception handling code", default=env.get("disable_exceptions", True)
@@ -426,9 +434,9 @@ def generate(env):
426434

427435
# These defaults may be needed by platform tools
428436
env.use_hot_reload = env.get("use_hot_reload", env["target"] != "template_release")
437+
env.debug_features = env.get("debug_features", env["target"] != "template_release")
429438
env.editor_build = env["target"] == "editor"
430439
env.dev_build = env["dev_build"]
431-
env.debug_features = env["target"] in ["editor", "template_debug"]
432440

433441
if env.dev_build:
434442
opt_level = "none"

0 commit comments

Comments
 (0)