【WebRTC】在IOS下编译WebRTC

项目上需要对webRTC进行一些research,就在网上下载了源码,并在IOS平台对其进行了编译。大致过程,以及期间碰到的问题如下:

【官网】

http://www.webrtc.org/reference/getting-started

【步骤】

参照官网的步骤,要下载和编译源码,需要安装两个工具 depot_tools 和 git

1. 安装git

http://www.cnblogs.com/ccdev/archive/2012/09/12/2682098.html


2.安装depot_tools

a 启动终端,当前路径为:/Users/xxx :

b git 命令获取depot_tools:git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

c 把depot_tools 设置到PATH中

   vi ~/.bash_profile

   export PATH="$PATH":`pwd`/depot_tools

 按“ESC”,输入 ":wq!" 保存退出;

  source ~/.bash_profile   使PATH设置生效

  echo $PATH 查看设置是否生效。


3. 获取WebRTC 源码。

a 新建WebRTC文件夹,并在终端进入该文件夹

b 执行命令 :

  gclient config http://webrtc.googlecode.com/svn/trunk

  gclient sync --force

     gclient runhooks --force


4  编译源码

根据 trunk/talk/app/webrtc/objc/readme 说明,编译源码。

a 检查WebRTC目录下.gclient 文件的内容,是否包含 target_os = ['ios', 'mac']  如果没有,则添加,并保存。

【注】如果没有这一步,在步骤C会失败,出现error。

b 在.gclient下添加后,在终端WebRTC路径下,重新执行: gclient sync

C 根据readme,进入trunk路径,执行如下命令

  export GYP_DEFINES="build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1"
  export GYP_GENERATORS="ninja"  

【注】如果这里改成"xcode",则会产生相应的xcode工程文件。

https://groups.google.com/forum/#!topic/discuss-webrtc/VJg-fk2-i_0[1-25-false]

  export GYP_DEFINES="$GYP_DEFINES OS=ios target_arch=ia32"

  export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_sim"
  export GYP_CROSSCOMPILE=1

  gclient runhooks

  ninja -C out_sim/Debug iossim AppRTCDemo 

d 在trunk/out_sim/Debug 路径下会产生一个文件 AppRTCDemo.app


Q: 怎么把这个app装到模拟器上??

执行命令即可启动demo

./out_sim/Debug/iossim out_sim/Debug/AppRTCDemo.app


********************编译产生.xcodeproj工程文件************************************

https://github.com/lukeweber/webrtc-jingle-client/blob/master    webrtc-jingle-client

# mkdir webrtcjingleproject
# cd webrtcjingleproject
# gclient config https://github.com/lukeweber/webrtc-jingle-client.git --name trunk
# gclient sync
# Change your .gclient file in trunk/../.gclient
# 添加 target_os = ['ios']
# 运行 gclient sync again
# 
./build/gyp_chromium --depth=.  -DOS=ios -Dinclude_tests=0 -Denable_protobuf=0 -Denable_video=0 webrtcjingle.gyp

则会在trunk下创建webrtcjingle.xcodeproj 打开即可。


 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 13
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值