编译WebRTC静态库
参考链接:https://blog.csdn.net/aggs1990/article/details/118230538
在cmd中设置临时环境变量
set PATH=%PATH%;D:\Soft\webrtc\depot_tools
set vs2019_install=D:\SetUp\Microsoft Visual Studio\2019\Community
set GYP_MSVS_OVERRIDE_PATH=D:\SetUp\Microsoft Visual Studio\2019\Community
set GYP_GENERATORS=msvs-ninja,ninja
set WINDOWSSDKDIR=C:\Program Files (x86)\Windows Kits\10
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
切换目录
cd D:\Soft\webrtc\webrtc-checkout\src
编译webrtc
gn gen out/Default_qt --ide="qtcreator" --args="is_debug=true rtc_include_tests=false is_clang=false use_lld=false enable_iterator_debugging=true use_custom_libcxx=false use_custom_libcxx_for_host=false"
处理报错
4.1错误提示:gn.py: Could not find checkout in any parent of the current path.
解决方法: 经查看gn.py文件,找到报错位置,发现是获取gn.exe路径时报错,果断将其改为绝对路径 D:\Soft\webrtc\webrtc-checkout\src\buildtools\win,该报错消失。
![](https://i-blog.csdnimg.cn/blog_migrate/b3a643c70005ed06e7daea3423591974.png)
4.2错误提示:ERROR at /l.gn:9:1: Unable to load "D:/Soft/webrtc/src/build/dotfile_settings.gni".import(" //build/dotfile_settings.gni")
解决方法:切换当前目录为D:\Soft\webrtc\webrtc-checkout\src
![](https://i-blog.csdnimg.cn/blog_migrate/aa5bc115c35407539a90013a586d7811.png)
执行通过后如下图所示
![](https://i-blog.csdnimg.cn/blog_migrate/e01caec22a551a42186a0ff3595309e9.png)
生成debug版本webrtc.lib
执行命令:ninja -C out/Default_qt
![](https://i-blog.csdnimg.cn/blog_migrate/1ea5b845336640cee1ad5af69b58b45f.png)
生成后的debug版本lib库如下图路径
![](https://i-blog.csdnimg.cn/blog_migrate/e718671135584ad8e905d419430ade4e.png)
同样的方法生成release版本lib库
#release版本
gn gen out/Release_qt --ide="qtcreator" --args="is_debug=false rtc_include_tests=false is_clang=false use_lld=false enable_iterator_debugging=true use_custom_libcxx=false use_custom_libcxx_for_host=false"
ninja -C out/Release_qt
![](https://i-blog.csdnimg.cn/blog_migrate/2ea4283aa2567d203a9e995f6714f0e2.png)
![](https://i-blog.csdnimg.cn/blog_migrate/92b71f121668c2376f16180c1b30639d.png)
生成后的release版本lib库如下图路径
![](https://i-blog.csdnimg.cn/blog_migrate/bec79760b6cb187f303f71d7b80ccaf1.png)
ninja源码下载与编译
源码下载地址:https://github.com/ninja-build/ninja
编译参考链接:https://www.cnblogs.com/yapingxin/p/16887769.html
在源码目录编译: python configure.py --bootstrap
编译结束后设置环境变量,能显示出版本号则安装成功。
![](https://i-blog.csdnimg.cn/blog_migrate/7d06d9fd8ea692edcb487a7ee0a5c91a.png)