summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-12-29 19:19:55 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-12-30 14:34:15 +0100
commitbdd9d5074534db22ef0030f52db35aa04721ed09 (patch)
tree02e7cb119a26e52b3c472c5c0ed7b03a5095da05 /SConstruct
parent5348407de99ccfa49033170674060397f56490e6 (diff)
downloadfork-godot-webrtc-native-bdd9d5074534db22ef0030f52db35aa04721ed09.tar.gz
fork-godot-webrtc-native-bdd9d5074534db22ef0030f52db35aa04721ed09.tar.bz2
fork-godot-webrtc-native-bdd9d5074534db22ef0030f52db35aa04721ed09.zip
[SCons] Refactor build tools.
Split dependency builders into separate tools, optimize OpenSSL builds.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct34
1 files changed, 6 insertions, 28 deletions
diff --git a/SConstruct b/SConstruct
index e804557..111caa1 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2,8 +2,6 @@
import os, sys, platform, json, subprocess
-import builders
-
def add_sources(sources, dirpath, extension):
for f in os.listdir(dirpath):
@@ -101,27 +99,12 @@ else:
result_path = os.path.join("bin", "extension", "webrtc")
# Dependencies
-env.Append(BUILDERS={
- "BuildOpenSSL": env.Builder(action=builders.ssl_action, emitter=builders.ssl_emitter),
- "BuildLibDataChannel": env.Builder(action=builders.rtc_action, emitter=builders.rtc_emitter),
-})
-
-# 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.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=[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.File(builders.get_rtc_source_dir(env) + "/CMakeLists.txt")])
+for tool in ["cmake", "common", "ssl", "rtc"]:
+ env.Tool(tool, toolpath=["tools"])
-env.Append(LIBPATH=[builders.get_rtc_build_dir(env)])
-env.Append(CPPPATH=[builders.get_rtc_include_dir(env)])
-env.Prepend(LIBS=[builders.get_rtc_libs(env)])
+ssl = env.BuildOpenSSL()
+env.NoCache(ssl) # Needs refactoring to properly cache generated headers.
+rtc = env.BuildLibDataChannel()
# Our includes and sources
env.Append(CPPPATH=["src/"])
@@ -140,15 +123,10 @@ else:
sources.append("src/init_gdnative.cpp")
add_sources(sources, "src/net/", "cpp")
-env.Depends(sources, [builders.get_ssl_libs(env), builders.get_rtc_libs(env)])
+env.Depends(sources, [ssl, rtc])
# Make the shared library
result_name = "webrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
-env.Depends(sources, ssl)
-
-if env["platform"] == "windows" and env["use_mingw"]:
- env.Append(LIBS=["iphlpapi", "ws2_32", "bcrypt"])
-
library = env.SharedLibrary(target=os.path.join(result_path, "lib", result_name), source=sources)
Default(library)