webrtc windows編譯+vs2017


1、 下載depot-tools

下載depot-tools之后解壓,把解壓目錄設置到環境變量里面 (PATH)

2、 安裝vs2017

至少需要包含以下模塊:

安裝完VS2017后,必須安裝SDK調試工具。打開控制面板->程序與功能,找到剛才安裝的Windows Software Development Kit,鼠標右鍵->change。

image-20191211110241971

3、源碼編譯

打開cmd設置臨時環境變量:

set GYP_MSVS_VERSION=2017
set GYP_MSVS_OVERRIDE_PATH=D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional 
set GYP_GENERATORS=msvs-ninja,ninja
set WINDOWSSDKDIR=D:\Windows Kits\10 #vs不在C盤
set DEPOT_TOOLS_WIN_TOOLCHAIN=0  也可以直接設置環境變量,告訴depot_tools使用我們本機的VS進行編譯。

然后執行:

mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks webrtc #獲取代碼,需要VPN
gclient sync

當代碼獲取完成后,cd到源碼目錄,繼續輸入指令來生成解決方案 (default)

cd src
gn gen out/Default --ide=vs2017
ninja -C out/Default

編譯支持h264:

gn gen  out/Debug_h264_ffmpeg --args="is_component_build=false rtc_use_h264=true proprietary_codecs=true is_component_ffmpeg=true ffmpeg_branding=\"Chrome\"" --ide=vs2017
ninja -C out/Debug_h264_ffmpeg
gn gen  out/Debug_h264 --args="is_component_build=false rtc_use_h264=true proprietary_codecs=true ffmpeg_branding=\"Chrome\"" --ide=vs2017
ninja -C out/Debug_h264
is_debug 是否是Debug版,默認true,false:表示編譯Release版。
target_os 平台類型,可以取值win、android、ios、linux等,這里取win,表示Windows平台。
target_cpu cpu類型,Windows下可以取x86、x64
is_component_build 是否使用動態運行期庫,這里取false,使用靜態運行期庫,Release版本將對應MT,Debug版將對應MTd。
proprietary_codecs 是否使用版權編碼,也就是H264,這里取true。
rtc_use_h264 是否使用H264,這里取true,注意Windows平台編碼使用OpenH264,解碼使用ffmpeg。
ffmpeg_branding ffmpeg的分支名,這里采用Chrome的分支。
rtc_build_ssl 是否編譯BoringSSL,這里取false,因為后面我們要替換成OpenSSL。
rtc_ssl_root OpenSSL的頭文件路徑,會被寫到生成的ninja文件中。

gn help args可以查看args的幫助文件

gn args out/Debug_h264可以得到指定編譯輸出目錄下的args配置文件


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM