webrtc ios 代码下载编译终极版

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/tanningzhong/article/details/81383384

1. 准备工作

最近重新下载最新webrtc代码,发现新的mac上面老是会出现一些同步错误问题,在pc上面能正常下载,这里特别记录一下最终下载成功代码。

需要工具

1. 稳定的科学上网工具(我自己mac用了ShadowsocksX-NG-R8)
2. git
3. 安装depot_tools并配置环境变量(具体配置可以谷歌)   
    git clone https://chromium.googlesource.com/chromium/tools/depot_tools

配置环境

git代理配置

vim ~/.gitconfig 文件添加如下,后面端口配置成自己工具端口即可
[https]
    proxy = https://127.0.0.1:1087
[http]
    proxy = http://127.0.0.1:1087
[socks]
    proxy = http://127.0.0.1:1086

终端配置

Mac和Linux
export http_proxy=127.0.0.1:1087
export https_proxy=127.0.0.1:1087

Windows
set http_proxy=127.0.0.1:1087
set https_proxy=127.0.0.1:1087

depot_tools配置

在depot_tools目录下面建立http_proxy.boto文件
内容如下
[Boto]
proxy=127.0.0.1
proxy_port=1087
保存并退出

在设置终端设置环境变量  
export NO_AUTH_BOTO_CONFIG=/path/to/http_proxy.boto

到这里基本上准备工作都已经做完了。可以开始下载代码了。

2. 源码下载

1. mkdir webrtc-checout-ios && cd webrtc-checout-ios
2. fetch --nohooks webrtc_ios
3. gclient sync //同步代码,如果出错继续执行这行代码即可 
4. git new-branch your-branch-name //下载指定分支代码,例如我下载branch-68 就是 git checkout -b branch-68 remote-branch68(远端68具体地址)
5. 接下来就是漫长等待,等待所有的都同步完成即可。

3. 编译和生成指定工程

1. 生成arm64平台ninja工程
    # debug build for 64-bit iOS
    gn gen out/ios_64 --args='target_os="ios" target_cpu="arm64"'

2. 生成模拟器的(可选)
    # debug build for simulator
    gn gen out/ios_sim --args='target_os="ios" target_cpu="x64"'

3. 编译app
    ninja -C out/ios_64 AppRTCMobile

4. 同样可以生成xcode工程用xcode编译
    gn gen out/ios --args='target_os="ios" target_cpu="arm64"' --ide=xcode
    open -a Xcode.app out/ios/all.xcworkspace

5. 编译出wenbrtc库文件
    ninja -C out/ios framework_objc
    也可以调用脚本编译
    python build_ios_libs.py --bitcode 生成库文件在out_ios_lib下面

4. 结束

到这里基本上库和app都已经编译出来了。有问题可以在下面留言!

猜你喜欢

转载自blog.csdn.net/tanningzhong/article/details/81383384