Skip to content

Commit 0bb02b2

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 6f981b3 commit 0bb02b2

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

cmake/godotcpp.cmake

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,8 @@ function(godotcpp_generate)
293293

294294
# Transform options into generator expressions
295295
set(HOT_RELOAD-UNSET "$<STREQUAL:${GODOTCPP_USE_HOT_RELOAD},>")
296-
296+
set(DEBUG_FEATURES-UNSET "$<STREQUAL:${GODOTCPP_DEBUG_FEATURES},>")
297297
set(DISABLE_EXCEPTIONS "$<BOOL:${GODOTCPP_DISABLE_EXCEPTIONS}>")
298-
299298
set(THREADS_ENABLED "$<BOOL:${GODOTCPP_THREADS}>")
300299

301300
# GODOTCPP_DEV_BUILD
@@ -311,10 +310,12 @@ function(godotcpp_generate)
311310
endif()
312311
set(IS_DEV_BUILD "$<BOOL:${GODOTCPP_DEV_BUILD}>")
313312

314-
### Define our godot-cpp library targets
315313
# Generator Expressions that rely on the target
316-
set(DEBUG_FEATURES "$<NOT:$<STREQUAL:${GODOTCPP_TARGET},template_release>>")
317-
set(HOT_RELOAD "$<IF:${HOT_RELOAD-UNSET},${DEBUG_FEATURES},$<BOOL:${GODOTCPP_USE_HOT_RELOAD}>>")
314+
set(TEMPLATE_RELEASE "$<STREQUAL:${TARGET_ALIAS},template_release>")
315+
set(DEBUG_FEATURES
316+
"$<IF:${DEBUG_FEATURES-UNSET},$<NOT:${TEMPLATE_RELEASE}>,$<BOOL:${GODOTCPP_DEBUG_FEATURES}>>"
317+
)
318+
set(HOT_RELOAD "$<IF:${HOT_RELOAD-UNSET},$<NOT:${TEMPLATE_RELEASE}>,$<BOOL:${GODOTCPP_USE_HOT_RELOAD}>>")
318319

319320
# Suffix
320321
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)