diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/cmake.py | 1 | ||||
-rw-r--r-- | tools/common.py | 5 | ||||
-rw-r--r-- | tools/rtc.py | 31 | ||||
-rw-r--r-- | tools/ssl.py | 50 |
4 files changed, 50 insertions, 37 deletions
diff --git a/tools/cmake.py b/tools/cmake.py index 0d6ee6b..2362312 100644 --- a/tools/cmake.py +++ b/tools/cmake.py @@ -1,4 +1,3 @@ - def exists(env): return True diff --git a/tools/common.py b/tools/common.py index aa99c5c..4bd5ada 100644 --- a/tools/common.py +++ b/tools/common.py @@ -1,8 +1,9 @@ - def exists(env): return True def generate(env): env["DEPS_SOURCE"] = env.Dir("#thirdparty").abspath - env["DEPS_BUILD"] = env.Dir("#bin/thirdparty").abspath + "/{}.{}.dir".format(env["suffix"][1:], "RelWithDebInfo" if env["debug_symbols"] else "Release") + env["DEPS_BUILD"] = env.Dir("#bin/thirdparty").abspath + "/{}.{}.dir".format( + env["suffix"][1:], "RelWithDebInfo" if env["debug_symbols"] else "Release" + ) diff --git a/tools/rtc.py b/tools/rtc.py index 0e7330c..34da8eb 100644 --- a/tools/rtc.py +++ b/tools/rtc.py @@ -1,5 +1,6 @@ import os + def rtc_cmake_config(env): config = { "USE_NICE": 0, @@ -30,7 +31,9 @@ def rtc_cmake_config(env): config["CMAKE_SYSTEM_VERSION"] = api config["CMAKE_ANDROID_ARCH_ABI"] = abi config["ANDROID_ABI"] = abi - config["CMAKE_TOOLCHAIN_FILE"] = "%s/build/cmake/android.toolchain.cmake" % os.environ.get("ANDROID_NDK_ROOT", "") + config["CMAKE_TOOLCHAIN_FILE"] = "%s/build/cmake/android.toolchain.cmake" % os.environ.get( + "ANDROID_NDK_ROOT", "" + ) config["CMAKE_ANDROID_STL_TYPE"] = "c++_static" elif env["platform"] == "linux": march = "-m32" if env["arch"] == "x86_32" else "-m64" @@ -49,7 +52,7 @@ def rtc_cmake_config(env): config["CMAKE_OSX_DEPLOYMENT_TARGET"] = "11.0" config["CMAKE_OSX_ARCHITECTURES"] = env["arch"] if env["ios_simulator"]: - config["CMAKE_OSX_SYSROOT"] = "iphonesimulator" + config["CMAKE_OSX_SYSROOT"] = "iphonesimulator" elif env["platform"] == "windows": config["CMAKE_SYSTEM_NAME"] = "Windows" config["BUILD_WITH_WARNINGS"] = "0" # Disables werror in libsrtp. @@ -58,7 +61,10 @@ def rtc_cmake_config(env): def rtc_emitter(target, source, env): env.Depends(env["RTC_LIBS"], env["SSL_LIBS"]) - env.Depends(env["RTC_LIBS"], [env.File(__file__), env.Dir(env["RTC_SOURCE"]), env.File(env["RTC_SOURCE"] + "/CMakeLists.txt")]) + env.Depends( + env["RTC_LIBS"], + [env.File(__file__), env.Dir(env["RTC_SOURCE"]), env.File(env["RTC_SOURCE"] + "/CMakeLists.txt")], + ) return env["RTC_LIBS"], env.Dir(env["RTC_SOURCE"]) @@ -80,15 +86,16 @@ def generate(env): env["RTC_SOURCE"] = env["DEPS_SOURCE"] + "/libdatachannel" env["RTC_BUILD"] = env["DEPS_BUILD"] + "/libdatachannel" env["RTC_INCLUDE"] = env["RTC_SOURCE"] + "/include" - env["RTC_LIBS"] = [env.File(env["RTC_BUILD"] + "/" + lib) for lib in [ - "libdatachannel-static.a", - "deps/libjuice/libjuice-static.a", - "deps/libsrtp/libsrtp2.a", - "deps/usrsctp/usrsctplib/libusrsctp.a" - ]] - env.Append(BUILDERS={ - "BuildLibDataChannel": env.Builder(action=rtc_action, emitter=rtc_emitter) - }) + env["RTC_LIBS"] = [ + env.File(env["RTC_BUILD"] + "/" + lib) + for lib in [ + "libdatachannel-static.a", + "deps/libjuice/libjuice-static.a", + "deps/libsrtp/libsrtp2.a", + "deps/usrsctp/usrsctplib/libusrsctp.a", + ] + ] + env.Append(BUILDERS={"BuildLibDataChannel": env.Builder(action=rtc_action, emitter=rtc_emitter)}) env.Append(LIBPATH=[env["RTC_BUILD"]]) env.Append(CPPPATH=[env["RTC_INCLUDE"]]) env.Prepend(LIBS=env["RTC_LIBS"]) diff --git a/tools/ssl.py b/tools/ssl.py index f62aca1..64436ec 100644 --- a/tools/ssl.py +++ b/tools/ssl.py @@ -1,6 +1,7 @@ import os from SCons.Defaults import Mkdir + def ssl_emitter(target, source, env): env.Depends(env["SSL_LIBS"], env.File(__file__)) return env["SSL_LIBS"], [env.Dir(env["SSL_SOURCE"]), env.File(env["SSL_SOURCE"] + "/VERSION.dat")] @@ -33,15 +34,17 @@ def ssl_action(target, source, env): elif env["platform"] == "android": api = env["android_api_level"] if int(env["android_api_level"]) > 28 else "28" - args.extend([ - { - "arm64": "android-arm64", - "arm32": "android-arm", - "x86_32": "android-x86", - "x86_64": "android-x86_64", - }[env["arch"]], - "-D__ANDROID_API__=%s" % api, - ]) + args.extend( + [ + { + "arm64": "android-arm64", + "arm32": "android-arm", + "x86_32": "android-x86", + "x86_64": "android-x86_64", + }[env["arch"]], + "-D__ANDROID_API__=%s" % api, + ] + ) # Setup toolchain path. ssl_env.PrependENVPath("PATH", os.path.dirname(env["CC"])) ssl_env["ENV"]["ANDROID_NDK_ROOT"] = os.environ.get("ANDROID_NDK_ROOT", "") @@ -56,7 +59,7 @@ def ssl_action(target, source, env): elif env["platform"] == "ios": if env["ios_simulator"]: - args.extend(["iossimulator-xcrun"]) + args.extend(["iossimulator-xcrun"]) elif env["arch"] == "arm32": args.extend(["ios-xcrun"]) elif env["arch"] == "arm64": @@ -67,23 +70,28 @@ def ssl_action(target, source, env): elif env["platform"] == "windows": if env["arch"] == "x86_32": if env["use_mingw"]: - args.extend([ - "mingw", - "--cross-compile-prefix=i686-w64-mingw32-", - ]) + args.extend( + [ + "mingw", + "--cross-compile-prefix=i686-w64-mingw32-", + ] + ) else: args.extend(["VC-WIN32"]) else: if env["use_mingw"]: - args.extend([ - "mingw64", - "--cross-compile-prefix=x86_64-w64-mingw32-", - ]) + args.extend( + [ + "mingw64", + "--cross-compile-prefix=x86_64-w64-mingw32-", + ] + ) else: args.extend(["VC-WIN64A"]) jobs = env.GetOption("num_jobs") - ssl_env.Execute([ + ssl_env.Execute( + [ Mkdir(build_dir), "cd %s && perl %s/Configure %s" % (build_dir, source_dir, " ".join(['"%s"' % a for a in args])), "make -C %s -j%s" % (build_dir, jobs), @@ -105,9 +113,7 @@ def generate(env): env["SSL_LIBRARY"] = env.File(env["SSL_BUILD"] + "/libssl.a") env["SSL_CRYPTO_LIBRARY"] = env.File(env["SSL_BUILD"] + "/libcrypto.a") env["SSL_LIBS"] = [env["SSL_LIBRARY"], env["SSL_CRYPTO_LIBRARY"]] - env.Append(BUILDERS={ - "BuildOpenSSL": env.Builder(action=ssl_action, emitter=ssl_emitter) - }) + env.Append(BUILDERS={"BuildOpenSSL": env.Builder(action=ssl_action, emitter=ssl_emitter)}) env.Prepend(CPPPATH=[env["SSL_INCLUDE"]]) env.Prepend(LIBPATH=[env["SSL_BUILD"]]) env.Append(LIBS=env["SSL_LIBS"]) |