Skip to content
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

Override for debug_features in SCons and CMake #1737

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions cmake/godotcpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,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 @@ -309,8 +308,11 @@ function(godotcpp_generate)
set(TARGET_NAME "godot-cpp.${TARGET_ALIAS}")

# Generator Expressions that rely on the target
set(DEBUG_FEATURES "$<NOT:$<STREQUAL:${TARGET_ALIAS},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 @@ -336,6 +336,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 @@ -425,9 +433,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