mirror of
https://github.com/godotengine/webrtc-native.git
synced 2026-01-03 14:09:58 +03:00
The num_jobs (-j flag) was being tracked as part of the cmake and openssl build actions, thus causing a rebuild when compiling with different concurrently. This commit strip the -j flag from the signature of the actions so scons won't rebuild openssl/libdatachannel when changing the parallelism option.
64 lines
2.1 KiB
Python
64 lines
2.1 KiB
Python
import os
|
|
|
|
|
|
def rtc_cmake_config(env):
|
|
config = {
|
|
"USE_NICE": 0,
|
|
"NO_WEBSOCKET": 1,
|
|
"NO_EXAMPLES": 1,
|
|
"NO_TESTS": 1,
|
|
"BUILD_WITH_WARNINGS": "0", # Disables werror in libsrtp.
|
|
"OPENSSL_USE_STATIC_LIBS": 1,
|
|
"OPENSSL_INCLUDE_DIR": env["SSL_INCLUDE"],
|
|
"OPENSSL_SSL_LIBRARY": env["SSL_LIBRARY"],
|
|
"OPENSSL_CRYPTO_LIBRARY": env["SSL_CRYPTO_LIBRARY"],
|
|
"OPENSSL_ROOT_DIR": env["SSL_INSTALL"],
|
|
}
|
|
return config
|
|
|
|
|
|
def build_library(env):
|
|
if env["platform"] == "windows":
|
|
env.PrependUnique(LIBS=["iphlpapi", "bcrypt"])
|
|
|
|
env.Prepend(LIBS=env["RTC_LIBS"])
|
|
|
|
rtc_env = env.Clone()
|
|
rtc_targets = [env.Dir(env["RTC_BUILD"])] + env["RTC_LIBS"]
|
|
rtc_sources = [env.Dir(env["RTC_SOURCE"])]
|
|
rtc_env.Append(CMAKECONFFLAGS=["'-D%s=%s'" % it for it in rtc_cmake_config(env).items()])
|
|
rtc_env.Append(CMAKEBUILDFLAGS=["-t", "datachannel-static"])
|
|
rtc = rtc_env.CMake(rtc_targets, rtc_sources, CMAKEBUILDTYPE=env["RTC_BUILD_TYPE"])
|
|
rtc_env.Depends(rtc, rtc_env["SSL_LIBS"])
|
|
return rtc
|
|
|
|
|
|
def exists(env):
|
|
return "CMake" in env
|
|
|
|
|
|
def generate(env):
|
|
env["RTC_SOURCE"] = env.Dir("#thirdparty/libdatachannel").abspath
|
|
env["RTC_BUILD_TYPE"] = "RelWithDebInfo" if env["debug_symbols"] else "Release"
|
|
env["RTC_BUILD"] = env.Dir(
|
|
"#bin/thirdparty/libdatachannel/{}/{}/{}".format(env["platform"], env["arch"], env["RTC_BUILD_TYPE"])
|
|
).abspath
|
|
env["RTC_INCLUDE"] = env["RTC_SOURCE"] + "/include"
|
|
lib_ext = ".a"
|
|
lib_prefix = "lib"
|
|
if env.get("is_msvc", False):
|
|
lib_ext = ".lib"
|
|
lib_prefix = ""
|
|
env["RTC_LIBS"] = [
|
|
env.File(env["RTC_BUILD"] + "/" + lib)
|
|
for lib in [
|
|
"{}datachannel-static{}".format(lib_prefix, lib_ext),
|
|
"deps/libjuice/{}juice-static{}".format(lib_prefix, lib_ext),
|
|
"deps/libsrtp/{}srtp2{}".format(lib_prefix, lib_ext),
|
|
"deps/usrsctp/usrsctplib/{}usrsctp{}".format(lib_prefix, lib_ext),
|
|
]
|
|
]
|
|
env.AddMethod(build_library, "BuildLibDataChannel")
|
|
env.Append(LIBPATH=[env["RTC_BUILD"]])
|
|
env.Append(CPPPATH=[env["RTC_INCLUDE"]])
|