fix is_msvc and use_hot_reload variables

pull/1303/head
Thaddeus Crews 2023-11-06 10:43:24 -06:00
parent 2dfe7929de
commit 648b8c4489
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
1 changed files with 12 additions and 10 deletions

View File

@ -179,7 +179,7 @@ def options(opts, env):
BoolVariable( BoolVariable(
key="use_hot_reload", key="use_hot_reload",
help="Enable the extra accounting required to support 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),
) )
) )
@ -245,9 +245,20 @@ def generate(env):
print("Building for architecture " + env["arch"] + " on platform " + env["platform"]) 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"]: if env["use_hot_reload"]:
env.Append(CPPDEFINES=["HOT_RELOAD_ENABLED"]) 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 # Disable exception handling. Godot doesn't use exceptions anywhere, and this
# saves around 20% of binary size and very significant build time. # saves around 20% of binary size and very significant build time.
if env["disable_exceptions"]: if env["disable_exceptions"]:
@ -258,15 +269,6 @@ def generate(env):
elif env.get("is_msvc", False): elif env.get("is_msvc", False):
env.Append(CXXFLAGS=["/EHsc"]) 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 # Require C++17
if env.get("is_msvc", False): if env.get("is_msvc", False):
env.Append(CXXFLAGS=["/std:c++17"]) env.Append(CXXFLAGS=["/std:c++17"])