Skip to content

Commit

Permalink
fix is_msvc and use_hot_reload variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Repiteo committed Nov 6, 2023
1 parent 2dfe792 commit 648b8c4
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tools/godotcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def options(opts, env):
BoolVariable(
key="use_hot_reload",
help="Enable the extra accounting required to support hot reload.",
default=(env.get("target", "template_debug") != "template_release"),
default=env.get("use_hot_reload", None),
)
)

Expand Down Expand Up @@ -245,9 +245,20 @@ def generate(env):

print("Building for architecture " + env["arch"] + " on platform " + env["platform"])

if env.get("use_hot_reload") is None:
env["use_hot_reload"] = env["target"] != "template_release"
if env["use_hot_reload"]:
env.Append(CPPDEFINES=["HOT_RELOAD_ENABLED"])

tool = Tool(env["platform"], toolpath=["tools"])

if tool is None or not tool.exists(env):
raise ValueError("Required toolchain not found for platform " + env["platform"])

tool.generate(env)
target_tool = Tool("targets", toolpath=["tools"])
target_tool.generate(env)

# Disable exception handling. Godot doesn't use exceptions anywhere, and this
# saves around 20% of binary size and very significant build time.
if env["disable_exceptions"]:
Expand All @@ -258,15 +269,6 @@ def generate(env):
elif env.get("is_msvc", False):
env.Append(CXXFLAGS=["/EHsc"])

tool = Tool(env["platform"], toolpath=["tools"])

if tool is None or not tool.exists(env):
raise ValueError("Required toolchain not found for platform " + env["platform"])

tool.generate(env)
target_tool = Tool("targets", toolpath=["tools"])
target_tool.generate(env)

# Require C++17
if env.get("is_msvc", False):
env.Append(CXXFLAGS=["/std:c++17"])
Expand Down

0 comments on commit 648b8c4

Please sign in to comment.