Skip to content

Override for debug_features in SCons and CMake #1737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions cmake/godotcpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,8 @@ function(godotcpp_generate)

# Transform options into generator expressions
set(HOT_RELOAD-UNSET "$<STREQUAL:${GODOTCPP_USE_HOT_RELOAD},>")

set(DEBUG_FEATURES-UNSET "$<STREQUAL:${GODOTCPP_DEBUG_FEATURES},>")
set(DISABLE_EXCEPTIONS "$<BOOL:${GODOTCPP_DISABLE_EXCEPTIONS}>")

set(THREADS_ENABLED "$<BOOL:${GODOTCPP_THREADS}>")

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

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

# Suffix
string(
Expand Down
10 changes: 9 additions & 1 deletion tools/godotcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ def options(opts, env):
)
)

opts.Add(
BoolVariable(
key="debug_features",
help="Enable the DEBUG_ENABLED and DEBUG_METHODS_ENABLED pre-processor defines.",
default=env.get("debug_features", None),
)
)

opts.Add(
BoolVariable(
"disable_exceptions", "Force disabling exception handling code", default=env.get("disable_exceptions", True)
Expand Down Expand Up @@ -426,9 +434,9 @@ def generate(env):

# These defaults may be needed by platform tools
env.use_hot_reload = env.get("use_hot_reload", env["target"] != "template_release")
env.debug_features = env.get("debug_features", env["target"] != "template_release")
env.editor_build = env["target"] == "editor"
env.dev_build = env["dev_build"]
env.debug_features = env["target"] in ["editor", "template_debug"]

if env.dev_build:
opt_level = "none"
Expand Down