@@ -179,7 +179,7 @@ def options(opts, env):
179179 BoolVariable (
180180 key = "use_hot_reload" ,
181181 help = "Enable the extra accounting required to support hot reload." ,
182- default = ( env .get ("target " , "template_debug" ) != "template_release" ),
182+ default = env .get ("use_hot_reload " , None ),
183183 )
184184 )
185185
@@ -245,9 +245,20 @@ def generate(env):
245245
246246 print ("Building for architecture " + env ["arch" ] + " on platform " + env ["platform" ])
247247
248+ if env .get ("use_hot_reload" ) is None :
249+ env ["use_hot_reload" ] = env ["target" ] != "template_release"
248250 if env ["use_hot_reload" ]:
249251 env .Append (CPPDEFINES = ["HOT_RELOAD_ENABLED" ])
250252
253+ tool = Tool (env ["platform" ], toolpath = ["tools" ])
254+
255+ if tool is None or not tool .exists (env ):
256+ raise ValueError ("Required toolchain not found for platform " + env ["platform" ])
257+
258+ tool .generate (env )
259+ target_tool = Tool ("targets" , toolpath = ["tools" ])
260+ target_tool .generate (env )
261+
251262 # Disable exception handling. Godot doesn't use exceptions anywhere, and this
252263 # saves around 20% of binary size and very significant build time.
253264 if env ["disable_exceptions" ]:
@@ -258,15 +269,6 @@ def generate(env):
258269 elif env .get ("is_msvc" , False ):
259270 env .Append (CXXFLAGS = ["/EHsc" ])
260271
261- tool = Tool (env ["platform" ], toolpath = ["tools" ])
262-
263- if tool is None or not tool .exists (env ):
264- raise ValueError ("Required toolchain not found for platform " + env ["platform" ])
265-
266- tool .generate (env )
267- target_tool = Tool ("targets" , toolpath = ["tools" ])
268- target_tool .generate (env )
269-
270272 # Require C++17
271273 if env .get ("is_msvc" , False ):
272274 env .Append (CXXFLAGS = ["/std:c++17" ])
0 commit comments