diff options
Diffstat (limited to 'tools/rtc.py')
-rw-r--r-- | tools/rtc.py | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/tools/rtc.py b/tools/rtc.py index 680e772..81c3edd 100644 --- a/tools/rtc.py +++ b/tools/rtc.py @@ -19,6 +19,11 @@ def rtc_cmake_config(env): def rtc_emitter(target, source, env): + if env["platform"] == "windows": + env.PrependUnique(LIBS=["iphlpapi", "bcrypt"]) + + env.Prepend(LIBS=env["RTC_LIBS"]) + env.Depends(env["RTC_LIBS"], env["SSL_LIBS"]) env.Depends( env["RTC_LIBS"], @@ -33,7 +38,10 @@ def rtc_action(target, source, env): source_dir = env["RTC_SOURCE"] opts = rtc_cmake_config(rtc_env) rtc_env.CMakeConfigure(source_dir, build_dir, ["-D%s=%s" % it for it in opts.items()]) - rtc_env.CMakeBuild(build_dir, "datachannel-static") + opt_args = [] + if env.get("is_msvc", False): + opt_args = ["--config", opts["CMAKE_BUILD_TYPE"]] + rtc_env.CMakeBuild(build_dir, "datachannel-static", opt_args=opt_args) return None @@ -42,21 +50,27 @@ def exists(env): def generate(env): - env["RTC_SOURCE"] = env["DEPS_SOURCE"] + "/libdatachannel" - env["RTC_BUILD"] = env["DEPS_BUILD"] + "/libdatachannel" + env["RTC_SOURCE"] = env.Dir("#thirdparty/libdatachannel").abspath + env["RTC_BUILD"] = env.Dir( + "#bin/thirdparty/libdatachannel/{}/{}/{}".format( + env["platform"], env["arch"], "RelWithDebInfo" if env["debug_symbols"] else "Release" + ) + ).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 [ - "libdatachannel-static.a", - "deps/libjuice/libjuice-static.a", - "deps/libsrtp/libsrtp2.a", - "deps/usrsctp/usrsctplib/libusrsctp.a", + "{}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.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"]) - if env["platform"] == "windows": - env.AppendUnique(LIBS=["iphlpapi", "bcrypt"]) |