fork/rust-sdks

git clone https://git.julia.blue/fork/rust-sdks

aoife cassidyci: attempt to fix windows webrtc builds (#521)2034345

livekit/livekit-ffi@0.13.0
2.9 KiB91 linesraw
1@echo off
2
3setlocal enabledelayedexpansion
4
5set arch=
6set profile=release
7
8:arg_loop
9if "%1" == "" goto end_arg_loop
10if "%1" == "--arch" (
11    set "arch=%2"
12    shift & shift & goto arg_loop
13)
14if "%1" == "--profile" (
15    set "profile=%2"
16    shift & shift & goto arg_loop
17)
18echo Error: Unknown argument '%1'
19exit /b 1
20:end_arg_loop
21
22if not "!arch!" == "x64" if not "!arch!" == "arm64" (
23    echo Error: Invalid value for --arch. Must be 'x64' or 'arm64'.
24    exit /b 1
25)
26if not "!profile!" == "debug" if not "!profile!" == "release" (
27    echo Error: Invalid value for --profile. Must be 'debug' or 'release'.
28    exit /b 1
29)
30
31echo "Building LiveKit WebRTC - Windows"
32echo "Arch: !arch!"
33echo "Profile: !profile!"
34
35if not exist depot_tools (
36  git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
37)
38
39set COMMAND_DIR=%~dp0
40set PATH=%cd%\depot_tools;%PATH%
41set DEPOT_TOOLS_WIN_TOOLCHAIN=0
42set GYP_GENERATORS=ninja,msvs-ninja
43set GYP_MSVS_VERSION=2019
44set OUTPUT_DIR=src\out-!arch!-!profile!
45set ARTIFACTS_DIR=%cd%\win-!arch!-!profile!
46set vs2019_install=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
47
48if not exist src (
49  call gclient.bat sync -D --with_branch_heads --with_tags
50)
51
52cd src
53call git apply "%COMMAND_DIR%/patches/add_licenses.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
54call git apply "%COMMAND_DIR%/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
55call git apply "%COMMAND_DIR%/patches/windows_silence_warnings.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
56call git apply "%COMMAND_DIR%/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
57
58cd third_party
59call git apply "%COMMAND_DIR%/patches/abseil_use_optional.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
60cd ..
61
62cd ..
63
64mkdir "%ARTIFACTS_DIR%\lib"
65
66set "debug=false"
67if "!profile!" == "debug" (
68  set "debug=true"
69)
70
71rem generate ninja for release
72call gn.bat gen %OUTPUT_DIR% --root="src" ^
73  --args="is_debug=!debug! is_clang=true target_cpu=\"!arch!\" use_custom_libcxx=false rtc_libvpx_build_vp9=true enable_libaom=true rtc_include_tests=false rtc_build_examples=false rtc_build_tools=false is_component_build=false rtc_enable_protobuf=false rtc_use_h264=true ffmpeg_branding=\"Chrome\" symbol_level=0 enable_iterator_debugging=false"
74
75rem build
76ninja.exe -C %OUTPUT_DIR% :default
77
78rem copy static library for release build
79copy "%OUTPUT_DIR%\obj\webrtc.lib" "%ARTIFACTS_DIR%\lib"
80
81rem generate license
82call python3 "%cd%\src\tools_webrtc\libs\generate_licenses.py" ^
83  --target :default %OUTPUT_DIR% %OUTPUT_DIR%
84
85copy "%OUTPUT_DIR%\obj\webrtc.ninja" "%ARTIFACTS_DIR%"
86copy "%OUTPUT_DIR%\args.gn" "%ARTIFACTS_DIR%"
87copy "%OUTPUT_DIR%\LICENSE.md" "%ARTIFACTS_DIR%"
88
89rem copy header
90xcopy src\*.h "%ARTIFACTS_DIR%\include" /C /S /I /F /H
91