CMake script for retrieving, building and linking Google's WebRTC into a single static library.
Find a file
2017-02-05 06:20:50 -08:00
CMakeModules Enhance FindDepotTools.cmake, include it before looking for Python 2017-02-05 06:14:42 -08:00
depot_tools@33e88a4e19 Git: Move depot_tools to the root path 2017-01-28 16:34:55 +01:00
jakelib Win32: Now working under Jake 2016-10-13 20:12:08 +02:00
Targets Lower required CMake version for libwebrtc 2017-02-05 06:04:25 -08:00
.gitignore Ignore cmake-build-debug caused by CLion 2017-02-05 05:57:28 -08:00
.gitmodules Git: Move Dependencies/depot_tools depot_tools 2017-01-28 14:18:33 +01:00
.travis.yml CMake: Add the NINJA_ARGS config variable, set -j 4 in Travis, 2 in AppVeyor 2016-11-28 18:47:27 +01:00
appveyor.yml CMake: Add the NINJA_ARGS config variable, set -j 4 in Travis, 2 in AppVeyor 2016-11-28 18:47:27 +01:00
AUTHORS Add AUTHORS file 2017-01-28 16:41:14 +01:00
CMakeLists.txt Do not build the samples since they are not included anymore 2017-02-05 06:20:50 -08:00
index.js Output the relative directory for include and lib 2016-10-08 12:57:36 +02:00
Jakefile Jake: Add jake files and package.json 2016-10-08 12:18:37 +02:00
LICENSE Add Apache 2.0 License 2017-01-29 15:30:53 +01:00
package.json Update package.json, remove useless parameters 2017-02-05 06:02:56 -08:00
README.md README: Add instructions for using the FindLibWebRTC.cmake module 2017-01-29 18:26:04 +01:00

libwebrtc License Build Status Build Status

CMake script for retrieving, building and linking Google's WebRTC into a single static library.

Status

The following table displays the current state of this project, including supported platforms and architectures.

Linux macOS Windows iOS Android
x86 x64 arm x86 x64 x86 x64 arm arm arm64 x86 x64

Prerequisites

  • CMake 3.5 or later,
  • Python 2.7 (optional for Windows)

Debian & Ubuntu

Install the required development packages

# apt-get install build-essential libglib2.0-dev libgtk2.0-dev libxtst-dev \
                  libxss-dev libpci-dev libdbus-1-dev libgconf2-dev \
                  libgnome-keyring-dev libnss3-dev libasound2-dev libpulse-dev \
                  libudev-dev

macOS

  • OS X 10.11 or later,
  • Xcode 7.3.1 or later

Windows

  • Windows 7 x64 or later, x86 operating systems are unsupported.

  • Visual Studio 2015 with updates - Download the Installer

    Make sure that you install the following components:

    • 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)

Getting Started

Clone the repository, initialize the submodules if depot_tools is not installed on your system or not defined inside your PATH environment variable. Create an output directory and browse inside it.

$ git clone https://github.com/aisouard/libwebrtc.git
$ cd libwebrtc
$ git submodule init
$ git submodule update
$ mkdir out
$ cd out

Windows users must append Win64 if they are using a Visual Studio generator. The libwebrtc.sln project solution will be located inside the current directory output directory.

> cmake -G "Visual Studio 14 2015 Win64" ..

Unix users will just have to run $ cmake .. to generate the Makefiles, then run the following commands.

$ make
$ make package
# make install

The library will be located inside the lib folder of the current output directory. The include folder will contain the header files.

Using WebRTC in your project

Copy the CMakeModules/FindLibWebRTC.cmake file inside your CMake modules directory. Let CMake find your libwebrtc headers and libraries with the find_package(LibWebRTC) the following CMake variables will be created:

  • LIBWEBRTC_DEFINITIONS - Preprocessor definitions, such as enabling C++11 features, to be used with add_definitions
  • LIBWEBRTC_INCLUDE_DIRS - Include directories, use it with include_directories
  • LIBWEBRTC_LIBRARIES - List of required libraries to link your software, use it with target_link_libraries

Here is what a CMakeLists.txt file should look like:

project(sample)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeModules)

find_package(LibWebRTC REQUIRED)

set(SOURCE_FILES main.cpp)

include_directories(${LIBWEBRTC_INCLUDE_DIRS})
add_definitions(${LIBWEBRTC_DEFINITIONS})
add_executable(sample ${SOURCE_FILES})
target_link_libraries(sample ${LIBWEBRTC_LIBRARIES})

Advanced Usage

The library will be compiled and usable on the same host's platform and architecture. Here are some CMake flags which could be useful if you need to perform cross-compiling.

  • BUILD_SAMPLES

    Build PeerConnection sample, source code located inside the Samples/PeerConnection directory.

  • BUILD_TESTS

    Build WebRTC tests. (not supported yet)

  • NINJA_ARGS

    Arguments to pass while executing the ninja command. For instance, you can define the number of cores you would like to use, in order to speed-up the build process:

    cmake -DNINJA_ARGS="-j 4" ..

  • TARGET_OS

    Target operating system, the value will be used inside the --target_os argument of the gn gen command. The value must be one of the following:

    • android
    • chromeos
    • ios
    • linux
    • mac
    • nacl
    • win
  • TARGET_CPU

    Target architecture, the value will be used inside the --target_cpu argument of the gn gen command. The value must be one of the following:

    • x86
    • x64
    • arm
    • arm64
    • mipsel

Contributing

Feel free to open an issue if you wish a bug to be fixed, to discuss a new feature or to ask a question. I'm open to pull requests, as long as your modifications are working on the three major OS (Windows, macOS and Linux).

Don't forget to put your name and e-mail address inside the AUTHORS file! You can also reach me on Twitter for further discussion.

License

Apache License 2.0 © Axel Isouard