Windows 下载编译 WebRtc
前言:
webrtc官网(webrtc.org)编译文档相当少。吐槽一下,太精简,哈哈哈哈哈
之前编译过chromium源码了,google套路相当熟练了。已经安装 VS2017和WindowsSDK,请参考Chromium编译文章
1.下载depot_tools工具
depot_tools工具 git命令:git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git (在上面截图箭头地址里面可以找到)
设置depot_tools工具的路径到系统环境变量Path
2.设置网络代理
国内本机下载webRtc源码需要翻墙,设置本地代理。
本人使用泡芙网翻墙工具:https://www.paofucloud.co/auth/register?code=4Dfp
A.cmd设置git代理 都设置成http://127.0.0.1:port
git config --global http.proxy http://127.0.0.1:port(自己的代理端口,1080)
git config --global https.proxy http://127.0.0.1:port(自己的代理端口,1080)
查看代理设置
git config --global -l
git config --global --unset http.proxy
git config --global --unset https.proxy
B.cmd设置本地代理
set http_proxy=http://127.0.0.1:port(自己的代理端口,1080)
set https_proxy=http://127.0.0.1:port(自己的代理端口,1080)
不设置2.B的本地代理,会报下面的错误
3.更新depot_tools
cmd输入gclient
4.下载webrtc
cmd下执行:
set GYP_MSVS_VERSION=2017
set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
set GYP_GENERATORS=msvs-ninja,ninja
fetch --nohooks webrtc
大约7G的文件,翻墙网速1MB/s,下载两小时。
5.同步资源文件
cmd下执行 gclient sync
6.创建工程
cmd下执行
cd src
gn gen --ide=vs out/Default
7.编译工程
cmd下执行 ninja -C out/Default
大约半小时
8.相关测试例子,请参考官网,如下