summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-11-27 16:04:55 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-11-28 03:10:20 +0100
commit2e9a25bb393ac8b874b3fffea6506e8b42da9d88 (patch)
tree0d4c00adedd17950d83e569e7e7ea06b2139b226 /SConstruct
parent6067addd96b5ed28e331d983e137830d9a0ff4c6 (diff)
downloadgodot-webrtc-native-2e9a25bb393ac8b874b3fffea6506e8b42da9d88.tar.gz
godot-webrtc-native-2e9a25bb393ac8b874b3fffea6506e8b42da9d88.tar.bz2
godot-webrtc-native-2e9a25bb393ac8b874b3fffea6506e8b42da9d88.zip
[SCons] Fix caching and path detection.
Add version file depenencies to SSL and RTC targets. Disable OpenSSL caching since it causes issues as it doesn't properly cache generated header files. Add hack to prepend PATH and few other vars (should probably be added to upstream godot-cpp), and clone scons envs when building ssl/rtc (so that PATHs are properly setup).
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct20
1 files changed, 15 insertions, 5 deletions
diff --git a/SConstruct b/SConstruct
index f041ce5..755d650 100644
--- a/SConstruct
+++ b/SConstruct
@@ -79,6 +79,15 @@ else:
ARGUMENTS["ios_min_version"] = "11.0"
env = SConscript("godot-cpp/SConstruct").Clone()
+# Should probably go to upstream godot-cpp.
+# We let SCons build its default ENV as it includes OS-specific things which we don't
+# want to have to pull in manually.
+# Then we prepend PATH to make it take precedence, while preserving SCons' own entries.
+env.PrependENVPath("PATH", os.getenv("PATH"))
+env.PrependENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
+if "TERM" in os.environ: # Used for colored output.
+ env["ENV"]["TERM"] = os.environ["TERM"]
+
# Patch mingw SHLIBSUFFIX.
if env["platform"] == "windows" and env["use_mingw"]:
env["SHLIBSUFFIX"] = ".dll"
@@ -100,19 +109,20 @@ env.Append(BUILDERS={
# SSL
ssl = env.BuildOpenSSL(env.Dir(builders.get_ssl_build_dir(env)), env.Dir(builders.get_ssl_source_dir(env)))
-env.Depends(ssl, env.File("builders.py"))
+env.Depends(ssl, [env.File("builders.py"), env.File(builders.get_ssl_source_dir(env) + "/VERSION.dat")])
+env.NoCache(ssl) # Needs refactoring to properly cache generated headers.
env.Prepend(CPPPATH=[builders.get_ssl_include_dir(env)])
env.Prepend(LIBPATH=[builders.get_ssl_build_dir(env)])
-env.Append(LIBS=[ssl])
+env.Append(LIBS=[builders.get_ssl_libs(env)])
# RTC
rtc = env.BuildLibDataChannel(env.Dir(builders.get_rtc_build_dir(env)), [env.Dir(builders.get_rtc_source_dir(env))] + ssl)
-env.Depends(rtc, env.File("builders.py"))
+env.Depends(rtc, [env.File("builders.py"), env.File(builders.get_rtc_source_dir(env) + "/CMakeLists.txt")])
env.Append(LIBPATH=[builders.get_rtc_build_dir(env)])
env.Append(CPPPATH=[builders.get_rtc_include_dir(env)])
-env.Prepend(LIBS=[rtc])
+env.Prepend(LIBS=[builders.get_rtc_libs(env)])
# Our includes and sources
env.Append(CPPPATH=["src/"])
@@ -130,7 +140,7 @@ else:
sources.append("src/init_gdnative.cpp")
add_sources(sources, "src/net/", "cpp")
-env.Depends(sources, [ssl, rtc])
+env.Depends(sources, [builders.get_ssl_libs(env), builders.get_rtc_libs(env)])
# Make the shared library
result_name = "webrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])