summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-06-30 11:44:33 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-06-30 16:52:36 +0200
commitcb2be8723a16f9fdb13582562cb630c945dcd0a7 (patch)
tree20c0c99c5217792e054f876712a54ae8b4f1eec8 /SConstruct
parentd278661d767f5e1f8f68af2d0a706f5f044aa5d3 (diff)
downloadfork-godot-webrtc-native-cb2be8723a16f9fdb13582562cb630c945dcd0a7.tar.gz
fork-godot-webrtc-native-cb2be8723a16f9fdb13582562cb630c945dcd0a7.tar.bz2
fork-godot-webrtc-native-cb2be8723a16f9fdb13582562cb630c945dcd0a7.zip
Support building for Godot 4.1 (new default).
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct22
1 files changed, 16 insertions, 6 deletions
diff --git a/SConstruct b/SConstruct
index 8118948..9080be6 100644
--- a/SConstruct
+++ b/SConstruct
@@ -18,7 +18,7 @@ def replace_flags(flags, replaces):
env = Environment()
opts = Variables(["customs.py"], ARGUMENTS)
-opts.Add(EnumVariable("godot_version", "The Godot target version", "4", ["3", "4"]))
+opts.Add(EnumVariable("godot_version", "The Godot target version", "4.1", ["3", "4.0", "4.1"]))
opts.Update(env)
# Minimum target platform versions.
@@ -96,6 +96,8 @@ if env["godot_version"] == "3":
elif not env["use_mingw"]:
# Mark as MSVC build (would have failed to build the library otherwise).
env["is_msvc"] = True
+elif env["godot_version"] == "4.0":
+ env = SConscript("godot-cpp-4.0/SConstruct").Clone()
else:
env = SConscript("godot-cpp/SConstruct").Clone()
@@ -135,8 +137,10 @@ opts.Update(env)
target = env["target"]
if env["godot_version"] == "3":
result_path = os.path.join("bin", "gdnative", "webrtc" if env["target"] == "release" else "webrtc_debug")
+elif env["godot_version"] == "4.0":
+ result_path = os.path.join("bin", "extension-4.0", "webrtc")
else:
- result_path = os.path.join("bin", "extension", "webrtc")
+ result_path = os.path.join("bin", "extension-4.1", "webrtc")
# Our includes and sources
env.Append(CPPPATH=["src/"])
@@ -148,12 +152,14 @@ sources.append(
"src/WebRTCLibPeerConnection.cpp",
]
)
-if env["godot_version"] == "4":
- sources.append("src/init_gdextension.cpp")
-else:
+if env["godot_version"] == "3":
env.Append(CPPDEFINES=["GDNATIVE_WEBRTC"])
sources.append("src/init_gdnative.cpp")
add_sources(sources, "src/net/", "cpp")
+else:
+ sources.append("src/init_gdextension.cpp")
+ if env["godot_version"] == "4.0":
+ env.Append(CPPDEFINES=["GDEXTENSION_WEBRTC_40"])
# Add our build tools
for tool in ["openssl", "cmake", "rtc"]:
@@ -187,6 +193,10 @@ if env["godot_version"] == "3":
},
)
else:
- extfile = env.InstallAs(os.path.join(result_path, "webrtc.gdextension"), "misc/webrtc.gdextension")
+ extfile = env.Substfile(
+ os.path.join(result_path, "webrtc.gdextension"),
+ "misc/webrtc.gdextension",
+ SUBST_DICT={"{GODOT_VERSION}": env["godot_version"]},
+ )
Default(extfile)