Changes necessary for hot reload to work

This commit is contained in:
David Snopek
2023-08-04 11:02:57 -05:00
parent c44c3d5ebf
commit df849651d9
7 changed files with 63 additions and 0 deletions

View File

@@ -175,6 +175,14 @@ def options(opts, env):
)
)
opts.Add(
BoolVariable(
key="use_hot_reload",
help="Enable the extra accounting required to support hot reload.",
default=(env.get("target", "template_debug") != "template_release"),
)
)
# Add platform options
for pl in platforms:
tool = Tool(pl, toolpath=["tools"])
@@ -231,6 +239,9 @@ def generate(env):
print("Building for architecture " + env["arch"] + " on platform " + env["platform"])
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):

View File

@@ -14,6 +14,9 @@ def generate(env):
if env["use_llvm"]:
clang.generate(env)
clangxx.generate(env)
elif env["use_hot_reload"]:
# Required for extensions to truly unload.
env.Append(CXXFLAGS=["-fno-gnu-unique"])
env.Append(CCFLAGS=["-fPIC", "-Wwrite-strings"])
env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])