From 2e9a25bb393ac8b874b3fffea6506e8b42da9d88 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sun, 27 Nov 2022 16:04:55 +0100 Subject: [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). --- SConstruct | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'SConstruct') 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"]) -- cgit v1.2.3