mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-28 11:15:13 +00:00
Compare commits
125 commits
0.0.1-rc.4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c4917e8f86 | |||
| 4475233318 | |||
| 92fb3fdc01 | |||
| 915e13f4ce | |||
| c3a581c11c | |||
| cf009964cf | |||
| 9d7075b4f0 | |||
| 292a9b8751 | |||
| 0e08c8388a | |||
| d667dab439 | |||
| 1e24732035 | |||
| ab22b5519e | |||
| 2db22c8048 | |||
| 477b5b2220 | |||
| c8cdba02bc | |||
| 5a40775960 | |||
| d5583c9a6c | |||
| f158466213 | |||
| 8185da4a10 | |||
| bb6c49081b | |||
| 700e94ff03 | |||
| 40db8152b4 | |||
| 7fefa7dc53 | |||
| 3315befa38 | |||
| dccaa6f5f4 | |||
| 5ac8845681 | |||
|
|
b248e1cd73 | ||
|
|
336476a1f8 | ||
|
|
38d6a4e9ea | ||
|
|
2ac0e402e1 | ||
|
|
05445b2fd5 | ||
|
|
46f502d2d1 | ||
|
|
d44f0e4c3a | ||
|
|
a24a5e5947 | ||
|
|
6fa64674be | ||
|
|
09a07366da | ||
|
|
4ee758711c | ||
|
|
b9480efda7 | ||
|
|
9db425ba54 | ||
|
|
475d263a51 | ||
|
|
2e92e72f0a | ||
|
|
a627d1bc9a | ||
|
|
66fa38e90d | ||
|
|
9664e669e6 | ||
|
|
60407d29cd | ||
|
|
0569dc61df | ||
|
|
37eeec231e | ||
|
|
d2d4b017f8 | ||
|
|
ffd60ae7d8 | ||
|
|
787fe28f96 | ||
|
|
a477b6a2a8 | ||
|
|
1d52ac650f | ||
|
|
d26a48fc0d | ||
|
|
3d42742689 | ||
|
|
a925a1bad2 | ||
|
|
107f4dccb3 | ||
|
|
be407aced0 | ||
|
|
f7e01514ed | ||
|
|
b3651f0e14 | ||
|
|
8d571cb492 | ||
|
|
f496ce1a29 | ||
|
|
9b5dadf807 | ||
|
|
5cfd7585f8 | ||
|
|
d2de52cdce | ||
|
|
1bed0a6818 | ||
|
|
5cda935434 | ||
|
|
9f324642f5 | ||
|
|
941688e7fc | ||
|
|
eec2846651 | ||
|
|
7cd0a79bd2 | ||
|
|
1dbc538b4b | ||
|
|
ee7fb4f42d | ||
|
|
ad6d1a565a | ||
|
|
2969a0f603 | ||
|
|
67ac79ff0f | ||
|
|
bc9c05404f | ||
|
|
b35dc15d8d | ||
|
|
55f1e9d761 | ||
|
|
7acf691f2b | ||
|
|
ab1cf49414 | ||
|
|
7ef534cd55 | ||
|
|
77208bccbd | ||
|
|
9ee8a5aec6 | ||
|
|
53a331a356 | ||
|
|
7047a4dfef | ||
|
|
522e16128a | ||
|
|
cb13886cbe | ||
|
|
5ae2a5de6b | ||
|
|
6aab703673 | ||
|
|
5744e63abe | ||
|
|
58f2d70a74 | ||
|
|
418e54b401 | ||
|
|
c21220c58c | ||
|
|
64690d1a30 | ||
|
|
16578cdd5c | ||
|
|
7311f13bfa | ||
|
|
7950fa7e8a | ||
|
|
c8a3e8eb8a | ||
|
|
5d3887b918 | ||
|
|
ea5d4643aa | ||
|
|
daf8535a2d | ||
|
|
c10f3458f0 | ||
|
|
8970f2368b | ||
|
|
17ef828ce2 | ||
|
|
bbdd74ce9a | ||
|
|
b294fac627 | ||
|
|
b59291f093 | ||
|
|
5a602922c0 | ||
|
|
e3a4e5d64e | ||
|
|
93438caf76 | ||
|
|
e60dbd57f6 | ||
|
|
7ad84637f4 | ||
|
|
a750ea484d | ||
|
|
b565920acb | ||
|
|
638022675f | ||
|
|
470e444791 | ||
|
|
987a23fcef | ||
|
|
80281d8afa | ||
|
|
9eafe12813 | ||
|
|
058d9e0da3 | ||
|
|
287d483478 | ||
|
|
bc67c8f626 | ||
|
|
b668195218 | ||
|
|
83814ef6f3 | ||
|
|
f25382438d |
37 changed files with 782 additions and 1014 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
|
@ -1,6 +1,4 @@
|
|||
.DS_Store
|
||||
/out/
|
||||
/.idea/
|
||||
*.gclient
|
||||
*.gclient_entries
|
||||
/cmake-build-debug/
|
||||
.idea
|
||||
cmake-build-*
|
||||
webrtc
|
||||
depot_tools
|
||||
|
|
|
|||
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -1,3 +0,0 @@
|
|||
[submodule "depot_tools"]
|
||||
path = depot_tools
|
||||
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
60
.travis.yml
60
.travis.yml
|
|
@ -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
53
CHANGELOG.md
Normal 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
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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.")
|
||||
|
|
@ -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")
|
||||
|
|
@ -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)
|
||||
|
|
@ -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()
|
||||
|
|
@ -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()
|
||||
|
|
@ -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)
|
||||
|
|
@ -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}
|
||||
")
|
||||
|
|
@ -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@
|
||||
|
|
@ -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")
|
||||
|
|
@ -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 ()
|
||||
|
|
@ -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)
|
||||
|
|
@ -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
318
README.md
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -1,68 +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 ()
|
||||
|
||||
list(FILTER _OBJ_FILES EXCLUDE REGEX test)
|
||||
list(FILTER _OBJ_FILES EXCLUDE REGEX unittests)
|
||||
|
||||
#add fakeaudio device
|
||||
file(GLOB_RECURSE LIBWEBRTC_TEST_COMMON_FILES
|
||||
"${WEBRTC_OUTPUT_DIR}/obj/webrtc/test/test_common/*${_OBJ_EXT}"
|
||||
"${WEBRTC_OUTPUT_DIR}/obj/testing/gtest/gtest*${_OBJ_EXT}")
|
||||
list(APPEND _OBJ_FILES ${LIBWEBRTC_TEST_COMMON_FILES})
|
||||
|
||||
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}
|
||||
PREFIX lib)
|
||||
|
||||
#
|
||||
# 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})
|
||||
21
appveyor.yml
21
appveyor.yml
|
|
@ -1,21 +0,0 @@
|
|||
os: Visual Studio 2015
|
||||
|
||||
platform:
|
||||
- x86
|
||||
|
||||
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" -DCMAKE_INSTALL_PREFIX=c:\projects\libwebrtc -DNINJA_ARGS="-j 2" -DBUILD_TESTS=ON .
|
||||
|
||||
artifacts:
|
||||
- path: libwebrtc-0.0.1-rc.4-win-x86.zip
|
||||
|
||||
test: OFF
|
||||
75
cmake/AddWebRTCTarget.cmake
Normal file
75
cmake/AddWebRTCTarget.cmake
Normal 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()
|
||||
|
|
@ -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
10
cmake/PatchSources.cmake
Normal 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()
|
||||
|
|
@ -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)
|
||||
|
||||
if (UNIX)
|
||||
if (ARCH_X86)
|
||||
list(APPEND LIBWEBRTC_REQUIRED_CXX_FLAGS "-m32")
|
||||
endif (ARCH_X86)
|
||||
|
||||
list(APPEND LIBWEBRTC_REQUIRED_CXX_FLAGS "-std=gnu++0x")
|
||||
|
||||
if(THREADS_HAVE_PTHREAD_ARG)
|
||||
list(APPEND LIBWEBRTC_REQUIRED_CXX_FLAGS "-pthread")
|
||||
endif ()
|
||||
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS
|
||||
WEBRTC_POSIX _GLIBCXX_USE_CXX11_ABI=0 _CRT_SECURE_NO_WARNINGS)
|
||||
if (APPLE)
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS_DEBUG WEBRTC_MAC)
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS_RELEASE ${LIBWEBRTC_DEFINITIONS_DEBUG})
|
||||
endif ()
|
||||
|
||||
if (UNIX)
|
||||
if (TARGET_CPU STREQUAL "x86")
|
||||
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "${LIBWEBRTC_REQUIRED_CXX_FLAGS} -m32")
|
||||
endif (TARGET_CPU STREQUAL "x86")
|
||||
|
||||
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "${LIBWEBRTC_REQUIRED_CXX_FLAGS} -std=gnu++0x")
|
||||
|
||||
if (CMAKE_USE_PTHREADS_INIT)
|
||||
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "${LIBWEBRTC_REQUIRED_CXX_FLAGS} -pthread")
|
||||
endif ()
|
||||
|
||||
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
13
cmake/Utils.cmake
Normal 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
14
cmake/Version.cmake
Normal 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
129
libwebrtc/CMakeLists.txt
Normal 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 ()
|
||||
43
libwebrtc/LibWebRTCConfig.cmake.in
Normal file
43
libwebrtc/LibWebRTCConfig.cmake.in
Normal 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")
|
||||
8
libwebrtc/LibWebRTCConfigVersion.cmake.in
Normal file
8
libwebrtc/LibWebRTCConfigVersion.cmake.in
Normal 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 ()
|
||||
23
libwebrtc/LibWebRTCTargets-debug.cmake
Normal file
23
libwebrtc/LibWebRTCTargets-debug.cmake
Normal 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)
|
||||
23
libwebrtc/LibWebRTCTargets-release.cmake
Normal file
23
libwebrtc/LibWebRTCTargets-release.cmake
Normal 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)
|
||||
83
libwebrtc/LibWebRTCTargets.cmake
Normal file
83
libwebrtc/LibWebRTCTargets.cmake
Normal 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)
|
||||
|
|
@ -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
0
patches/.gitkeep
Normal file
78
sync.py
Executable file
78
sync.py
Executable 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')
|
||||
Loading…
Add table
Reference in a new issue