webrtc windows 编译
一、webrtc官网
https://webrtc.org/ 新版网站,好多东西找不到
https://webrtc.github.io/webrtc-org/ 旧版网站,说明比较详细,建议看这个
二、编译步骤
webrtc native-code开发说明参考:https://webrtc.github.io/webrtc-org/native-code/development/
1、安装依赖软件
参考 https://webrtc.github.io/webrtc-org/native-code/development/prerequisite-sw/
1.1 安装depot-tools
安装depot-tools,并添加到环境变量。参考:http://dev.chromium.org/developers/how-tos/install-depot-tools
1.2 安装Visual Studio和Windows SDK
Chromium requires Visual Studio 2017 (>=15.7.2) to build, but VS2019 (>=16.0.0) is preferred. Visual Studio can also be used to debug Chromium, and VS2019 is preferred for this as it handles Chromium‘s large debug information much better. 推荐用Visual Studio 2019,建议默认目录安装不然编译可能包找不到Visual Studio。
You must have the version 10.0.18362 or higher Windows 10 SDK installed. This can be installed separately or by checking the appropriate box in the Visual Studio Installer.安装Windows 10 SDK。windows编译参考如下:
https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md
2、下载代码
开始下载前先设置set DEPOT_TOOLS_WIN_TOOLCHAIN=0,要不然gclient sync最后报错还需要设置。
mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks webrtc
gclient sync //同步下载webrtc依赖的编译软件
参考:https://webrtc.github.io/webrtc-org/native-code/development/
3、代码更新
git checkout master //切换到主分支
git pull origin master //拉取主分支最新代码
gclient sync //下载最新的编译依赖
git checkout my-branch
git merge master
参考:https://webrtc.github.io/webrtc-org/native-code/development/
4、编译
4.1 window设置visual studio环境变量
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_GENERATORS=msvs
set GYP_MSVS_VERSION=2019
4.2 命令行ninja编译
gn gen out/Default
4.3 使用Visual Studio IDE调用ninja编译
gn gen --ide=vs out\Debug
https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md
问题一:git branch -r 不见realse分支。
解决:参考 https://wiki.mozilla.org/Media/WebRTC/Updating_Process
需要修改本地文件 src/.git/config,向该文件中添加:
fetch = +refs/branch-heads/*:refs/remotes/branch-heads/*
执行 git fetch
在执行 git branch -r 就可以看到release分支了。
问题二:
ImportError: No module named win32file
ninja: build stopped: subcommand failed.
解决:python -m pip install pypiwin32
本文地址:https://blog.csdn.net/Randy009/article/details/107282025
推荐阅读