Compare commits

...

125 commits

Author SHA1 Message Date
c4917e8f86 sync.sh and sync.bat replaced with sync.py.
Update README.md.
2024-09-23 19:29:58 +03:00
4475233318 Fix synchronization for old versions of WebRTC. 2024-08-19 22:35:00 +03:00
92fb3fdc01 Disable use of sysroot to avoid conflicts on non-Debian based systems. 2024-08-19 22:30:50 +03:00
915e13f4ce Make installation directory be relocatable (replace hard-coded paths in CMake configs with dynamic ones). 2024-08-19 22:30:50 +03:00
c3a581c11c Enable RTTI. 2023-08-05 13:45:08 +03:00
cf009964cf Discard local changes and untracked files on sync. 2023-08-23 20:46:44 +03:00
9d7075b4f0 Debian package splits into common, debug and release. 2023-08-23 20:46:25 +03:00
292a9b8751 Disable building of tests, examples and tools. 2022-10-03 19:20:27 +03:00
0e08c8388a Add an ability to replace some source files before building. 2022-10-03 15:43:17 +03:00
d667dab439 Change configurations case. 2022-09-27 23:15:08 +03:00
1e24732035 Add an option to disable the use of internal Clang compiler 2022-09-14 20:58:03 +03:00
ab22b5519e Sync branch-heads. 2021-07-21 00:51:37 +03:00
2db22c8048 Passthrough GN_EXTRA_ARGS and NINJA_ARGS.
Fix GEN_ARGS_DEBUG for MSVC.
2021-07-21 00:31:50 +03:00
477b5b2220 Add 'use_lld=false' on Windows 2021-05-26 17:38:13 +03:00
c8cdba02bc Fix PATH
Add single-configuration generators support on Windows
2021-05-21 22:30:50 +03:00
5a40775960 Add libyuv and jsoncpp include directories to INTERFACE_INCLUDE_DIRECTORIES. 2021-05-11 17:07:22 +03:00
d5583c9a6c Add option to build DEB package. 2021-04-07 22:28:41 +03:00
f158466213 Separated sources fetching and building. 2021-04-07 21:37:04 +03:00
8185da4a10
Install common_audio directory. 2021-03-05 00:54:34 +03:00
bb6c49081b Update README 2021-02-11 23:07:34 +03:00
700e94ff03 Fix prefix in CMakeTargets.cmake 2021-02-11 23:05:34 +03:00
40db8152b4 Fix: set is_clang and enable_iterator_debugging only on MSVC 2020-11-27 18:49:02 +03:00
7fefa7dc53 Enable iterator debugging in Windows debug configuration
Disable Clang completely on Windows
2020-11-26 17:49:12 +03:00
3315befa38 Update depot-tools after cloning 2020-11-25 19:04:32 +03:00
dccaa6f5f4 Do not use libc++
Use C++11 ABI on Linux
2020-11-18 19:53:15 +03:00
5ac8845681 Build with dynamic runtime on desktop Windows
Add suffix to debug library name
2020-11-11 18:06:46 +03:00
Michael Kris
b248e1cd73 gn now comes with depot tools no need to download separately 2020-10-28 13:59:51 -07:00
ssskip
336476a1f8 xcode 11.5 2020-06-14 22:50:20 +08:00
ssskip
38d6a4e9ea m83 2020-06-14 22:48:34 +08:00
Mike Lester
2ac0e402e1 Copy absl include directory directly into webrtc/ (instead of third_party/) 2020-04-08 15:55:05 +10:00
Mike Lester
05445b2fd5
Update README.md 2020-04-08 14:50:38 +10:00
Mike Lester
46f502d2d1 Copy abseil headers 2020-04-08 11:03:30 +10:00
Mike Lester
d44f0e4c3a CMake config file now points to the correct root include directory 2020-04-08 10:34:04 +10:00
湖北捷智云技术有限公司
a24a5e5947 Update WebRTC version to m72. 2019-02-19 01:31:53 +08:00
Martin Müllenhaupt
6fa64674be update to webrtc 68 2018-08-25 10:40:14 +02:00
Martin Müllenhaupt
09a07366da circleci 2018-06-11 21:26:32 +02:00
Martin Müllenhaupt
4ee758711c select package headers 2018-06-09 00:14:18 +02:00
Martin Müllenhaupt
b9480efda7 fix header paths 2018-06-06 09:55:40 +02:00
Martin Müllenhaupt
9db425ba54 install pdb files 2018-05-30 12:38:47 +02:00
Martin Müllenhaupt
475d263a51 try to fix header installation 2018-05-30 12:28:28 +02:00
Martin Müllenhaupt
2e92e72f0a remove BUILD_TESTS option 2018-05-30 11:33:02 +02:00
Martin Müllenhaupt
a627d1bc9a update appveyor to msvc 2017 2018-05-30 11:06:47 +02:00
Martin Müllenhaupt
66fa38e90d fix quote typo 2018-05-30 10:33:22 +02:00
Martin Müllenhaupt
9664e669e6 build less targets required for the ice-adapter 2018-05-30 10:29:31 +02:00
Martin Müllenhaupt
60407d29cd enable debug build and update to version 66 2018-05-30 10:29:10 +02:00
Martin Müllenhaupt
0569dc61df update to webrtc 63 2017-12-17 14:04:48 +01:00
Martin Müllenhaupt
37eeec231e build release 62 2017-11-15 20:14:41 +01:00
Martin Müllenhaupt
d2d4b017f8 try circleci build 2017-10-09 10:43:29 +02:00
Martin Müllenhaupt
ffd60ae7d8 build jsoncpp 2017-10-05 19:14:18 +02:00
Martin Müllenhaupt
787fe28f96 fix gclient command to download test assets 2017-07-19 09:38:50 +02:00
Martin Müllenhaupt
a477b6a2a8 make appveyor build webrtc 60 2017-07-18 20:13:01 +02:00
Martin Müllenhaupt
1d52ac650f turn off the sample for now 2017-07-14 11:19:02 +02:00
Martin Müllenhaupt
d26a48fc0d disable x64 and debug builds for now 2017-07-14 11:19:02 +02:00
Martin Müllenhaupt
3d42742689 remove audio_coding/test/utility.cc object files to fix multiple definition linking error of webrtc::CircularBuffer 2017-07-14 11:19:02 +02:00
Martin Müllenhaupt
a925a1bad2 appveyor: build tests 2017-07-14 11:19:02 +02:00
Martin Mllenhaupt
107f4dccb3 rename library to libwebrtc on Windows to match node-webrtc 2017-07-14 11:19:02 +02:00
Axel Isouard
be407aced0
(#30): Add release 58 support 2017-04-16 11:25:36 +02:00
Axel Isouard
f7e01514ed
(#5): Set the right arch inside install-sysroot.py argument 2017-04-02 18:01:17 +02:00
Axel Isouard
b3651f0e14
(#5): Set the arch inside Package.cmake and install-sysroot.py argument 2017-04-02 17:45:41 +02:00
Axel Isouard
8d571cb492
(#10): State BUILD_TESTS variable inside the README and CHANGELOG 2017-03-30 19:44:36 +02:00
Axel Isouard
f496ce1a29 (#10): Add webrtc_tests target to ninja build command 2017-03-30 11:28:08 +02:00
Axel Isouard
9b5dadf807
Fix Travis deploy script, prefix the file with ls 2017-03-27 22:59:03 +02:00
Axel Isouard
5cfd7585f8
Write CHANGELOG.md, release 1.0 2017-03-27 21:06:31 +02:00
Axel Isouard
d2de52cdce
Enhance the deployment process through CIs 2017-03-27 20:01:31 +02:00
Axel Isouard
1bed0a6818
Build version from current tag 2017-03-27 19:59:16 +02:00
Axel Isouard
5cda935434
Write windows-related build instructions, stuff about debug mode 2017-03-27 17:59:04 +02:00
Axel Isouard
9f324642f5 (#23): Add sample target, build it and run it 2017-03-27 13:28:37 +02:00
Axel Isouard
941688e7fc Build webrtc, system_wrappers_default and libjingle_peerconnection 2017-03-27 13:27:46 +02:00
Axel Isouard
eec2846651 Install CMake target files, from libwebrtc target this time 2017-03-27 13:27:14 +02:00
Axel Isouard
7cd0a79bd2 Include protobuf_full objects instead of protobuf_lite's 2017-03-27 13:26:36 +02:00
Axel Isouard
1dbc538b4b Link with crypt32 and iphlpapi 2017-03-27 13:25:37 +02:00
Axel Isouard
ee7fb4f42d Link with rt and pthread library 2017-03-27 13:25:23 +02:00
Axel Isouard
ad6d1a565a (#39): Force is_component_build=false argument 2017-03-27 13:24:49 +02:00
Axel Isouard
2969a0f603 Remove CMAKE_THREAD_LIBS_INIT definition inside Install.cmake 2017-03-27 13:23:57 +02:00
Axel Isouard
67ac79ff0f Use the CMAKE_FILES_DIRECTORY CMake variable 2017-03-27 13:23:02 +02:00
Axel Isouard
bc9c05404f Define WEBRTC_MAC under macOS, set correct pthread and debugging flags 2017-03-27 13:22:39 +02:00
Axel Isouard
b35dc15d8d Travis: Remove x86 build for now, use g++ 4.8 2017-03-27 13:21:59 +02:00
Axel Isouard
55f1e9d761 Use the same CMAKE_BUILD_TYPE for the libwebrtc target 2017-03-27 13:21:06 +02:00
Axel Isouard
7acf691f2b State GCC / G++ 4.8 inside the README 2017-03-27 13:19:53 +02:00
Axel Isouard
ab1cf49414
(#40): Do not put CMake target files inside the package 2017-03-25 14:35:08 +01:00
Axel Isouard
7ef534cd55
(#40): Do not run generator variables during package 2017-03-25 12:23:02 +01:00
Axel Isouard
77208bccbd
(#40): Remove mac x86 build, set appveyor matrix the right way 2017-03-25 12:00:49 +01:00
Axel Isouard
9ee8a5aec6
(#40): Fix Debug build, add debug configuration in Travis and Appveyor 2017-03-25 11:18:37 +01:00
Axel Isouard
53a331a356
(#38): Do not fetch gn and clang-format at the same time 2017-03-25 09:36:44 +01:00
Axel Isouard
7047a4dfef
Add LIBWEBRTC_WEBRTC_BRANCH_HEAD inside CMake Config file, fix WEBRTC_REVISION 2017-03-21 19:16:20 +01:00
Axel Isouard
522e16128a
Enforce static linking, closes #37 2017-03-21 18:55:56 +01:00
Axel Isouard
cb13886cbe README: Remove BUILD_TESTS since they are not supported yet (#37) 2017-03-21 09:38:25 +01:00
Axel Isouard
5ae2a5de6b README: Remove BUILD_SHARED_LIB flag (#37) 2017-03-21 09:32:58 +01:00
Axel Isouard
6aab703673 Merge branch refactor-depot-tools 2017-03-19 22:58:59 -07:00
Axel Isouard
5744e63abe
Rename artifact for Appveyor 2017-03-19 20:22:30 +01:00
Axel Isouard
58f2d70a74
No longer need for clang_use_chrome_plugins=false, disable tests on appveyor 2017-03-19 20:06:21 +01:00
Axel Isouard
418e54b401
Execute checkout commands inside the main CMake file 2017-03-19 19:52:34 +01:00
Axel Isouard
c21220c58c
Replace all execute_process calls with libwebrtc_execute 2017-03-19 18:56:08 +01:00
Axel Isouard
64690d1a30
Define WEBRTC_BRANCH_HEAD and WEBRTC_REVISION when required 2017-03-19 18:55:36 +01:00
Axel Isouard
16578cdd5c
Use the right variable for the lib output directory 2017-03-19 18:36:21 +01:00
Axel Isouard
7311f13bfa
Use the correct variable for the stamp file 2017-03-19 18:36:21 +01:00
Axel Isouard
7950fa7e8a Fix the environment variables forever, add .bat suffix for win32 2017-03-19 09:17:53 -07:00
Axel Isouard
c8a3e8eb8a
Remove prefix files, use cmake -E env 2017-03-19 14:14:55 +01:00
Axel Isouard
5d3887b918 No prefix file for gn command anymore, set the right directory for IDE config 2017-03-19 04:30:25 -07:00
Axel Isouard
ea5d4643aa
Gn.cmake: Set is_debug depending on the IDE 2017-03-19 11:56:21 +01:00
Axel Isouard
daf8535a2d
Set the target dependencies in a list 2017-03-19 10:30:50 +01:00
Axel Isouard
c10f3458f0
Enable parallel build for CI, remove -j 4 flag everywhere, fixes #34 2017-03-19 10:25:22 +01:00
Axel Isouard
8970f2368b
README: Add more instructions for specific commits and depot_tools management 2017-03-19 10:23:09 +01:00
Axel Isouard
17ef828ce2
Use libwebrtc_command instead of execute_process 2017-03-19 10:20:45 +01:00
Axel Isouard
bbdd74ce9a
Add libwebrtc_execute function, use it in DepotTools.cmake 2017-03-19 10:17:26 +01:00
Axel Isouard
b294fac627
Remove unused PREFIX_NEWLINE variable 2017-03-19 08:29:30 +01:00
Axel Isouard
b59291f093
Manage depot_tools, replace modules, remove Targets folder, fixes #33 2017-03-18 16:13:36 +01:00
Axel Isouard
5a602922c0
Remove include guards 2017-03-18 16:00:31 +01:00
Axel Isouard
e3a4e5d64e
README: Add CMake syntax highlighting 2017-03-18 12:48:30 +01:00
Axel Isouard
93438caf76
README: Add Acknowledgements 2017-03-18 12:48:03 +01:00
Axel Isouard
e60dbd57f6
Find all libraries first, set HAS_OWN_DEPOT_TOOLS variable 2017-03-17 23:26:47 +01:00
Axel Isouard
7ad84637f4
Add include guards 2017-03-17 18:52:54 +01:00
Axel Isouard
a750ea484d
Add DEPOT_TOOLS_PATH variable 2017-03-17 18:40:07 +01:00
Axel Isouard
b565920acb
Do not manage depot_tools as a submodule anymore 2017-03-12 12:38:19 +01:00
Axel Isouard
638022675f
Look for depot_tools only when DEPOT_TOOLS_PATH is set 2017-03-12 12:29:01 +01:00
Axel Isouard
470e444791
Find git and depot_tools in the main file 2017-03-12 12:16:19 +01:00
Axel Isouard
987a23fcef
README: Select the right version of Windows 10 SDK 2017-03-12 08:56:32 +01:00
Axel Isouard
80281d8afa
README.md: Add Windows 10 SDK / Windows Driver Kit 10 installation instructions 2017-03-11 14:19:08 +01:00
Axel Isouard
9eafe12813
#31: Set clang_use_chrome_plugins to false on Travis 2017-03-09 20:42:13 +01:00
Axel Isouard
058d9e0da3
Add GN_EXTRA_ARGS config variable 2017-03-09 20:40:23 +01:00
Axel Isouard
287d483478
Add WEBRTC_BRANCH_HEAD config variable 2017-03-09 20:39:38 +01:00
Axel Isouard
bc67c8f626
#29: Set _NEXT_DEPENDS and _DOWNLOAD_COMMAND according to WEBRTC_REVISION 2017-03-08 07:16:23 +01:00
Axel Isouard
b668195218
Add WEBRTC_REVISION variable, fetch the release branch head by default 2017-02-21 19:51:58 +01:00
Axel Isouard
83814ef6f3
Rename DEPOTTOOLS_GCLIENT_EXECUTABLE to GCLIENT_EXECUTABLE 2017-02-21 19:51:58 +01:00
Axel Isouard
f25382438d
Remove a Windows definition set inside Unix target 2017-02-21 19:51:58 +01:00
37 changed files with 782 additions and 1003 deletions

10
.gitignore vendored
View file

@ -1,6 +1,4 @@
.DS_Store
/out/
/.idea/
*.gclient
*.gclient_entries
/cmake-build-debug/
.idea
cmake-build-*
webrtc
depot_tools

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "depot_tools"]
path = depot_tools
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git

View file

@ -1,60 +0,0 @@
matrix:
include:
- os: linux
sudo: required
- os: osx
osx_image: xcode7.3
language: cpp
addons:
apt:
packages:
- 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
before_install:
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz"
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
else
if ! brew ls --version cmake &>/dev/null; then brew update && brew install cmake; fi
fi
- cd ${TRAVIS_BUILD_DIR}
- cmake --version
install:
- git submodule init
- git submodule update
- mkdir out
- cd out
- cmake -DNINJA_ARGS="-j 4" ..
script:
- make package
deploy:
provider: releases
api_key:
secure: UazaqOOoifs5xE/xw+tjVnFAkl6MMJeZSW7B0DXX0wnHorKM5K72q9Ms3JYvJIp6DDV3vIeX/Yv/WQCnfRkDDhcbLohGZoOj2X3q53RSfJiOq/iIyPiPTRmkk3jQRBOvXl5zLePNaXU2vBuSgcM8az+wGjxaDLUB+EebSGRHPbXrGSnDDHaNnmb4Zm7SZ2DpL5ubRDlLTHst7Jh7OigrIblYKNCzwEc7UQsFNzLnu7dyZT4hF2Y+2KYl/3vUUkUGxu0AxVG7zilnjJE7O5gX76r+SQXs151uWwZeH41NNPxRSod51LKQS/V/I4afjjTaYC5+9lSUdNkOpEGrxU+61hSJvNGxL6rTqfiBTAOiJdMR3u4OmF+B72O0nUUpsNtlkSPBK9402Z65LH/UI2BIJ/oMfkjNSzTNTHvB+n+18nFryzUmgEJ4CEy7Yx5HGO1vXCP4OsHGAu5YCkDGV2uVttiYHlm2qWgTY59cQt61h1saQWMwj6Uivhz8XrS86K0r/YAS30t+7+/xG6dneXgctM9oYjIbVCFnImsE30FpWlCJvGnJzo37wctbTQscHs5iuqjt1an7AhQgOTMQwmtyyg32D6N9e4n+RJA9pEj3Qtpi51LVD1cdCahbZ1l4bURlNueqfB3d4oZvr9o/QNjm+qH/FRUWjAmWtbBr16ZXfiA=
file: libwebrtc-$TRAVIS_TAG-linux-x64.tar.gz
skip_cleanup: true
overwrite: true
on:
tags: true
repo: aisouard/libwebrtc

53
CHANGELOG.md Normal file
View file

@ -0,0 +1,53 @@
# Changelog
## Version 1.1
*TBD*
[View Issues][v1.1-issues]
**Features:**
- Added `BUILD_TESTS` CMake configuration variable
## Version 1.0
*March 27, 2017*
[View Issues][v1.0-issues]
**Features:**
- Using CMake version 3.3
- Installs LibWebRTC as a CMake package
- Support for `gn`-based releases
- Synchronize depot_tools with WebRTC's commit date
- `TARGET_OS` and `TARGET_CPU` CMake config variables
- `WEBRTC_REVISION` and `WEBRTC_BRANCH_HEAD` CMake config variables
- x86 support under Windows
- Better host OS and CPU architecture detection
- pkg-config file generation
- Deprecated shared library support
- Debug mode support
- .zip package for Windows, .tar.gz for Unix
- Basic .deb and .rpm package generation
**Fixes:**
- Removed package.json and Jake support, focusing on CMake only
- Refactored source code, removed Targets folder
- Run commands with `cmake -E env`, no more Prefix File Trick
- No more `merge_libs.py` call, use CMake to create the library
- Removed the peer connection sample, wrote a little executable for tests
- Removed FindLibWebRTC.cmake, defined CMake package files
- Removed depot_tools git submodule
- Retrieve the Linux sysroot before calling the generator
- Removed support for releases older than January 1st, 2017 for now
- Removed libwebrtc-chromium-deps repository
- Wrote libwebrtc_execute macro
- Created uninstall target
- Removed BUILD_TESTS flag for now
- Fixed static linking
[v1.1-issues]:https://github.com/aisouard/libwebrtc/milestone/1
[v1.0-issues]:https://github.com/aisouard/libwebrtc/milestone/1

View file

@ -1,17 +1,46 @@
cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING INTERNAL FORCE)
project(libwebrtc)
#
set(USE_CLANG ON CACHE BOOL "Build using internal Clang compiler (set to OFF to build using system GCC/MSVC)")
set(GN_EXTRA_ARGS "" CACHE STRING "Extra 'gn gen' arguments to pass when configuring WebRTC")
set(NINJA_ARGS "" CACHE STRING "Ninja arguments to pass when compiling WebRTC")
option(BUILD_DEB_PACKAGE "Build .deb package" OFF)
# Allow the use of IN_LIST operand
cmake_policy(SET CMP0057 NEW)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/CMakeModules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(FindLibraries)
include(Version)
include(Options)
include(TargetOsAndCpu)
add_subdirectory(Targets)
export(PACKAGE LibWebRTC)
include(Utils)
prependPath("${CMAKE_SOURCE_DIR}/depot_tools")
if (WIN32)
set(ENV{DEPOT_TOOLS_WIN_TOOLCHAIN} 0)
endif()
set(WEBRTC_SOURCE_DIR "${CMAKE_SOURCE_DIR}/webrtc/src")
set(WEBRTC_BUILD_DIR "${CMAKE_BINARY_DIR}/webrtc")
include(Version)
get_webrtc_version_from_git(WEBRTC_VERSION)
message(STATUS "WebRTC version: ${WEBRTC_VERSION}")
if (MSVC)
# Always build with dynamic runtime on MSVC
patch_file(${WEBRTC_SOURCE_DIR}/build/config/win/BUILD.gn ":static_crt" ":dynamic_crt")
endif ()
# Copy all files from 'patches' directory to 'webrtc/src'
# For example, 'patches/api/foo.h' will be copied to 'webrtc/src/api/foo.h'
include(PatchSources)
patch_sources("${CMAKE_CURRENT_SOURCE_DIR}/patches" "${CMAKE_CURRENT_SOURCE_DIR}/webrtc/src")
include(AddWebRTCTarget)
add_webrtc_target(${WEBRTC_SOURCE_DIR} ${WEBRTC_BUILD_DIR})
add_subdirectory(libwebrtc)

View file

@ -1,16 +0,0 @@
find_program(DEPOTTOOLS_GCLIENT_EXECUTABLE
NAMES gclient gclient.bat
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/depot_tools)
find_path(DEPOTTOOLS_PATH
NAMES gclient gclient.py gclient.bat
gn gn.py gn.bat
ninja ninja.exe ninja-linux32 ninja-linux64 ninja-mac
download_from_google_storage download_from_google_storage.bat
download_from_google_storage.py
HINTS ${CMAKE_CURRENT_SOURCE_DIR}/depot_tools)
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(DepotTools
REQUIRED_VARS DEPOTTOOLS_GCLIENT_EXECUTABLE
FAIL_MESSAGE "Could not find the gclient executable.")

View file

@ -1,25 +0,0 @@
#
# Retrieve WebRTC source code
#
file(WRITE ${CMAKE_BINARY_DIR}/.gclient "solutions = [
{
\"url\": \"https://chromium.googlesource.com/external/webrtc.git\",
\"managed\": False,
\"name\": \"src\",
\"deps_file\": \"DEPS\",
\"custom_deps\": {},
},
]
")
if (TARGET_OS STREQUAL "android")
file(APPEND ${CMAKE_BINARY_DIR}/.gclient "target_os = [\"android\", \"unix\"]")
elseif (TARGET_OS STREQUAL "ios")
file(APPEND ${CMAKE_BINARY_DIR}/.gclient "target_os = [\"ios\", \"mac\"]")
elseif (TARGET_OS STREQUAL "linux")
file(APPEND ${CMAKE_BINARY_DIR}/.gclient "target_os = [\"unix\"]")
elseif (TARGET_OS STREQUAL "mac")
file(APPEND ${CMAKE_BINARY_DIR}/.gclient "target_os = [\"mac\"]")
elseif (TARGET_OS STREQUAL "win")
file(APPEND ${CMAKE_BINARY_DIR}/.gclient "target_os = [\"win\"]")
endif (TARGET_OS STREQUAL "android")

View file

@ -1,98 +0,0 @@
#
# Install library
file(GLOB_RECURSE _LIBRARY_FILES
${CMAKE_BINARY_DIR}/lib/*${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_BINARY_DIR}/lib/*${CMAKE_STATIC_LIBRARY_SUFFIX})
install(FILES ${_LIBRARY_FILES}
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT lib)
#
# Install headers
install(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
DESTINATION ${INSTALL_INCLUDE_DIR}
COMPONENT include
FILES_MATCHING PATTERN "*.h")
#
# Install CMake Config file
configure_file(${CMAKE_MODULE_PATH}/Templates/LibWebRTCConfig.cmake.in
${CMAKE_BINARY_DIR}/LibWebRTCConfig.cmake @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/LibWebRTCConfig.cmake
DESTINATION ${INSTALL_CMAKE_DIR}
COMPONENT cmake)
#
# Install CMake ConfigVersion file
configure_file(${CMAKE_MODULE_PATH}/Templates/LibWebRTCConfigVersion.cmake.in
${CMAKE_BINARY_DIR}/LibWebRTCConfigVersion.cmake @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/LibWebRTCConfigVersion.cmake
DESTINATION ${INSTALL_CMAKE_DIR}
COMPONENT cmake)
#
# Install pkg-config file
if (UNIX)
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "\${prefix}")
set(libdir "${INSTALL_LIB_DIR}")
set(includedir "${INSTALL_INCLUDE_DIR}")
set(LIBWEBRTC_PC_LIBS "-L${INSTALL_LIB_DIR}" "-lwebrtc")
foreach(LIB_NAME ${LIBWEBRTC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
if (LIB_NAME MATCHES "[\\/]")
get_filename_component(LIB_DIR "${LIB_NAME}" PATH)
get_filename_component(LIB_NAME "${LIB_NAME}" NAME_WE)
string(REGEX REPLACE "^lib(.*)" "-l\\1" LIB_NAME "${LIB_NAME}")
if (NOT ${LIB_DIR} IN_LIST LIB_DIRS)
list(APPEND LIB_DIRS ${LIB_DIR})
list(APPEND LIBWEBRTC_PC_LIBS_PRIVATE "-L${LIB_DIR}")
endif (NOT ${LIB_DIR} IN_LIST LIB_DIRS)
elseif (NOT LIB_NAME MATCHES "^-l")
set(LIB_NAME "-l${LIB_NAME}")
endif ()
list(APPEND LIBWEBRTC_PC_LIBS_PRIVATE "${LIB_NAME}")
endforeach(LIB_NAME ${LIBWEBRTC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
foreach(DEFINITION ${LIBWEBRTC_DEFINITIONS})
list(APPEND LIBWEBRTC_PC_DEFINITIONS "-D${DEFINITION}")
endforeach(DEFINITION ${LIBWEBRTC_DEFINITIONS})
list(REMOVE_ITEM LIBWEBRTC_PC_LIBS_PRIVATE "-lwebrtc")
string(REPLACE ";" " " LIBWEBRTC_PC_DEFINITIONS "${LIBWEBRTC_PC_DEFINITIONS}")
string(REPLACE ";" " " LIBWEBRTC_PC_LIBS "${LIBWEBRTC_PC_LIBS}")
string(REPLACE ";" " " LIBWEBRTC_PC_LIBS_PRIVATE "${LIBWEBRTC_PC_LIBS_PRIVATE}")
string(REPLACE ";" " " LIBWEBRTC_PC_CXXFLAGS "${LIBWEBRTC_REQUIRED_CXX_FLAGS}")
configure_file(${CMAKE_MODULE_PATH}/Templates/LibWebRTC.pc.in
${CMAKE_BINARY_DIR}/LibWebRTC.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/LibWebRTC.pc
DESTINATION ${INSTALL_PKGCONFIG_DIR}
COMPONENT cmake)
endif (UNIX)
#
# Install CMake Use file
install(FILES ${CMAKE_MODULE_PATH}/Templates/UseLibWebRTC.cmake
DESTINATION ${INSTALL_CMAKE_DIR}
COMPONENT cmake)
#
# Install CMake Targets file
install(DIRECTORY "${CMAKE_BINARY_DIR}/lib/cmake/LibWebRTC/"
DESTINATION ${INSTALL_CMAKE_DIR}
COMPONENT cmake
FILES_MATCHING PATTERN "*.cmake")
#
# Add uninstall target
configure_file(
"${CMAKE_MODULE_PATH}/Templates/Uninstall.cmake.in"
"${CMAKE_BINARY_DIR}/Uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/Uninstall.cmake)

View file

@ -1,23 +0,0 @@
include(CMakeParseArguments)
include(Prefix)
function(libwebrtc_command)
set(ONE_VALUE_ARGS NAME COMMENT DEPENDS WORKING_DIRECTORY)
set(MULTI_VALUE_ARGS COMMAND)
cmake_parse_arguments(COMMAND "" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN} )
set(CMF_DIR ${CMAKE_BINARY_DIR}/CMakeFiles)
set(STAMP_FILE "${CMF_DIR}/${COMMAND_NAME}-complete")
add_custom_command(
OUTPUT ${STAMP_FILE}
COMMENT ${COMMAND_COMMENT}
COMMAND ${PREFIX_EXECUTE} ${COMMAND_COMMAND}
COMMAND ${CMAKE_COMMAND} -E touch ${STAMP_FILE}
WORKING_DIRECTORY ${COMMAND_WORKING_DIRECTORY}
)
add_custom_target(${COMMAND_NAME} ALL DEPENDS ${STAMP_FILE})
add_dependencies(${COMMAND_NAME} ${COMMAND_DEPENDS})
endfunction()

View file

@ -1,35 +0,0 @@
#
# Options, flags
option(BUILD_TESTS "Build test binaries" OFF)
set(NINJA_ARGS "" CACHE STRING "Ninja arguments to pass before compiling WebRTC")
option(BUILD_SHARED_LIB "Build WebRTC as a shared library." OFF)
if(BUILD_SHARED_LIB)
set(LIBRARY_TYPE SHARED)
else()
set(LIBRARY_TYPE STATIC)
endif()
#
# Offer the user the choice of overriding the installation directories
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
set(INSTALL_CMAKE_DIR lib/cmake/LibWebRTC CACHE PATH "Installation directory for CMake files")
if (UNIX)
set(INSTALL_PKGCONFIG_DIR lib/pkgconfig CACHE PATH "Installation directory for pkg-config script")
if (NOT APPLE)
option(BUILD_DEB_PACKAGE "Build Debian .deb package" OFF)
option(BUILD_RPM_PACKAGE "Build Red Hat .rpm package" OFF)
endif (NOT APPLE)
endif (UNIX)
#
# Make relative paths absolute (needed later on)
foreach(p LIB BIN INCLUDE CMAKE)
set(var INSTALL_${p}_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()

View file

@ -1,79 +0,0 @@
#
# Create package
set(CPACK_PACKAGE_FILE_NAME "libwebrtc-${LIBWEBRTC_VERSION}-${TARGET_OS}-${TARGET_CPU}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "WebRTC in a single static library")
set(CPACK_PACKAGE_DESCRIPTION "Google's native WebRTC implementation shipped into a single library")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_NAME "LibWebRTC")
set(CPACK_PACKAGE_VERSION "${LIBWEBRTC_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${LIBWEBRTC_MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${LIBWEBRTC_MINOR_VERSION}")
set(CPACK_PACKAGE_VERSION_PATCH "${LIBWEBRTC_PATCH_VERSION}")
set(CPACK_PACKAGE_VENDOR "Axel Isouard")
set(CPACK_PACKAGE_CONTACT "axel@isouard.fr")
if (WIN32)
set(CPACK_GENERATOR "ZIP")
else (WIN32)
set(CPACK_GENERATOR "TGZ")
endif (WIN32)
if (UNIX AND NOT APPLE)
if (TARGET_CPU STREQUAL "x86")
set(_RPM_ARCH "i686")
set(_DEB_ARCH "i386")
elseif (TARGET_CPU STREQUAL "x64")
set(_RPM_ARCH "x86_64")
set(_DEB_ARCH "amd64")
elseif (TARGET_CPU STREQUAL "arm")
set(_RPM_ARCH "armhf")
set(_DEB_ARCH "armhf")
elseif (TARGET_CPU STREQUAL "arm64")
set(_RPM_ARCH "aarch64")
set(_DEB_ARCH "arm64")
else ()
set(_RPM_ARCH ${CMAKE_SYSTEM_PROCESSOR})
set(_DEB_ARCH ${CMAKE_SYSTEM_PROCESSOR})
endif ()
set(CPACK_PACKAGE_FILE_NAME "libwebrtc-${LIBWEBRTC_VERSION}")
if (CPACK_GENERATOR STREQUAL "RPM")
set(_PACKAGE_ARCH ${_RPM_ARCH})
elseif (CPACK_GENERATOR STREQUAL "DEB")
set(_PACKAGE_ARCH ${_DEB_ARCH})
else ()
set(_PACKAGE_ARCH ${TARGET_CPU})
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${TARGET_OS}")
endif ()
if (BUILD_DEB_PACKAGE)
set(CPACK_DEB_COMPONENT_INSTALL FALSE)
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://axel.isouard.fr/libwebrtc")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
endif (BUILD_DEB_PACKAGE)
if (BUILD_RPM_PACKAGE)
set(CPACK_RPM_COMPONENT_INSTALL FALSE)
set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
set(CPACK_RPM_PACKAGE_URL "https://axel.isouard.fr/libwebrtc")
set(CPACK_RPM_PACKAGE_LICENSE "Apache-2.0")
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
endif (BUILD_RPM_PACKAGE)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${_PACKAGE_ARCH}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "libwebrtc-${LIBWEBRTC_VERSION}-${_PACKAGE_ARCH}")
endif (UNIX AND NOT APPLE)
set(CPACK_INSTALL_CMAKE_PROJECTS
"${CPACK_INSTALL_CMAKE_PROJECTS};${CMAKE_BINARY_DIR}/libwebrtc;libwebrtc;ALL;/")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "libwebrtc")
include(CPack)

View file

@ -1,49 +0,0 @@
#
# Generate environment variables
#
set(WEBRTC_PATH ${CMAKE_SOURCE_DIR}/depot_tools)
if (WIN32)
get_filename_component(DEPOT_TOOLS_PYTHON_PATH
"${WEBRTC_PATH}/python276_bin"
REALPATH)
list(APPEND WEBRTC_PATH ${DEPOT_TOOLS_PYTHON_PATH})
endif (WIN32)
list(APPEND WEBRTC_PATH $ENV{PATH})
if (WIN32)
string(REGEX REPLACE "/" "\\\\" WEBRTC_PATH "${WEBRTC_PATH}")
string(REGEX REPLACE ";" "\\\;" WEBRTC_PATH "${WEBRTC_PATH}")
else (WIN32)
string(REGEX REPLACE ";" ":" WEBRTC_PATH "${WEBRTC_PATH}")
endif (WIN32)
get_filename_component(CHROMIUM_PYTHONPATH
"${CMAKE_BINARY_DIR}/src/build"
REALPATH)
if (WIN32)
set(PREFIX_FILENAME ${CMAKE_BINARY_DIR}/prefix.bat)
set(PREFIX_COMMAND set)
set(PREFIX_HEADER "@ECHO OFF")
set(PREFIX_EVAL "%*")
set(PREFIX_EXECUTE cmd /c ${PREFIX_FILENAME})
set(PREFIX_NEWLINE \r\n)
else (WIN32)
set(PREFIX_FILENAME ${CMAKE_BINARY_DIR}/prefix.sh)
set(PREFIX_COMMAND export)
set(PREFIX_HEADER "")
set(PREFIX_EVAL eval\ $@)
set(PREFIX_EXECUTE /bin/sh ${PREFIX_FILENAME})
set(PREFIX_NEWLINE \n)
endif (WIN32)
file(WRITE ${PREFIX_FILENAME} "${PREFIX_HEADER}
${PREFIX_COMMAND} PATH=${WEBRTC_PATH}
${PREFIX_COMMAND} PYTHONPATH=${CHROMIUM_PYTHONPATH}
${PREFIX_COMMAND} DEPOT_TOOLS_WIN_TOOLCHAIN=0
${PREFIX_COMMAND} DEPOT_TOOLS_UPDATE=0
${PREFIX_COMMAND} CHROME_HEADLESS=1
${PREFIX_EVAL}
")

View file

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: LibWebRTC
Description: Google's native WebRTC implementation shipped into a single library
Version: @LIBWEBRTC_VERSION@
Libs: @LIBWEBRTC_PC_LIBS@
Libs.private: @LIBWEBRTC_PC_LIBS_PRIVATE@
Cflags: -I${includedir} @LIBWEBRTC_PC_DEFINITIONS@ @LIBWEBRTC_PC_CXXFLAGS@

View file

@ -1,63 +0,0 @@
# - Config file for 'LibWebRTC' package
# It defines the following variables
#
# LIBWEBRTC_INCLUDE_DIRS - include directories
# LIBWEBRTC_LIBRARY_DIRS - library directories
# LIBWEBRTC_LIBRARIES - libraries to link against
# LIBWEBRTC_CMAKE_DIR - path to the CMake modules
# LIBWEBRTC_USE_FILE - path to the CMake use file
#
# - Version variables:
# LIBWEBRTC_MAJOR_VERSION - major version
# LIBWEBRTC_MINOR_VERSION - minor version
# LIBWEBRTC_PATCH_VERSION - patch version
# LIBWEBRTC_BUILD_VERSION - version suffix, release candidate etc
# LIBWEBRTC_WEBRTC_REVISION - WebRTC's Git revision used for that release
# LIBWEBRTC_API_VERSION - full version without build prefix
# LIBWEBRTC_VERSION - full version with build prefix
#
# - Library type and targets variables:
# LIBWEBRTC_LIBRARY_TYPE - STATIC or SHARED
# LIBWEBRTC_TARGET_OS - android, chromeos, ios, linux, nacl, mac or win
# LIBWEBRTC_TARGET_CPU - x86, x64, arm, arm64 or mipsel
# LibWebRTC version number
set(LIBWEBRTC_MAJOR_VERSION "@LIBWEBRTC_MAJOR_VERSION@")
set(LIBWEBRTC_MINOR_VERSION "@LIBWEBRTC_MINOR_VERSION@")
set(LIBWEBRTC_PATCH_VERSION "@LIBWEBRTC_PATCH_VERSION@")
set(LIBWEBRTC_BUILD_VERSION "@LIBWEBRTC_BUILD_VERSION@")
set(LIBWEBRTC_WEBRTC_REVISION "@LIBWEBRTC_WEBRTC_REVISION@")
set(LIBWEBRTC_API_VERSION "@LIBWEBRTC_API_VERSION@")
set(LIBWEBRTC_VERSION "@LIBWEBRTC_VERSION@")
# LibWebRTC library type, target OS and target CPU
set(LIBWEBRTC_LIBRARY_TYPE "@LIBRARY_TYPE@")
set(LIBWEBRTC_TARGET_OS "@TARGET_OS@")
set(LIBWEBRTC_TARGET_CPU "@TARGET_CPU@")
# Include directory
set(LIBWEBRTC_INCLUDE_DIRS "@INSTALL_INCLUDE_DIR@")
# Libraries directory
set(LIBWEBRTC_LIBRARY_DIRS "@INSTALL_LIB_DIR@")
# Set the expected libraries variable
set(LIBWEBRTC_LIBRARIES @LIBWEBRTC_LIBRARIES@)
# The C and C++ flags added by LibWebRTC to the cmake-configured flags.
set(LIBWEBRTC_REQUIRED_C_FLAGS "@LIBWEBRTC_REQUIRED_C_FLAGS@")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "@LIBWEBRTC_REQUIRED_CXX_FLAGS@")
set(LIBWEBRTC_REQUIRED_C_FLAGS_DEBUG "@LIBWEBRTC_REQUIRED_C_FLAGS_DEBUG@")
set(LIBWEBRTC_REQUIRED_C_FLAGS_RELEASE "@LIBWEBRTC_REQUIRED_C_FLAGS_RELEASE@")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG "@LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG@")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE "@LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE@")
set(LIBWEBRTC_REQUIRED_SHARED_LINKER_FLAGS "@LIBWEBRTC_REQUIRED_SHARED_LINKER_FLAGS@")
set(LIBWEBRTC_REQUIRED_STATIC_LINKER_FLAGS "@LIBWEBRTC_REQUIRED_STATIC_LINKER_FLAGS@")
set(LIBWEBRTC_DEFINITIONS "@LIBWEBRTC_DEFINITIONS@")
# The location of the UseLibWebRTC.cmake file.
set(LIBWEBRTC_CMAKE_DIR "@INSTALL_CMAKE_DIR@")
set(LIBWEBRTC_USE_FILE "${LIBWEBRTC_CMAKE_DIR}/UseLibWebRTC.cmake")
# Import LibWebRTC targets.
include("${LIBWEBRTC_CMAKE_DIR}/LibWebRTCTargets.cmake")

View file

@ -1,14 +0,0 @@
# The full LibWebRTC version number.
set(PACKAGE_VERSION "@LIBWEBRTC_API_VERSION@")
# This version is compatible only with matching major.minor versions.
if ("@LIBWEBRTC_MAJOR_VERSION@.@LIBWEBRTC_MINOR_VERSION@" VERSION_EQUAL
"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}")
# This version is compatible with equal or lesser patch versions.
if (NOT "@LIBWEBRTC_PATCH_VERSION@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
set(PACKAGE_VERSION_COMPATIBLE 1)
if ("@LIBWEBRTC_PATCH_VERSION@" VERSION_EQUAL "${PACKAGE_FIND_VERSION_PATCH}")
set(PACKAGE_VERSION_EXACT 1)
endif ()
endif ()
endif ()

View file

@ -1,19 +0,0 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

View file

@ -1,13 +0,0 @@
#
# Set the project's version
set(LIBWEBRTC_MAJOR_VERSION 0)
set(LIBWEBRTC_MINOR_VERSION 0)
set(LIBWEBRTC_PATCH_VERSION 1)
set(LIBWEBRTC_BUILD_VERSION -rc.4)
set(LIBWEBRTC_WEBRTC_REVISION ae2551232b5249e38298a50f2d9a64d3c862db00)
set(LIBWEBRTC_API_VERSION
"${LIBWEBRTC_MAJOR_VERSION}.${LIBWEBRTC_MINOR_VERSION}.${LIBWEBRTC_PATCH_VERSION}")
set(LIBWEBRTC_VERSION
${LIBWEBRTC_API_VERSION}${LIBWEBRTC_BUILD_VERSION})

318
README.md
View file

@ -1,10 +1,10 @@
# libwebrtc [![License][license-img]][license-href] [![Join the chat at https://gitter.im/aisouard/libwebrtc][gitter-img]][gitter-href] [![Build Status][travis-img]][travis-href] [![Build Status][appveyor-img]][appveyor-href]
# libwebrtc [![License][license-img]][license-href]
This repository contains a collection of CMake scripts to help you embed
Google's native WebRTC implementation inside your project as simple as this:
```
cmake_minimum_required(VERSION 3.3)
```cmake
cmake_minimum_required(VERSION 3.9)
project(sample)
find_package(LibWebRTC REQUIRED)
@ -15,12 +15,106 @@ add_executable(sample ${SOURCE_FILES})
target_link_libraries(sample ${LIBWEBRTC_LIBRARIES})
```
It also produces a `pkg-config` file if you prefer the classic way:
## Prerequisites
- CMake 3.9 or later
- Python 2.7 (optional for Windows since it will use the interpreter located
inside the `depot_tools` installation)
### Debian & Ubuntu
- Required development packages:
```
$ g++ `pkg-config --cflags LibWebRTC` main.cpp -o main `pkg-config --libs LibWebRTC`
# 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
```
- GCC & G++ 4.8 or later, for C++11 support
### macOS
- OS X 10.11 or later
- Xcode 7.3.1 or later
### Windows
- Windows 7 x64 or later
- Visual Studio 2015/2017
Make sure that you install the following components:
- Visual C++, which will select three sub-categories including MFC
- Universal Windows Apps Development Tools
- Tools (1.4.1) and Windows 10 SDK (**10.0.14393**)
- [Windows 10 SDK][w10sdk] with **Debugging Tools for Windows** or
[Windows Driver Kit 10][wdk10] installed in the same Windows 10 SDK
installation directory.
## Getting sources
Clone the repository and run script to fetch WebRTC sources.
You can pass WebRTC version (branch) to script to fetch specific version.
```
git clone https://github.com/UltraCoderRU/libwebrtc.git
cd libwebrtc
python3 sync.py [WEBRTC_VERSION]
```
## Compiling
Create an output directory, browse inside it, then run CMake to configure project.
```
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=<Debug/Release> -DCMAKE_INSTALL_PREFIX=<install_path> ..
```
After configuration build library using standard CMake commands.
```
cmake --build .
cmake --install .
```
The library will be located inside the `lib` subdirectory of the `<install_path>`.
The `include` subdirectory will contain the header files.
CMake scripts will be placed inside the `lib/cmake/LibWebRTC` subdirectory.
## Using WebRTC in your project
To import LibWebRTC into your CMake project use `find_package`:
```cmake
find_package(LibWebRTC REQUIRED)
include(${LIBWEBRTC_USE_FILE})
target_link_libraries(my-app ${LIBWEBRTC_LIBRARIES})
```
You should add library installation path to `CMAKE_INSTALL_PREFIX` variable
while configuring your project:
```
cmake -DCMAKE_PREFIX_PATH=<install_path> ...
```
## Configuration
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.
- **GN_EXTRA_ARGS**
Add extra arguments to the `gn gen --args` parameter.
- **NINJA_ARGS**
Arguments to pass while executing the `ninja` command.
## Status
The following table displays the current state of this project, including
@ -30,198 +124,60 @@ supported platforms and architectures.
<tr>
<td align="center"></td>
<td align="center">x86</td>
<td align="center">x64</td>
<td align="center">amd64</td>
<td align="center">arm</td>
<td align="center">arm64</td>
</tr>
<tr>
<th align="center">Linux</th>
<td align="center">-</td>
<td align="center"></td>
<td align="center"></td>
<td></td>
<td></td>
</tr>
<tr>
<th align="center">macOS</th>
<td></td>
<td align="center"></td>
<td></td>
<td></td>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr>
<th align="center">Windows</th>
<td align="center">-</td>
<td align="center"></td>
<td align="center"></td>
<td></td>
<td></td>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr>
<th align="center">MacOS</th>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr>
<th align="center">Android</th>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr>
<th align="center">iOS</th>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
</tr>
</table>
## Prerequisites
- CMake 3.3 or later,
- Python 2.7 (optional for Windows since it will use the interpreter located
inside the `depot_tools` installation)
## Acknowledgements
### Debian & Ubuntu
Many thanks to Dr. Alex Gouaillard for being an excellent mentor for this
project.
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,
* Visual Studio 2015 **with updates** - Download the [Installer][vs2015-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**)
## Compiling
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, browse inside it, then run CMake.
```
$ git clone https://github.com/aisouard/libwebrtc.git
$ cd libwebrtc
$ git submodule init
$ git submodule update
$ mkdir out
$ cd out
$ cmake ..
```
Windows users will have to open the `libwebrtc.sln` located inside the current
directory output directory and build the `ALL_BUILD` project.
Unix users will just have to run the following `make` commands.
```
$ make
# make install
```
The library will be located inside the `lib` folder of the current output
directory. The `include` folder will contain the header files. CMake scripts
will be placed inside the `lib/cmake/LibWebRTC` directory.
## Using WebRTC in your project
At the time of writing this README file, there's no proper way to detect any
installation of the WebRTC library and header files. In the meantime, this CMake
script generates and declares a `LibWebRTC` package that will be very easy to
use for your projects.
All you have to do is include the package, then embed the "use file" that will
automatically find the required libraries, define the proper compiling flags and
include directories.
```
find_package(LibWebRTC REQUIRED)
include(${LIBWEBRTC_USE_FILE})
target_link_libraries(my-app ${LIBWEBRTC_LIBRARIES})
```
A pkg-config file is also provided, you can obtain the required compiler and
linker flags by specifying `LibWebRTC` as the package name.
```
$ pkg-config --cflags --libs LibWebRTC
```
## Configuration
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_DEB_PACKAGE**
Generate Debian package, defaults to OFF, available under Linux only.
- **BUILD_RPM_PACKAGE**
Generate Red Hat package, defaults to OFF, available under Linux only.
- **BUILD_TESTS**
Build WebRTC tests. (not supported yet)
- **BUILD_SHARED_LIB**
Defaults to OFF, will define the `component_build` gn argument to `true` if
enabled. This option will build a shared library instead of a static one.
- **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][twitter] for further discussion.
## License
Apache License 2.0 © [Axel Isouard][author]
Everything started from his
«[Automating libwebrtc build with CMake][webrtc-dr-alex-cmake]» blog article,
which was a great source of inspiration for me to create the easiest way to link
the WebRTC library in any native project.
[license-img]:https://img.shields.io/badge/License-Apache%202.0-blue.svg
[license-href]:https://opensource.org/licenses/Apache-2.0
[appveyor-img]:https://ci.appveyor.com/api/projects/status/yd1s303md3tt4w9a?svg=true
[appveyor-href]:https://ci.appveyor.com/project/aisouard/libwebrtc
[travis-img]:https://travis-ci.org/aisouard/libwebrtc.svg?branch=master
[travis-href]:https://travis-ci.org/aisouard/libwebrtc
[gitter-img]:https://badges.gitter.im/aisouard/libwebrtc.svg
[gitter-href]:https://gitter.im/aisouard/libwebrtc?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[osx1011sdk]: https://github.com/phracker/MacOSX-SDKs/releases/download/MacOSX10.11.sdk/MacOSX10.11.sdk.tar.xz
[vs2015-installer]:https://www.microsoft.com/en-US/download/details.aspx?id=48146
[twitter]:https://twitter.com/aisouard
[author]:https://axel.isouard.fr
[w10sdk]:https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
[wdk10]:https://go.microsoft.com/fwlink/p/?LinkId=526733
[webrtc-dr-alex-cmake]:http://webrtcbydralex.com/index.php/2015/07/22/automating-libwebrtc-build-with-cmake

View file

@ -1,173 +0,0 @@
include(ExternalProject)
include(LibWebRTCCommand)
include(GClientConfig)
set(_DOWNLOAD_COMMAND ${DEPOTTOOLS_GCLIENT_EXECUTABLE} sync --revision
${LIBWEBRTC_WEBRTC_REVISION} -D -n)
set(_BUILD_COMMAND ${PYTHON_EXECUTABLE} src/tools/clang/scripts/update.py)
ExternalProject_Add(
webrtc-src
PREFIX ${CMAKE_BINARY_DIR}
BINARY_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${CMAKE_BINARY_DIR}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
DOWNLOAD_COMMAND ${PREFIX_EXECUTE} ${_DOWNLOAD_COMMAND}
BUILD_COMMAND ${PREFIX_EXECUTE} ${_BUILD_COMMAND}
INSTALL_COMMAND ""
)
set(_NEXT_DEPENDS webrtc-src)
if (UNIX AND NOT APPLE)
libwebrtc_command(
NAME webrtc-install-sysroot
COMMAND ${CMAKE_BINARY_DIR}/src/build/linux/sysroot_scripts/install-sysroot.py --running-as-hook
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Installing Linux sysroots"
DEPENDS ${_NEXT_DEPENDS}
)
set(_NEXT_DEPENDS webrtc-install-sysroot)
set(_PLATFORM linux*)
set(_FOLDER linux64)
elseif (APPLE)
set(_PLATFORM darwin)
set(_FOLDER mac)
elseif (WIN32)
libwebrtc_command(
NAME webrtc-vs-toolchain
COMMAND ${PYTHON_EXECUTABLE} src/build/vs_toolchain.py update
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Updating Visual Studio toolchain"
DEPENDS ${_NEXT_DEPENDS}
)
set(_NEXT_DEPENDS webrtc-vs-toolchain)
set(_PLATFORM win32)
set(_FOLDER win)
set(_SUFFIX .exe)
endif (UNIX AND NOT APPLE)
libwebrtc_command(
NAME webrtc-fetch-gn
COMMAND download_from_google_storage --no_resume --platform=${_PLATFORM} --no_auth --bucket chromium-gn -s src/buildtools/${_FOLDER}/gn${_SUFFIX}.sha1
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Fetching gn binary"
DEPENDS ${_NEXT_DEPENDS}
)
libwebrtc_command(
NAME webrtc-fetch-clang-format
COMMAND download_from_google_storage --no_resume --platform=${_PLATFORM} --no_auth --bucket chromium-clang-format -s src/buildtools/${_FOLDER}/clang-format${_SUFFIX}.sha1
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Fetching clang-format binary"
DEPENDS webrtc-fetch-gn
)
#
# Android dependencies
set(_NEXT_DEPENDS webrtc-fetch-clang-format)
if (TARGET_OS STREQUAL "android")
libwebrtc_command(
NAME webrtc-android-fetch-play-services
COMMAND ${PYTHON_EXECUTABLE} src/build/android/play_services/update.py download
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Fetching Google Play Services"
DEPENDS webrtc-fetch-clang-format
)
libwebrtc_command(
NAME webrtc-android-update-lastchange
COMMAND ${PYTHON_EXECUTABLE} src/build/util/lastchange.py -o src/build/util/LASTCHANGE
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Updating src/build/util/LASTCHANGE"
DEPENDS webrtc-android-fetch-play-services
)
set(_NEXT_DEPENDS webrtc-android-update-lastchange)
foreach(_DEPENDENCY_NAME android-support-test-runner espresso guava hamcrest javax-inject)
string(REPLACE "-" "_" _DEPENDENCY_FOLDER ${_DEPENDENCY_NAME})
libwebrtc_command(
NAME webrtc-android-fetch-${_DEPENDENCY_NAME}
COMMAND ${PYTHON_EXECUTABLE} src/build/android/update_deps/update_third_party_deps.py download -b chromium-${_DEPENDENCY_NAME} -l third_party/${_DEPENDENCY_FOLDER}
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Fetching Android dependency: ${_DEPENDENCY_NAME}"
DEPENDS ${_NEXT_DEPENDS}
)
set(_NEXT_DEPENDS webrtc-android-fetch-${_DEPENDENCY_NAME})
endforeach(_DEPENDENCY_NAME)
endif (TARGET_OS STREQUAL "android")
#
# Generate build files
set(_GEN_ARGS use_gold=false target_cpu=\\"${TARGET_CPU}\\" target_os=\\"${TARGET_OS}\\")
if (MSVC OR XCODE)
set(_GEN_ARGS ${_GEN_ARGS} is_debug=$<$<CONFIG:Debug>:true>$<$<CONFIG:Release>:false>)
elseif (CMAKE_BUILD_TYPE MATCHES Debug)
set(_GEN_ARGS ${_GEN_ARGS} is_debug=true)
else (MSVC OR XCODE)
set(_GEN_ARGS ${_GEN_ARGS} is_debug=false)
endif (MSVC OR XCODE)
if (BUILD_TESTS)
set(_GEN_ARGS ${_GEN_ARGS} rtc_include_tests=true)
else (BUILD_TESTS)
set(_GEN_ARGS ${_GEN_ARGS} rtc_include_tests=false)
endif (BUILD_TESTS)
if (LIBRARY_TYPE STREQUAL STATIC)
set(_GEN_ARGS ${_GEN_ARGS} is_component_build=false)
else (LIBRARY_TYPE STREQUAL STATIC)
set(_GEN_ARGS ${_GEN_ARGS} is_component_build=true)
endif (LIBRARY_TYPE STREQUAL STATIC)
if (WIN32)
set(_GEN_COMMAND gn gen out/Default --args="${_GEN_ARGS}")
elseif (UNIX)
set(_GEN_COMMAND gn gen out/Default --args='"${_GEN_ARGS}"')
endif (WIN32)
libwebrtc_command(
NAME webrtc-generate
COMMAND ${_GEN_COMMAND}
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src"
COMMENT "Generating build files"
DEPENDS ${_NEXT_DEPENDS}
)
#
# Run ninja
libwebrtc_command(
NAME webrtc-build
COMMAND ninja ${NINJA_ARGS} -C out/Default
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src"
COMMENT "Building WebRTC"
DEPENDS webrtc-generate
)
#
# Link the library
ExternalProject_Add(
libwebrtc
DEPENDS webrtc-build
INSTALL_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${CMAKE_SOURCE_DIR}/Targets/libwebrtc
BINARY_DIR ${CMAKE_BINARY_DIR}/libwebrtc
CMAKE_ARGS
-DLIBRARY_TYPE:STRING=${LIBRARY_TYPE}
-DTARGET_OS:STRING=${TARGET_OS}
-DWEBRTC_OUTPUT_DIR:PATH=${CMAKE_BINARY_DIR}/src/out/Default
-DWEBRTC_SOURCE_DIR:PATH=${CMAKE_BINARY_DIR}/src/webrtc
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DINSTALL_CMAKE_DIR:PATH=${CMAKE_BINARY_DIR}/lib/cmake/LibWebRTC
)
include(Install)
include(Package)

View file

@ -1,58 +0,0 @@
cmake_minimum_required(VERSION 3.0)
project(libwebrtc)
set(_OBJ_EXT ${CMAKE_CXX_OUTPUT_EXTENSION})
file(GLOB_RECURSE _OBJ_FILES
${WEBRTC_OUTPUT_DIR}/obj/*${_OBJ_EXT})
if (NOT _OBJ_EXT STREQUAL ".o")
file(GLOB_RECURSE _OBJ_FILES_ASM
${WEBRTC_OUTPUT_DIR}/obj/*.o)
list(APPEND _OBJ_FILES ${_OBJ_FILES_ASM})
endif (NOT _OBJ_EXT STREQUAL ".o")
file(GLOB_RECURSE _OBJ_EXCLUDED
${WEBRTC_OUTPUT_DIR}/obj/third_party/yasm/gen*/*${_OBJ_EXT}
${WEBRTC_OUTPUT_DIR}/obj/third_party/yasm/re2c/*${_OBJ_EXT}
${WEBRTC_OUTPUT_DIR}/obj/third_party/yasm/yasm/*${_OBJ_EXT}
${WEBRTC_OUTPUT_DIR}/obj/third_party/protobuf/protoc/*${_OBJ_EXT}
${WEBRTC_OUTPUT_DIR}/obj/third_party/protobuf/protobuf_full/*${_OBJ_EXT}
${WEBRTC_OUTPUT_DIR}/obj/webrtc/examples/*${_OBJ_EXT}
${WEBRTC_OUTPUT_DIR}/obj/webrtc/tools/*${_OBJ_EXT}
${WEBRTC_OUTPUT_DIR}/obj/webrtc/modules/video_capture/video_capture/video_capture_external${_OBJ_EXT}
${WEBRTC_OUTPUT_DIR}/obj/webrtc/modules/video_capture/video_capture/device_info_external${_OBJ_EXT})
list(LENGTH _OBJ_EXCLUDED _OBJ_EXCLUDED_LEN)
if (${_OBJ_EXCLUDED_LEN} GREATER "0")
list(REMOVE_ITEM _OBJ_FILES ${_OBJ_EXCLUDED})
endif ()
add_library(webrtc ${LIBRARY_TYPE} ${_OBJ_FILES})
set_source_files_properties(${_OBJ_FILES} PROPERTIES
EXTERNAL_OBJECT true
GENERATED true)
set_target_properties(webrtc PROPERTIES
LINKER_LANGUAGE C
LIBRARY_OUTPUT_DIRECTORY ${WEBRTC_OUTPUT_DIR})
#
# Install headers
install(DIRECTORY ${WEBRTC_SOURCE_DIR}
DESTINATION "include"
FILES_MATCHING PATTERN "*.h")
#
# Install library
install(TARGETS webrtc
EXPORT LibWebRTCTargets
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
INCLUDES DESTINATION include)
install(EXPORT LibWebRTCTargets
FILE LibWebRTCTargets.cmake
DESTINATION ${INSTALL_CMAKE_DIR})

View file

@ -1,20 +0,0 @@
os: Visual Studio 2015
platform:
- x64
configuration: Release
clone_folder: c:\projects\libwebrtc
build:
project: PACKAGE.vcxproj
before_build:
- cd c:\projects\libwebrtc
- git submodule update --init --recursive
- cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=c:\projects\libwebrtc -DNINJA_ARGS="-j 2" .
artifacts:
- path: libwebrtc-0.0.1-rc.4-win32-x64.7z
name: libwebrtc-0.0.1-rc.4-win32-x64.7z

View file

@ -0,0 +1,75 @@
function(add_webrtc_target SOURCE_DIR BUILD_DIR)
set(GEN_ARGS_COMMON "target_cpu=\"${TARGET_CPU}\" target_os=\"${TARGET_OS}\" is_component_build=false use_gold=false use_sysroot=false use_custom_libcxx=false use_custom_libcxx_for_host=false use_rtti=true treat_warnings_as_errors=false rtc_include_tests=false rtc_build_tools=false rtc_build_examples=false rtc_enable_protobuf=false")
if (USE_CLANG)
set(GEN_ARGS_COMMON "${GEN_ARGS_COMMON} is_clang=true use_lld=true")
else()
set(GEN_ARGS_COMMON "${GEN_ARGS_COMMON} is_clang=false use_lld=false")
endif()
set(GEN_ARGS_DEBUG "${GEN_ARGS_COMMON} is_debug=true")
set(GEN_ARGS_RELEASE "${GEN_ARGS_COMMON} is_debug=false")
if (MSVC)
set(GEN_ARGS_DEBUG "${GEN_ARGS_DEBUG} enable_iterator_debugging=true")
endif ()
if (WIN32)
set(GN_EXECUTABLE gn.bat)
else ()
set(GN_EXECUTABLE gn)
endif ()
macro(run_gn DIRECTORY)
execute_process(COMMAND ${GN_EXECUTABLE} gen ${DIRECTORY} "--args=${GEN_ARGS}" WORKING_DIRECTORY ${SOURCE_DIR})
endmacro()
if (CMAKE_GENERATOR MATCHES "Visual Studio")
# Debug config
message(STATUS "Running gn for debug configuration...")
set(GEN_ARGS "${GEN_ARGS_DEBUG}")
if (GN_EXTRA_ARGS)
set(GEN_ARGS "${GEN_ARGS} ${GN_EXTRA_ARGS}")
endif ()
run_gn("${BUILD_DIR}/Debug")
# Release config
message(STATUS "Running gn for release configuration...")
set(GEN_ARGS "${GEN_ARGS_RELEASE}")
if (GN_EXTRA_ARGS)
set(GEN_ARGS "${GEN_ARGS} ${GN_EXTRA_ARGS}")
endif ()
run_gn("${BUILD_DIR}/Release")
else ()
message(STATUS "Running gn...")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(GEN_ARGS "${GEN_ARGS_DEBUG}")
else ()
set(GEN_ARGS "${GEN_ARGS_RELEASE}")
endif ()
if (GN_EXTRA_ARGS)
set(GEN_ARGS "${GEN_ARGS} ${GN_EXTRA_ARGS}")
endif ()
run_gn("${BUILD_DIR}")
endif ()
macro(add_custom_command_with_path TARGET_NAME)
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E env "PATH=$ENV{PATH}" ${ARGN}
WORKING_DIRECTORY ${SOURCE_DIR}
VERBATIM
)
endmacro()
add_custom_target(webrtc-build ALL)
add_custom_target(webrtc-clean)
if (CMAKE_GENERATOR MATCHES "Visual Studio")
add_custom_command_with_path(webrtc-build ninja -C "${BUILD_DIR}/$<CONFIG>" :webrtc jsoncpp libyuv ${NINJA_ARGS})
add_custom_command_with_path(webrtc-clean ${GN_EXECUTABLE} clean "${BUILD_DIR}/$<CONFIG>")
else ()
add_custom_command_with_path(webrtc-build ninja -C "${BUILD_DIR}" :webrtc jsoncpp libyuv ${NINJA_ARGS})
add_custom_command_with_path(webrtc-clean ${GN_EXECUTABLE} clean "${BUILD_DIR}")
endif ()
endfunction()

View file

@ -1,21 +1,17 @@
#
# Find required packages
find_package(Git REQUIRED)
find_package(DepotTools REQUIRED)
if (WIN32)
set(PYTHON_EXECUTABLE ${DEPOTTOOLS_PATH}/python.bat)
else (WIN32)
find_package(PythonInterp REQUIRED)
endif (WIN32)
list(APPEND LIBWEBRTC_LIBRARIES webrtc)
if (UNIX AND NOT APPLE)
find_package(X11 REQUIRED)
list(APPEND LIBWEBRTC_LIBRARIES ${X11_LIBRARIES} ${CMAKE_DL_LIBS})
endif (UNIX AND NOT APPLE)
list(APPEND LIBWEBRTC_LIBRARIES ${X11_LIBRARIES} ${CMAKE_DL_LIBS} rt)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if (CMAKE_HAVE_THREADS_LIBRARY)
list(APPEND LIBWEBRTC_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
endif ()
if (APPLE)
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
@ -26,9 +22,9 @@ if (APPLE)
list(APPEND LIBWEBRTC_LIBRARIES ${AUDIOTOOLBOX_LIBRARY} ${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY} ${COREGRAPHICS_LIBRARY} ${FOUNDATION_LIBRARY})
endif (APPLE)
endif ()
if (WIN32)
list(APPEND LIBWEBRTC_LIBRARIES msdmo.lib wmcodecdspuuid.lib dmoguids.lib
ole32.lib secur32.lib winmm.lib ws2_32.lib)
endif (WIN32)
crypt32.lib iphlpapi.lib ole32.lib secur32.lib winmm.lib ws2_32.lib)
endif ()

10
cmake/PatchSources.cmake Normal file
View file

@ -0,0 +1,10 @@
function(patch_sources PATCH_DIR SOURCE_DIR)
file(GLOB_RECURSE PATCHED_SOURCES RELATIVE ${PATCH_DIR} ${PATCH_DIR}/*)
list(REMOVE_ITEM PATCHED_SOURCES ".gitkeep")
foreach (file ${PATCHED_SOURCES})
message(STATUS "Patching ${file}...")
set(destination "${SOURCE_DIR}/${file}")
cmake_path(GET destination PARENT_PATH dest_dir)
file(COPY ${PATCH_DIR}/${file} DESTINATION ${dest_dir})
endforeach ()
endfunction()

View file

@ -1,6 +1,5 @@
include(CheckSymbolExists)
#
# Target OS
set(TARGET_OS "" CACHE STRING "Target OS, used as --target_os argument")
set(TARGET_OS_LIST android chromeos ios linux nacl mac win)
@ -13,30 +12,29 @@ if (TARGET_OS STREQUAL "")
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(TARGET_OS "win")
endif ()
endif (TARGET_OS STREQUAL "")
endif ()
if (NOT ${TARGET_OS} IN_LIST TARGET_OS_LIST)
message(FATAL_ERROR "Unknown value '${TARGET_OS}' for variable TARGET_OS, options are: ${TARGET_OS_LIST}")
endif (NOT ${TARGET_OS} IN_LIST TARGET_OS_LIST)
endif ()
#
# Target CPU
function(detect_current_arch)
if (WIN32)
check_symbol_exists("_M_X64" "" ARCH_X64)
if (NOT ARCH_X64)
check_symbol_exists("_M_AMD64" "" ARCH_X64)
endif (NOT ARCH_X64)
endif ()
check_symbol_exists("_M_IX86" "" ARCH_X86)
check_symbol_exists("_M_ARM" "" ARCH_ARM)
check_symbol_exists("_M_ARM64" "" ARCH_ARM64)
else (WIN32)
else ()
check_symbol_exists("__i386__" "" ARCH_X86)
check_symbol_exists("__x86_64__" "" ARCH_X64)
check_symbol_exists("__arm__" "" ARCH_ARM)
check_symbol_exists("__aarch64__" "" ARCH_ARM64)
check_symbol_exists("__mips__" "" ARCH_MIPS)
endif (WIN32)
endif ()
endfunction(detect_current_arch)
set(TARGET_CPU "" CACHE STRING "Target CPU, used as --target_cpu argument")
@ -57,30 +55,38 @@ if (TARGET_CPU STREQUAL "")
set(TARGET_CPU "mipsel")
else ()
set(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR})
endif (ARCH_X64)
endif (TARGET_CPU STREQUAL "")
endif ()
endif ()
if (NOT ${TARGET_CPU} IN_LIST TARGET_CPU_LIST)
message(FATAL_ERROR "Unknown value '${TARGET_CPU}' for variable TARGET_CPU, options are: ${TARGET_CPU_LIST}")
endif (NOT ${TARGET_CPU} IN_LIST TARGET_CPU_LIST)
endif ()
if (APPLE)
list(APPEND LIBWEBRTC_DEFINITIONS_DEBUG WEBRTC_MAC)
list(APPEND LIBWEBRTC_DEFINITIONS_RELEASE ${LIBWEBRTC_DEFINITIONS_DEBUG})
endif ()
if (UNIX)
if (ARCH_X86)
list(APPEND LIBWEBRTC_REQUIRED_CXX_FLAGS "-m32")
endif (ARCH_X86)
if (TARGET_CPU STREQUAL "x86")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "${LIBWEBRTC_REQUIRED_CXX_FLAGS} -m32")
endif (TARGET_CPU STREQUAL "x86")
list(APPEND LIBWEBRTC_REQUIRED_CXX_FLAGS "-std=gnu++0x")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "${LIBWEBRTC_REQUIRED_CXX_FLAGS} -std=gnu++0x")
if(THREADS_HAVE_PTHREAD_ARG)
list(APPEND LIBWEBRTC_REQUIRED_CXX_FLAGS "-pthread")
endif()
if (CMAKE_USE_PTHREADS_INIT)
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "${LIBWEBRTC_REQUIRED_CXX_FLAGS} -pthread")
endif ()
list(APPEND LIBWEBRTC_DEFINITIONS
WEBRTC_POSIX _GLIBCXX_USE_CXX11_ABI=0 _CRT_SECURE_NO_WARNINGS)
list(APPEND LIBWEBRTC_DEFINITIONS_DEBUG WEBRTC_POSIX _DEBUG=1)
list(APPEND LIBWEBRTC_DEFINITIONS_RELEASE WEBRTC_POSIX)
elseif (WIN32)
set(LIBWEBRTC_REQUIRED_C_FLAGS_DEBUG "/MTd")
set(LIBWEBRTC_REQUIRED_C_FLAGS_RELEASE "/MT")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG "/MTd")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE "/MT")
list(APPEND LIBWEBRTC_DEFINITIONS WEBRTC_WIN NOMINMAX _CRT_SECURE_NO_WARNINGS)
endif(UNIX)
set(LIBWEBRTC_REQUIRED_C_FLAGS_DEBUG "/MDd")
set(LIBWEBRTC_REQUIRED_C_FLAGS_RELEASE "/MD")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG "${LIBWEBRTC_REQUIRED_C_FLAGS_DEBUG}")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE "${LIBWEBRTC_REQUIRED_C_FLAGS_RELEASE}")
list(APPEND LIBWEBRTC_DEFINITIONS_DEBUG WEBRTC_WIN NOMINMAX _CRT_SECURE_NO_WARNINGS)
list(APPEND LIBWEBRTC_DEFINITIONS_RELEASE ${LIBWEBRTC_DEFINITIONS_DEBUG})
endif ()
message(STATUS "Building for ${TARGET_OS} (${TARGET_CPU})")

13
cmake/Utils.cmake Normal file
View file

@ -0,0 +1,13 @@
function(patch_file TARGET_FILE SEARCH_REGEX REPLACE_REGEX)
file(READ ${TARGET_FILE} filedata)
string(REGEX REPLACE ${SEARCH_REGEX} ${REPLACE_REGEX} filedata "${filedata}")
file(WRITE ${TARGET_FILE} "${filedata}")
endfunction()
function(prependPath DIRECTORY)
if (WIN32)
set(ENV{PATH} "${DIRECTORY};$ENV{PATH}")
else()
set(ENV{PATH} "${DIRECTORY}:$ENV{PATH}")
endif()
endfunction()

14
cmake/Version.cmake Normal file
View file

@ -0,0 +1,14 @@
function(get_webrtc_version_from_git OUT_VAR)
find_package(Git REQUIRED)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE WEBRTC_BRANCH
WORKING_DIRECTORY ${WEBRTC_SOURCE_DIR}
)
string(REGEX REPLACE "\n$" "" WEBRTC_BRANCH "${WEBRTC_BRANCH}")
set(${OUT_VAR} ${WEBRTC_BRANCH} PARENT_SCOPE)
endfunction()

@ -1 +0,0 @@
Subproject commit 33e88a4e19aa1eb306fe66431e8b0621773eb66c

129
libwebrtc/CMakeLists.txt Normal file
View file

@ -0,0 +1,129 @@
if (BUILD_DEB_PACKAGE)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH INTERNAL FORCE)
endif ()
# Prepare CMake exports
configure_file(LibWebRTCConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfig.cmake @ONLY)
configure_file(LibWebRTCConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfigVersion.cmake @ONLY)
######################
# INSTALL SECTION
######################
# Install headers
install(DIRECTORY
"${WEBRTC_SOURCE_DIR}/api"
"${WEBRTC_SOURCE_DIR}/base"
"${WEBRTC_SOURCE_DIR}/call"
"${WEBRTC_SOURCE_DIR}/common_audio"
"${WEBRTC_SOURCE_DIR}/common_video"
"${WEBRTC_SOURCE_DIR}/logging"
"${WEBRTC_SOURCE_DIR}/media"
"${WEBRTC_SOURCE_DIR}/modules"
"${WEBRTC_SOURCE_DIR}/p2p"
"${WEBRTC_SOURCE_DIR}/pc"
"${WEBRTC_SOURCE_DIR}/rtc_base"
"${WEBRTC_SOURCE_DIR}/system_wrappers"
DESTINATION "include/webrtc"
COMPONENT common
FILES_MATCHING PATTERN "*.h"
)
if (EXISTS "${WEBRTC_SOURCE_DIR}/common_types.h")
install(FILES "${WEBRTC_SOURCE_DIR}/common_types.h" DESTINATION "include/webrtc" COMPONENT common)
endif ()
install(DIRECTORY "${WEBRTC_SOURCE_DIR}/third_party/jsoncpp"
DESTINATION "include/webrtc/third_party"
COMPONENT common
FILES_MATCHING PATTERN "*.h"
)
install(DIRECTORY "${WEBRTC_SOURCE_DIR}/third_party/libyuv"
DESTINATION "include/webrtc/third_party"
COMPONENT common
FILES_MATCHING PATTERN "*.h"
)
install(DIRECTORY "${WEBRTC_SOURCE_DIR}/third_party/abseil-cpp/absl"
DESTINATION "include/webrtc"
COMPONENT common
FILES_MATCHING PATTERN "*.h"
)
# Install pdb files
if (MSVC)
# TODO: fix install on first run
file(GLOB_RECURSE PDB_FILES "${WEBRTC_BUILD_DIR}/Debug/*.pdb")
install(FILES DESTINATION lib COMPONENT debug)
endif()
# Install library
if (WIN32)
set(LIBRARY_FILENAME_DEBUG "webrtcd.lib")
set(LIBRARY_FILENAME_RELEASE "webrtc.lib")
else()
set(LIBRARY_FILENAME_DEBUG "libwebrtcd.a")
set(LIBRARY_FILENAME_RELEASE "libwebrtc.a")
endif()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (WIN32)
install(FILES ${WEBRTC_BUILD_DIR}/obj/webrtc.lib DESTINATION lib RENAME "webrtcd.lib" COMPONENT debug)
else()
install(FILES ${WEBRTC_BUILD_DIR}/obj/libwebrtc.a DESTINATION lib RENAME "libwebrtcd.a" COMPONENT debug)
endif()
else ()
if (WIN32)
install(FILES ${WEBRTC_BUILD_DIR}/obj/webrtc.lib DESTINATION lib COMPONENT release)
else()
install(FILES ${WEBRTC_BUILD_DIR}/obj/libwebrtc.a DESTINATION lib COMPONENT release)
endif()
endif ()
install(FILES
UseLibWebRTC.cmake
${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfigVersion.cmake
${CMAKE_CURRENT_SOURCE_DIR}/LibWebRTCTargets.cmake
DESTINATION "lib/cmake/LibWebRTC"
COMPONENT common
)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES LibWebRTCTargets-debug.cmake DESTINATION "lib/cmake/LibWebRTC" COMPONENT debug)
else ()
install(FILES LibWebRTCTargets-release.cmake DESTINATION "lib/cmake/LibWebRTC" COMPONENT release)
endif ()
if (BUILD_DEB_PACKAGE)
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_VENDOR "Kirill Kirilenko")
set(CPACK_PACKAGE_CONTACT "Kirill Kirilenko <kirill@ultracoder.org>")
set(CPACK_PACKAGE_VERSION_MAJOR ${WEBRTC_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR "")
set(CPACK_PACKAGE_VERSION_PATCH "")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/UltraCoderRU/libwebrtc")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
set(CPACK_DEBIAN_COMMON_PACKAGE_NAME "libwebrtc-common-dev")
set(CPACK_DEBIAN_COMMON_FILE_NAME "libwebrtc-common-dev-${WEBRTC_VERSION}.deb")
set(CPACK_DEBIAN_COMMON_DESCRIPTION "WebRTC header files and CMake modules")
set(CPACK_DEBIAN_RELEASE_PACKAGE_NAME "libwebrtc-release-dev")
set(CPACK_DEBIAN_RELEASE_FILE_NAME "libwebrtc-release-dev-${WEBRTC_VERSION}.deb")
set(CPACK_DEBIAN_RELEASE_DESCRIPTION "WebRTC static library (release version)")
set(CPACK_DEBIAN_RELEASE_PACKAGE_DEPENDS "libwebrtc-common-dev (=${WEBRTC_VERSION})")
set(CPACK_DEBIAN_RELEASE_PACKAGE_PROVIDES "libwebrtc-dev")
set(CPACK_DEBIAN_DEBUG_PACKAGE_NAME "libwebrtc-debug-dev")
set(CPACK_DEBIAN_DEBUG_FILE_NAME "libwebrtc-debug-dev-${WEBRTC_VERSION}.deb")
set(CPACK_DEBIAN_DEBUG_DESCRIPTION "WebRTC static library (debug version)")
set(CPACK_DEBIAN_DEBUG_PACKAGE_DEPENDS "libwebrtc-common-dev (=${WEBRTC_VERSION})")
set(CPACK_DEBIAN_DEBUG_PACKAGE_PROVIDES "libwebrtc-dev")
include(CPack)
endif ()

View file

@ -0,0 +1,43 @@
# - Config file for 'LibWebRTC' package
# It defines the following variables
#
# LIBWEBRTC_INCLUDE_DIRS - include directories
# LIBWEBRTC_LIBRARY_DIRS - library directories
# LIBWEBRTC_LIBRARIES - libraries to link against
# LIBWEBRTC_CMAKE_DIR - path to the CMake modules
# LIBWEBRTC_USE_FILE - path to the CMake use file
#
# - Version variables:
# WEBRTC_VERSION - WebRTC version with build prefix
#
# - Library type and targets variables:
# LIBWEBRTC_TARGET_OS - android, chromeos, ios, linux, nacl, mac or win
# LIBWEBRTC_TARGET_CPU - x86, x64, arm, arm64 or mipsel
# WebRTC version number (branch head)
set(WEBRTC_VERSION "@WEBRTC_VERSION@")
# LibWebRTC library type, target OS and target CPU
set(LIBWEBRTC_TARGET_OS "@TARGET_OS@")
set(LIBWEBRTC_TARGET_CPU "@TARGET_CPU@")
# Set the expected libraries variable
set(LIBWEBRTC_LIBRARIES @LIBWEBRTC_LIBRARIES@)
# The C and C++ flags added by LibWebRTC to the cmake-configured flags.
set(LIBWEBRTC_REQUIRED_C_FLAGS "@LIBWEBRTC_REQUIRED_C_FLAGS@")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "@LIBWEBRTC_REQUIRED_CXX_FLAGS@")
set(LIBWEBRTC_REQUIRED_C_FLAGS_DEBUG "@LIBWEBRTC_REQUIRED_C_FLAGS_DEBUG@")
set(LIBWEBRTC_REQUIRED_C_FLAGS_RELEASE "@LIBWEBRTC_REQUIRED_C_FLAGS_RELEASE@")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG "@LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG@")
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE "@LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE@")
set(LIBWEBRTC_REQUIRED_STATIC_LINKER_FLAGS "@LIBWEBRTC_REQUIRED_STATIC_LINKER_FLAGS@")
set(LIBWEBRTC_DEFINITIONS_DEBUG "@LIBWEBRTC_DEFINITIONS_DEBUG@")
set(LIBWEBRTC_DEFINITIONS_RELEASE "@LIBWEBRTC_DEFINITIONS_RELEASE@")
# The location of the UseLibWebRTC.cmake file.
set(LIBWEBRTC_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}")
set(LIBWEBRTC_USE_FILE "${LIBWEBRTC_CMAKE_DIR}/UseLibWebRTC.cmake")
# Import LibWebRTC targets.
include("${LIBWEBRTC_CMAKE_DIR}/LibWebRTCTargets.cmake")

View file

@ -0,0 +1,8 @@
# The full LibWebRTC version number.
set(PACKAGE_VERSION "@WEBRTC_VERSION@")
# This version is compatible only with equal version
if ("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "@WEBRTC_VERSION@")
set(PACKAGE_VERSION_COMPATIBLE 1)
set(PACKAGE_VERSION_EXACT 1)
endif ()

View file

@ -0,0 +1,23 @@
#----------------------------------------------------------------
# CMake target import file for configuration "Debug".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "webrtc" for configuration "Debug"
set_property(TARGET webrtc APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug)
if (MSVC)
set(_WEBRTC_LIBRARY_PATH "${_IMPORT_PREFIX}/lib/webrtcd.lib")
else ()
set(_WEBRTC_LIBRARY_PATH "${_IMPORT_PREFIX}/lib/libwebrtcd.a")
endif ()
set_target_properties(webrtc PROPERTIES IMPORTED_LOCATION_DEBUG "${_WEBRTC_LIBRARY_PATH}")
list(APPEND _IMPORT_CHECK_TARGETS webrtc)
list(APPEND _IMPORT_CHECK_FILES_FOR_webrtc "${_WEBRTC_LIBRARY_PATH}")
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

View file

@ -0,0 +1,23 @@
#----------------------------------------------------------------
# CMake target import file for configuration "Release".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "webrtc" for configuration "Release"
set_property(TARGET webrtc APPEND PROPERTY IMPORTED_CONFIGURATIONS Release)
if (MSVC)
set(_WEBRTC_LIBRARY_PATH "${_IMPORT_PREFIX}/lib/webrtc.lib")
else ()
set(_WEBRTC_LIBRARY_PATH "${_IMPORT_PREFIX}/lib/libwebrtc.a")
endif ()
set_target_properties(webrtc PROPERTIES IMPORTED_LOCATION_RELEASE "${_WEBRTC_LIBRARY_PATH}")
list(APPEND _IMPORT_CHECK_TARGETS webrtc)
list(APPEND _IMPORT_CHECK_FILES_FOR_webrtc "${_WEBRTC_LIBRARY_PATH}")
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

View file

@ -0,0 +1,83 @@
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6)
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget webrtc)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
endif()
if(TARGET ${_expectedTarget})
list(APPEND _targetsDefined ${_expectedTarget})
endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
# The installation prefix configured by this project.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
# Create imported target webrtc
add_library(webrtc STATIC IMPORTED)
set_target_properties(webrtc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/webrtc;${_IMPORT_PREFIX}/include/webrtc/third_party/libyuv/include;${_IMPORT_PREFIX}/include/webrtc/third_party/jsoncpp/source/include"
)
# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/LibWebRTCTargets-*.cmake")
foreach(f ${CONFIG_FILES})
include(${f})
endforeach()
# Cleanup temporary variables.
set(_IMPORT_PREFIX)
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
if(NOT EXISTS "${file}" )
message(FATAL_ERROR "The imported target \"${target}\" references the file
\"${file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)
# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)

View file

@ -4,6 +4,8 @@
# settings to use LibWebRTC.
#
cmake_minimum_required(VERSION 3.9)
if (LIBWEBRTC_USE_FILE_INCLUDED)
return()
endif ()
@ -23,14 +25,14 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${LIBWEBRTC_REQUIRED_C_FLAGS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBWEBRTC_REQUIRED_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LIBWEBRTC_REQUIRED_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${LIBWEBRTC_REQUIRED_STATIC_LINKER_FLAGS}")
# Add preprocessor definitions needed to use LibWebRTC.
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${LIBWEBRTC_DEFINITIONS})
# Add include directories needed to use LibWebRTC.
include_directories(${LIBWEBRTC_INCLUDE_DIRS})
# Add link directories needed to use LibWebRTC.
link_directories(${LIBWEBRTC_LIBRARY_DIRS})
if (GENERATOR_IS_MULTI_CONFIG)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG ${LIBWEBRTC_DEFINITIONS_DEBUG})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE ${LIBWEBRTC_DEFINITIONS_RELEASE})
elseif (CMAKE_BUILD_TYPE MATCHES Debug)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${LIBWEBRTC_DEFINITIONS_DEBUG})
else ()
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${LIBWEBRTC_DEFINITIONS_RELEASE})
endif ()

0
patches/.gitkeep Normal file
View file

78
sync.py Executable file
View file

@ -0,0 +1,78 @@
#!/usr/bin/env python3
import os
import sys
import subprocess
from pathlib import Path
def execute(command: str):
subprocess.run(command, shell=True, check=True)
def get_output(command: str):
return subprocess.run(command, capture_output=True, shell=True, check=True).stdout.decode()
# To determine last stable WebRTC revision,
# see https://chromiumdash.appspot.com/branches
# and https://chromiumdash.appspot.com/schedule
WEBRTC_REVISION = 4692
if len(sys.argv) == 2:
WEBRTC_REVISION = sys.argv[1]
REPO_ROOT = Path(__file__).resolve().parent
DEPOT_TOOLS_DIR = REPO_ROOT / 'depot_tools'
WEBRTC_DIR = REPO_ROOT / 'webrtc'
SRC_DIR = WEBRTC_DIR / 'src'
os.environ['PATH'] = '{}{}{}'.format(DEPOT_TOOLS_DIR, os.pathsep, os.environ['PATH'])
if sys.platform == 'win32':
os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
os.chdir(REPO_ROOT)
if not os.path.isdir(DEPOT_TOOLS_DIR):
print('Cloning Depot Tools...')
execute('git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git')
os.chdir(DEPOT_TOOLS_DIR)
if sys.platform == 'win32':
execute('gclient --version')
execute('where python')
execute('python update_depot_tools_toggle.py --disable')
else:
print('Updating Depot Tools to the latest revision...')
os.chdir(DEPOT_TOOLS_DIR)
execute('git checkout -q -f main')
execute('git pull -q')
if not os.path.isdir(WEBRTC_DIR):
print('Cloning WebRTC...')
os.mkdir(WEBRTC_DIR)
os.chdir(WEBRTC_DIR)
execute('fetch --nohooks webrtc')
os.chdir(SRC_DIR)
execute('gclient sync --with_branch_heads --nohooks')
else:
print('Updating WebRTC branches info...')
os.chdir(SRC_DIR)
execute('gclient sync --with_branch_heads --nohooks')
# Latest Depot Tools versions are not compatible
# with old WebRTC versions, so we peek revision
# from around the same time as the WebRTC and
# forbid gclient to auto-update Depot Tools.
os.chdir(SRC_DIR)
LAST_WEBRTC_COMMIT_DATE = get_output('git log -n 1 --pretty=format:%ci branch-heads/{}'.format(WEBRTC_REVISION)).strip()
os.chdir(DEPOT_TOOLS_DIR)
DEPOT_TOOLS_COMPATIBLE_REVISION = get_output('git rev-list -n 1 --before="{}" main'.format(LAST_WEBRTC_COMMIT_DATE)).strip()
print('Updating Depot Tools to a compatible revision {}...'.format(DEPOT_TOOLS_COMPATIBLE_REVISION))
execute('git checkout -f {}'.format(DEPOT_TOOLS_COMPATIBLE_REVISION))
print('Updating WebRTC to version {}...'.format(WEBRTC_REVISION))
os.chdir(SRC_DIR)
execute('git clean -ffd')
execute('git checkout -q -B {} branch-heads/{}'.format(WEBRTC_REVISION, WEBRTC_REVISION))
execute('gclient sync --force -D --reset')