summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-08-04 11:02:57 -0500
committerDavid Snopek <dsnopek@gmail.com>2023-09-25 22:13:33 -0500
commitdf849651d9d71e3b901fe386a6752aec368c7206 (patch)
treefc6e5fabafb682aeba91c124d7c4beebb5c9c4ef /tools
parentc44c3d5ebf9826214efc971f0cbe047789af2575 (diff)
downloadredot-cpp-df849651d9d71e3b901fe386a6752aec368c7206.tar.gz
Changes necessary for hot reload to work
Diffstat (limited to 'tools')
-rw-r--r--tools/godotcpp.py11
-rw-r--r--tools/linux.py3
2 files changed, 14 insertions, 0 deletions
diff --git a/tools/godotcpp.py b/tools/godotcpp.py
index 969f8c4..c89335d 100644
--- a/tools/godotcpp.py
+++ b/tools/godotcpp.py
@@ -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):
diff --git a/tools/linux.py b/tools/linux.py
index cb48ae5..823b66e 100644
--- a/tools/linux.py
+++ b/tools/linux.py
@@ -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'"])