当前位置:   article > 正文

Webrtc+Windows10+VS2017 编译_webrtc vs编译

webrtc vs编译

一、环境及代码获取

1、本机系统环境

系统:Windows Server 2016,Windows10(代码及编译消耗巨大,采用云端服务器编译)
VS版本:VS2017 15.9.38(建议保持这个版本及以上版本)
代码版本: 分支4103 commit 3ed9687558f4fd0271adf5836d4a029df858dc43 6/28/2020
PYTHON: 2.7.17
语言区域:美国英语(系统及IDE都设为英文)

2、代码获取

(1)安装depot_tools工具包

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

(2)设置一下环境变量
DEPOT_TOOLS_WIN_TOOLCHAIN=0
GYP_GENERATORS=msvs-ninja,ninja
GYP_MSVS_VERSION=2017
PATH添加G:\depot_tools在最前面

(3)获取代码

fetch --nohooks webrtc
  • 1

如果中途断网:

gclient sync
  • 1

(4)切换分支

git checkout -b (随便命名) refs/remotes/branch-heads/(指定版本号)
  • 1
gclient sync -D
  • 1

二、编译

1、将运行时库由MT改为MD(可选,编SDK建议做这一步)

Windows默认不支持is_component_build设置

手动将src/build/config/win/build.gn改为以下内容

config("default_crt") {
  if (is_component_build) {
    # Component mode: dynamic CRT. Since the library is shared, it requires
    # exceptions or will give errors about things not matching, so keep
    # exceptions on.
    configs = [ ":dynamic_crt" ]
  } else {
    if (current_os == "winuwp") {
      # https://blogs.msdn.microsoft.com/vcblog/2014/06/10/the-great-c-runtime-crt-refactoring/
      # contains a details explanation of what is happening with the Windows
      # CRT in Visual Studio releases related to Windows store applications.
      configs = [ ":dynamic_crt" ]
    } else {
      # Desktop Windows: static CRT.
      configs = [ ":`dynamic_crt`" ]
    }
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

或者

config("static_crt") {
 if (is_debug) {
   # This pulls in the static debug CRT and defines _DEBUG
   cflags = [ `"/MDd" `]
 } else {
   cflags = [ `"/MD"` ]
 }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

参考https://blog.csdn.net/haowei0926/article/details/78530560

2、在构建目录out\debug 新建args.gn,填入以下内容

is_debug = true // release is_debug=false
rtc_enable_protobuf = false
target_cpu = “x86” // 64bit target_cpu = “x64”
target_os = “win”
is_clang = false
libyuv_include_tests = false
rtc_include_tests = false
rtc_use_h264 = true
is_component_ffmpeg=true
enable_iterator_debugging=true

3、生成工程
32bit
gn args out1/Debug --ide=vs2017 --winsdk=10.0.19041.0
gn args out1/Release --ide=vs2017 --winsdk=10.0.19041.0

64bit
gn arg
  • 1
  • 2
  • 3
  • 4
  • 5
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/901729
推荐阅读
  

闽ICP备14008679号