-
Notifications
You must be signed in to change notification settings - Fork 30
Building the WebRTC lib for Windows
Tested on Windows 10 64bit
These instructions are derived from following links:
- https://webrtc.org/native-code/development/
- https://webrtc.org/native-code/development/prerequisite-sw/
- http://dev.chromium.org/developers/how-tos/install-depot-tools
- https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md
- Install dependencies
Install Visual Studio 2015 Update 2 or later - Community Edition should work if its license is appropriate for you. Use the Custom Install option and select:
* Visual C++, which will select three sub-categories including MFC
* Universal Windows Apps Development Tools > Tools
* Universal Windows Apps Development Tools > Windows 10 SDK (10.0.10586)
-
Install the Chromium depot tolls
-
Download depot_tools.zip and decompress it.
-
Add depot_tools to the end of your PATH: * With Administrator access:
-
Control Panel > System and Security > System > Advanced system settings
-
Modify the PATH system variable to include depot_tools
-
* Without Administrator access:
* `Control Panel > User Accounts > User Accounts > Change my environment variables`
* Add a PATH user variable: `%PATH%;C:\path\to\depot_tools`
-
Run
gclient
from the cmd shell (Run as Administrator). The first time it is run, it will install its own copy of svn and other tools. -
Run following commands to set necessary environment variables:
```bash
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_MSVS_VERSION=2015
set GYP_DEFINES=component=shared_library
```
- Create a working directory, enter it, and run fetch webrtc:
mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks webrtc
- Optionally you can choose the stable release rather than the most recent release by enter:
cd src
git branch -r
git checkout <branch_name>
Example: git checkout branch-heads/56
3. Download the code
gclient sync
Note: The dowload will take a long time because it downloads the whole Chromium repository and dependencies, which are several gigabytes. Do not interrupt this step or you may need to start all over agan (a new gclient sync may be enough, but you might also need to start over cleanly).
To update an existing checkout, you can run
git rebase-update
gclient sync
The first command updates the primary Chromium source repository and rebases any of your local branches on top of tip-of-tree (aka the Git branch origin/master). If you don't want to use this script, you can also just use git pull or other common Git commands to update the repo.
The second command syncs the subrepositories to the appropriate versions and re-runs the hooks as needed.
- After downloading the code, you can start building the WebRTC library(standing in
src/
).
To build 64-bit libs, you need to run the following command first:
python webrtc/build/gyp_webrtc.py -Dtarget_arch=x64
gn gen out/Deug_x64
Note: Please run this command with Python2.x, Python3 is currently not supported.
Then compile with:
Debug:
ninja -C out/Debug_x64
Release:
ninja -C out/Release_x64
If you meet errors like this:
warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
You need to add modify tag 'OS=="win" and MSVS_VERSION == "2015"'
in file /src/build/common.gypi
by adding following lines:
'msvs_disabled_warnings': [
4334, # result of 32-bit shift implicitly converted to 64 bits
],
So this warning will be ignored during building.
- Extract the static library from out/Debug_x64 and out/Release_x64. Currently the library we need are:
boringssl.dll.lib boringssl_asm.lib field_trial_default.lib jsoncpp.lib
rtc_base.lib rtc_base_approved.lib rtc_p2p.lib rtc_xmllite.lib
rtc_xmpp.lib