您当前的位置: 首页 >  windows

鱼儿-1226

暂无认证

  • 0浏览

    0关注

    1100博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Windows10下使用VS2019编译WebRTC

鱼儿-1226 发布时间:2020-08-27 10:55:28 ,浏览量:0

操作系统
  • Windows10专业版1909,64位版本
  • 内存12G,建议越大越好
  • 预留了50G磁盘空间,注意有大于4G文件,所以文件系统格式需要是NTFS
VS2019
  • 使用的是enterprise版,community版本也没有问题。
  • 在C盘安装,安装路径使用默认,据说修改会引起某些问题。
  • Desktop development with C++组件选择安装10.0.18362或以上的Win10 SDK,最新版的VS2019已经默认了。
  • 后面还需要修改Win10 SDK的安装,添加安装调试工具Debugging Tools for Windows。
  • Desktop development with C++组件选择安装MFC以及ATL这两项。

以下可能需要自备梯子

depot_tools安装
  • 获取depot_tools

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

depot_tools目录在D盘根目录上。

  • 将D:\depot_tools目录的路径加到System variables系统环境变量Path里,然后把该路径移到最前面(这个工具会下载自己的python和git,避免已安装冲突)。

  • 在User variables for Administration新建一个系统环境变量: DEPOT_TOOLS_WIN_TOOLCHAIN ,值设置为0,提示depot_tools使用本机的VS进行编译。

WebRTC源码

打开命令行窗口,在D盘新建个目录准备下载源代码,如下:

D: mkdir webrtc-checkout cd webrtc-checkout

在同一个命令行窗口里设置环境变量,你如果上面默认路径安装VS2019企业版,应该是一样的内容,其他版本相应修改下就好了。

set vs2019_install=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise set GYP_GENERATORS=msvs-ninja,ninja

执行下面的命令开始下载代码,这是个漫长的过程,下载的文件总大小大概10G,包括源码以及一些测试的音视频文件资源等等。

fetch --nohooks webrtc gclient sync

如果中途出错,那就继续运行 gclient sync 。 我这个挺顺利的,花了一夜时间,顺利完成。

编译

执行下面的命令,生成VS2019工程文件

cd src gn gen --ide=vs out/Default

这一次报错了,提示如下:

Traceback (most recent call last): File "D:/webrtc-checkout/src/build/compute_build_timestamp.py", line 127, in   sys.exit(main()) File "D:/webrtc-checkout/src/build/compute_build_timestamp.py", line 113, in main   last_commit_timestamp = int(open(lastchange_file).read()) IOError: [Errno 2] No such file or directory: 'D:\webrtc-checkout\src\build\util\LASTCHANGE.committime' ERROR at //build/timestamp.gni:31:19: Script returned non-zero exit code. build_timestamp = exec_script(compute_build_timestamp,        ^---------- Current dir: D:/webrtc-checkout/src/out/Default/ Command: D:/depot_tools/bootstrap-3_8_0_chromium_8_bin/python/bin/python.exe D:/webrtc-checkout/src/build/compute_build_timestamp.py default Returned 1. See //build/config/win/BUILD.gn:10:1: whence it was imported. import("//build/timestamp.gni") ^----------------------------- See //build/config/BUILDCONFIG.gn:446:5: which caused the file to be included. "//build/config/win:default_crt", ^-------------------------------

执行下面的命令,就可以修复,注意检查src目录下的build\util\LASTCHANGE是否存在,没有就继续运行源代码下载。

D:\webrtc-checkout\src>python build\util\lastchange.py build\util\LASTCHANGE

再次运行

D:\webrtc-checkout\src>gn gen --ide=vs out/Default Generating Visual Studio projects took 2261ms Done. Made 1083 targets from 229 files in 20181ms

生成的项目文件是 D:\webrtc-checkout\src\out\Default 目录下的 all.sln ,可以用VS2019打开。放个图。

 

vs打开webrtc项目

 

关注
打赏
1604459285
查看更多评论
立即登录/注册

微信扫码登录

0.0402s