编译32bit的webrtc的windows release library

set WINDOWSSDKDIR=D:\Windows Kits\10
set vs2022_install=d:\Program Files\Microsoft Visual Studio\2022\Community
set GYP_MSVS_OVERRIDE_PATH=d:\Program Files\Microsoft Visual Studio\2022\Community
set GYP_GENERATORS=msvs-ninja,ninja
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_MSVS_VERSION = 2022

E:\Webrtc\webrtc-checkout\src>gn args out/x86

粘贴下面设置到args.gn的弹出编辑器中

is_debug = false
rtc_include_tests = false
rtc_use_h264 = false
is_component_build = false
rtc_build_examples = false
use_rtti = true
rtc_build_tools = false
target_os = "win"
target_cpu = "x86"
use_custom_libcxx = false
is_clang=true

然后保存 ,这样gn就会生成编译windows 32bit release 库文件的指令。
注意从M100开始webrtc编译已经不支持msvc的编译器了,只能使用clang-cl编译器,所以is_clang一定要设为true

编译Debug版的时候一定要加上enable_iterator_debugging=true

https://www.colabug.com/2020/0301/7060674/

另外rtc_enable_protobuf=false,否则编译protobuf时可能会报告Use of offsetof macro on non standard-layout type错误

追记:

不同的分支的获取方法
M114对应的分支名是refs/branch-heads/5735
https://webrtc.googlesource.com/src.git/+log/refs/branch-heads/5735

获取方法
git checkout -b M114 refs/remotes/branch-heads/5735

其他Mxx对应的heads的number可以从下面网站查到
https://chromiumdash.appspot.com/releases

checkout 之后,一定要gclient sync同步一下编译toolchain

另外,webrtc代码现在基本都要打补丁才能编译。补丁可以在https://github.com/shiguredo-webrtc-build/webrtc-build/releases找到