mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-28 03:15:11 +00:00
Separated sources fetching and building.
This commit is contained in:
parent
8185da4a10
commit
f158466213
40 changed files with 469 additions and 1264 deletions
|
|
@ -1,22 +0,0 @@
|
|||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: base/archlinux
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install build dependencies
|
||||
command: pacman -Syu && pacman -S --noconfirm cmake ninja libx11 python2 git
|
||||
- run:
|
||||
name: Enable python2
|
||||
command: mkdir -p /tmp/python_for_libwebrtc_build && ln -s /usr/bin/python2 /tmp/python_for_libwebrtc_build/python
|
||||
- run:
|
||||
name: Run cmake
|
||||
command: PATH=/tmp/python_for_libwebrtc_build:$PATH cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DWEBRTC_BRANCH_HEAD=refs/branch-heads/66 .
|
||||
- run:
|
||||
name: Build
|
||||
command: PATH=/tmp/python_for_libwebrtc_build:$PATH ninja package
|
||||
- run:
|
||||
name: Move artifacts
|
||||
command: mv libwebrtc-*.tar.gz $CIRCLE_ARTIFACTS/
|
||||
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
|
||||
|
|
|
|||
40
.travis.yml
40
.travis.yml
|
|
@ -1,40 +0,0 @@
|
|||
matrix:
|
||||
include:
|
||||
- os: osx
|
||||
osx_image: xcode11.5
|
||||
env: TARGET_CPU=x64
|
||||
addons:
|
||||
apt: *x64-apt
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode11.5
|
||||
env: TARGET_CPU=x64 CMAKE_BUILD_TYPE=Debug
|
||||
addons:
|
||||
apt: *x64-apt
|
||||
|
||||
language: cpp
|
||||
|
||||
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}
|
||||
export CXX="g++-4.8" CC="gcc-4.8"
|
||||
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 -DBUILD_SAMPLE=1 -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DCMAKE_INSTALL_PREFIX=. -DTARGET_CPU=$TARGET_CPU ..
|
||||
|
||||
script:
|
||||
- make -j 4 package
|
||||
144
CMakeLists.txt
144
CMakeLists.txt
|
|
@ -1,135 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.3)
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING INTERNAL FORCE)
|
||||
|
||||
project(libwebrtc)
|
||||
|
||||
#
|
||||
option(GN_EXTRA_ARGS "Extra 'gn gen' arguments to pass when configuring WebRTC" "")
|
||||
option(NINJA_ARGS "Ninja arguments to pass when compiling WebRTC" "")
|
||||
|
||||
# Allow the use of IN_LIST operand
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
||||
${CMAKE_SOURCE_DIR}/CMakeModules)
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
|
||||
include(FindLibraries)
|
||||
include(Version)
|
||||
include(Options)
|
||||
include(TargetOsAndCpu)
|
||||
|
||||
if (HAS_OWN_DEPOT_TOOLS)
|
||||
find_package(DepotTools REQUIRED)
|
||||
endif (HAS_OWN_DEPOT_TOOLS)
|
||||
set(ENV{PATH} "${CMAKE_SOURCE_DIR}/depot_tools:$ENV{PATH}")
|
||||
set(WEBRTC_SOURCE_DIR "${CMAKE_SOURCE_DIR}/webrtc/src")
|
||||
set(WEBRTC_BUILD_DIR "${CMAKE_BINARY_DIR}/webrtc")
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package(PythonInterp 2.7 REQUIRED)
|
||||
endif (NOT WIN32)
|
||||
include(Version)
|
||||
get_webrtc_version_from_git(WEBRTC_VERSION)
|
||||
message(STATUS "WebRTC version: ${WEBRTC_VERSION}")
|
||||
|
||||
include(ExternalProject)
|
||||
if (MSVC)
|
||||
# Always build with dynamic runtime on MSVC
|
||||
include(PatchFile)
|
||||
patch_file(${WEBRTC_SOURCE_DIR}/build/config/win/BUILD.gn ":static_crt" ":dynamic_crt")
|
||||
endif ()
|
||||
|
||||
if (NOT HAS_OWN_DEPOT_TOOLS)
|
||||
if (WIN32)
|
||||
set(GCLIENT_EXECUTABLE ${CMAKE_BINARY_DIR}/depot_tools/src/depot-tools/gclient.bat)
|
||||
set(DEPOT_UPDATE_COMMAND update_depot_tools.bat)
|
||||
else (WIN32)
|
||||
set(GCLIENT_EXECUTABLE ${CMAKE_BINARY_DIR}/depot_tools/src/depot-tools/gclient)
|
||||
set(DEPOT_UPDATE_COMMAND bash update_depot_tools)
|
||||
endif (WIN32)
|
||||
include(AddWebRTCTarget)
|
||||
add_webrtc_target(${WEBRTC_SOURCE_DIR} ${WEBRTC_BUILD_DIR})
|
||||
|
||||
ExternalProject_Add(
|
||||
depot-tools
|
||||
|
||||
GIT_REPOSITORY https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
|
||||
PREFIX ${CMAKE_BINARY_DIR}/depot_tools
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
PATCH_COMMAND ${DEPOT_UPDATE_COMMAND}
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
set(_NEXT_DEPENDS depot-tools)
|
||||
set(DEPOT_TOOLS_PATH ${CMAKE_BINARY_DIR}/depot_tools/src/depot-tools)
|
||||
endif (NOT HAS_OWN_DEPOT_TOOLS)
|
||||
|
||||
set(_WEBRTC_CMAKE_ARGS
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_MODULE_PATH:PATH=${CMAKE_MODULE_PATH}
|
||||
-DDEPOT_TOOLS_PATH:PATH=${DEPOT_TOOLS_PATH}
|
||||
-DGCLIENT_EXECUTABLE:PATH=${GCLIENT_EXECUTABLE}
|
||||
-DHAS_OWN_DEPOT_TOOLS:PATH=${HAS_OWN_DEPOT_TOOLS}
|
||||
-DTARGET_CPU=${TARGET_CPU}
|
||||
-DTARGET_OS=${TARGET_OS}
|
||||
-DWEBRTC_PARENT_DIR:PATH=${CMAKE_BINARY_DIR}/webrtc)
|
||||
|
||||
if (WEBRTC_BRANCH_HEAD)
|
||||
set(_WEBRTC_CMAKE_ARGS ${_WEBRTC_CMAKE_ARGS} -DWEBRTC_BRANCH_HEAD=${WEBRTC_BRANCH_HEAD})
|
||||
endif (WEBRTC_BRANCH_HEAD)
|
||||
|
||||
if (WEBRTC_REVISION)
|
||||
set(_WEBRTC_CMAKE_ARGS ${_WEBRTC_CMAKE_ARGS} -DWEBRTC_REVISION=${WEBRTC_REVISION})
|
||||
endif (WEBRTC_REVISION)
|
||||
|
||||
ExternalProject_Add(
|
||||
webrtc-src
|
||||
|
||||
DEPENDS ${_NEXT_DEPENDS}
|
||||
GIT_REPOSITORY https://chromium.googlesource.com/external/webrtc
|
||||
|
||||
PREFIX ${CMAKE_BINARY_DIR}/webrtc
|
||||
BINARY_DIR ${CMAKE_BINARY_DIR}/webrtc/build
|
||||
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/webrtc/src
|
||||
SOURCE_DIR ${CMAKE_BINARY_DIR}/webrtc/src
|
||||
STAMP_DIR ${CMAKE_BINARY_DIR}/webrtc/stamp
|
||||
TMP_DIR ${CMAKE_BINARY_DIR}/webrtc/tmp
|
||||
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/webrtc/CMakeLists.txt.in ${CMAKE_BINARY_DIR}/webrtc/src/CMakeLists.txt
|
||||
UPDATE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
CMAKE_ARGS
|
||||
${_WEBRTC_CMAKE_ARGS}
|
||||
)
|
||||
|
||||
if (MSVC OR XCODE)
|
||||
set(_CONFIG $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:Release>$<$<CONFIG:MinSizeRel>:Release>)
|
||||
elseif (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(_CONFIG Debug)
|
||||
else (MSVC OR XCODE)
|
||||
set(_CONFIG Release)
|
||||
endif (MSVC OR XCODE)
|
||||
|
||||
ExternalProject_Add(
|
||||
libwebrtc
|
||||
DEPENDS webrtc-src
|
||||
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/libwebrtc
|
||||
BINARY_DIR ${CMAKE_BINARY_DIR}/libwebrtc
|
||||
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}
|
||||
-DCMAKE_MODULE_PATH:PATH=${CMAKE_MODULE_PATH}
|
||||
-DINSTALL_CMAKE_DIR:PATH=${CMAKE_BINARY_DIR}/lib/cmake/LibWebRTC
|
||||
-DTARGET_OS:STRING=${TARGET_OS}
|
||||
-DWEBRTC_OUTPUT_DIR:PATH=${CMAKE_BINARY_DIR}/webrtc/src/out/${_CONFIG}
|
||||
-DWEBRTC_SOURCE_DIR:PATH=${CMAKE_BINARY_DIR}/webrtc/src
|
||||
)
|
||||
|
||||
if (BUILD_SAMPLE)
|
||||
ExternalProject_Add(
|
||||
sample
|
||||
DEPENDS libwebrtc
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/sample
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
endif (BUILD_SAMPLE)
|
||||
|
||||
include(Install)
|
||||
include(Package)
|
||||
|
||||
export(PACKAGE LibWebRTC)
|
||||
add_subdirectory(libwebrtc)
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
if (HAS_OWN_DEPOT_TOOLS)
|
||||
return()
|
||||
endif (HAS_OWN_DEPOT_TOOLS)
|
||||
|
||||
include(LibWebRTCExecute)
|
||||
|
||||
if (WEBRTC_REVISION)
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci ${WEBRTC_REVISION}
|
||||
OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
STAMPFILE webrtc-revision-commit-date
|
||||
STATUS "Retrieving date for commit ${WEBRTC_REVISION}"
|
||||
ERROR "Unable to find webrtc commit date at ${WEBRTC_REVISION}"
|
||||
)
|
||||
elseif (WEBRTC_BRANCH_HEAD)
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci
|
||||
OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
STAMPFILE webrtc-branch-head-commit-date
|
||||
STATUS "Retrieving date for ${WEBRTC_BRANCH_HEAD}"
|
||||
ERROR "Unable to retrieve the commit date for ${WEBRTC_BRANCH_HEAD}"
|
||||
)
|
||||
else (WEBRTC_REVISION)
|
||||
message(FATAL_ERROR "-- Both WEBRTC_REVISION and WEBRTC_BRANCH_HEAD variables are undefined")
|
||||
endif (WEBRTC_REVISION)
|
||||
|
||||
string(STRIP ${_WEBRTC_COMMIT_DATE} _WEBRTC_COMMIT_DATE)
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-list -n 1 --before=\"${_WEBRTC_COMMIT_DATE}\" master
|
||||
OUTPUT_VARIABLE _DEPOT_TOOLS_COMMIT
|
||||
WORKING_DIRECTORY ${DEPOT_TOOLS_PATH}
|
||||
STAMPFILE webrtc-depot-tools-date
|
||||
STATUS "Retrieving depot_tools commit before ${_WEBRTC_COMMIT_DATE}"
|
||||
ERROR "Unable to find depot_tools commit before ${_WEBRTC_COMMIT_DATE}"
|
||||
)
|
||||
|
||||
string(STRIP ${_DEPOT_TOOLS_COMMIT} _DEPOT_TOOLS_COMMIT)
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} checkout ${_DEPOT_TOOLS_COMMIT}
|
||||
OUTPUT_VARIABLE _DEPOT_TOOLS_CHECKED_OUT
|
||||
WORKING_DIRECTORY ${DEPOT_TOOLS_PATH}
|
||||
STAMPFILE webrtc-depot-tools-checkout
|
||||
STATUS "Checking out depot_tools to commit ${_DEPOT_TOOLS_COMMIT}"
|
||||
ERROR "Unable to checkout depot_tools to commit ${_DEPOT_TOOLS_COMMIT}"
|
||||
)
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
if (ENVIRONMENT_INCLUDED)
|
||||
return()
|
||||
endif (ENVIRONMENT_INCLUDED)
|
||||
set(ENVIRONMENT_INCLUDED true)
|
||||
|
||||
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 ${DEPOT_TOOLS_PATH} $ENV{PATH})
|
||||
|
||||
get_filename_component(_CHROMIUM_PYTHONPATH
|
||||
"${CMAKE_SOURCE_DIR}/build"
|
||||
REALPATH)
|
||||
|
||||
if (WIN32)
|
||||
string(REGEX REPLACE "/" "\\\\" _WEBRTC_PATH "${_WEBRTC_PATH}")
|
||||
string(REGEX REPLACE "/" "\\\\" _CHROMIUM_PYTHONPATH "${_CHROMIUM_PYTHONPATH}")
|
||||
string(REGEX REPLACE ";" "\\\\\\\;" _WEBRTC_PATH "${_WEBRTC_PATH}")
|
||||
else (WIN32)
|
||||
string(REGEX REPLACE ";" ":" _WEBRTC_PATH "${_WEBRTC_PATH}")
|
||||
endif (WIN32)
|
||||
|
||||
set(_ENV
|
||||
PATH="${_WEBRTC_PATH}"
|
||||
PYTHONPATH="${_CHROMIUM_PYTHONPATH}"
|
||||
DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
DEPOT_TOOLS_UPDATE=0
|
||||
CHROME_HEADLESS=1)
|
||||
|
||||
set(PREFIX_EXECUTE ${CMAKE_COMMAND} -E env "${_ENV}")
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
find_program(GCLIENT_EXECUTABLE
|
||||
NAMES gclient gclient.bat
|
||||
DOC "Path to gclient executable"
|
||||
HINTS ${DEPOT_TOOLS_PATH} ENV DEPOT_TOOLS_PATH)
|
||||
|
||||
find_path(DEPOT_TOOLS_PATH
|
||||
NAMES gclient gclient.py gclient.bat
|
||||
ninja ninja.exe ninja-linux32 ninja-linux64 ninja-mac
|
||||
download_from_google_storage download_from_google_storage.bat
|
||||
download_from_google_storage.py
|
||||
DOC "Path to depot_tools directory"
|
||||
HINTS ${DEPOT_TOOLS_PATH} ENV DEPOT_TOOLS_PATH)
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||||
find_package_handle_standard_args(DepotTools
|
||||
REQUIRED_VARS GCLIENT_EXECUTABLE DEPOT_TOOLS_PATH
|
||||
FAIL_MESSAGE "Could not find depot_tools.")
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
file(WRITE ${WEBRTC_PARENT_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 ${WEBRTC_PARENT_DIR}/.gclient "target_os = [\"android\", \"unix\"]")
|
||||
elseif (TARGET_OS STREQUAL "ios")
|
||||
file(APPEND ${WEBRTC_PARENT_DIR}/.gclient "target_os = [\"ios\", \"mac\"]")
|
||||
elseif (TARGET_OS STREQUAL "linux")
|
||||
file(APPEND ${WEBRTC_PARENT_DIR}/.gclient "target_os = [\"unix\"]")
|
||||
elseif (TARGET_OS STREQUAL "mac")
|
||||
file(APPEND ${WEBRTC_PARENT_DIR}/.gclient "target_os = [\"mac\"]")
|
||||
elseif (TARGET_OS STREQUAL "win")
|
||||
file(APPEND ${WEBRTC_PARENT_DIR}/.gclient "target_os = [\"win\"]")
|
||||
endif (TARGET_OS STREQUAL "android")
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
set(_GEN_ARGS use_gold=false target_cpu=\\"${TARGET_CPU}\\" target_os=\\"${TARGET_OS}\\" is_component_build=false use_custom_libcxx=false use_custom_libcxx_for_host=false)
|
||||
|
||||
if (MSVC)
|
||||
set(_GEN_ARGS ${_GEN_ARGS} is_clang=false)
|
||||
set(_GEN_ARGS ${_GEN_ARGS} enable_iterator_debugging=$<$<CONFIG:Debug>:true>$<$<CONFIG:Release>:false>$<$<CONFIG:RelWithDebInfo>:false>$<$<CONFIG:MinSizeRel>:false>)
|
||||
endif(MSVC)
|
||||
|
||||
if (MSVC OR XCODE)
|
||||
set(_GEN_ARGS ${_GEN_ARGS} is_debug=$<$<CONFIG:Debug>:true>$<$<CONFIG:Release>:false>$<$<CONFIG:RelWithDebInfo>:false>$<$<CONFIG:MinSizeRel>:false>)
|
||||
set(_NINJA_BUILD_DIR out/$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:Release>$<$<CONFIG:MinSizeRel>:Release>)
|
||||
elseif (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(_GEN_ARGS ${_GEN_ARGS} is_debug=true)
|
||||
set(_NINJA_BUILD_DIR out/Debug)
|
||||
else (MSVC OR XCODE)
|
||||
set(_GEN_ARGS ${_GEN_ARGS} is_debug=false)
|
||||
set(_NINJA_BUILD_DIR out/Release)
|
||||
endif (MSVC OR XCODE)
|
||||
|
||||
if (GN_EXTRA_ARGS)
|
||||
set(_GEN_ARGS ${_GEN_ARGS} ${GN_EXTRA_ARGS})
|
||||
endif (GN_EXTRA_ARGS)
|
||||
|
||||
if (WIN32)
|
||||
set(_GN_EXECUTABLE gn.bat)
|
||||
else (WIN32)
|
||||
set(_GN_EXECUTABLE gn)
|
||||
endif (WIN32)
|
||||
|
||||
set(_GEN_COMMAND ${_GN_EXECUTABLE} gen ${_NINJA_BUILD_DIR} --args=\"${_GEN_ARGS}\")
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
#
|
||||
# Install library
|
||||
file(GLOB_RECURSE _LIBRARY_FILES
|
||||
${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})
|
||||
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})
|
||||
|
||||
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(SCRIPT ${CMAKE_MODULE_PATH}/PatchCMakeTargets.cmake
|
||||
COMPONENT cmake)
|
||||
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,30 +0,0 @@
|
|||
if(LIBWEBRTC_COMMAND_INCLUDED)
|
||||
return()
|
||||
endif(LIBWEBRTC_COMMAND_INCLUDED)
|
||||
set(LIBWEBRTC_COMMAND_INCLUDED true)
|
||||
|
||||
include(CMakeParseArguments)
|
||||
include(Environment)
|
||||
|
||||
function(libwebrtc_command)
|
||||
set(ONE_VALUE_ARGS NAME COMMENT WORKING_DIRECTORY)
|
||||
set(MULTI_VALUE_ARGS COMMAND DEPENDS)
|
||||
cmake_parse_arguments(COMMAND "" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN} )
|
||||
|
||||
set(CMF_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
|
||||
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})
|
||||
|
||||
if (COMMAND_DEPENDS)
|
||||
add_dependencies(${COMMAND_NAME} ${COMMAND_DEPENDS})
|
||||
endif (COMMAND_DEPENDS)
|
||||
endfunction()
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
if (LIBWEBRTC_EXECUTE_INCLUDED)
|
||||
return()
|
||||
endif (LIBWEBRTC_EXECUTE_INCLUDED)
|
||||
set(LIBWEBRTC_EXECUTE_INCLUDED true)
|
||||
|
||||
include(CMakeParseArguments)
|
||||
include(Environment)
|
||||
|
||||
function (libwebrtc_execute)
|
||||
set(ONE_VALUE_ARGS OUTPUT_VARIABLE WORKING_DIRECTORY STAMPFILE STATUS ERROR)
|
||||
set(MULTI_VALUE_ARGS COMMAND)
|
||||
cmake_parse_arguments(COMMAND "" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN})
|
||||
|
||||
set(CMF_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
|
||||
|
||||
if (COMMAND_STAMPFILE)
|
||||
set(STAMP_FILE "${CMF_DIR}/${COMMAND_STAMPFILE}")
|
||||
|
||||
if (EXISTS ${STAMP_FILE})
|
||||
if (COMMAND_OUTPUT_VARIABLE)
|
||||
file(READ ${STAMP_FILE} _OUTPUT)
|
||||
|
||||
if (_OUTPUT)
|
||||
set(${COMMAND_OUTPUT_VARIABLE} ${_OUTPUT} PARENT_SCOPE)
|
||||
endif (_OUTPUT)
|
||||
endif (COMMAND_OUTPUT_VARIABLE)
|
||||
|
||||
return()
|
||||
endif (EXISTS ${STAMP_FILE})
|
||||
endif (COMMAND_STAMPFILE)
|
||||
|
||||
if (COMMAND_STATUS)
|
||||
message(STATUS ${COMMAND_STATUS})
|
||||
endif (COMMAND_STATUS)
|
||||
|
||||
execute_process(COMMAND ${COMMAND_COMMAND}
|
||||
WORKING_DIRECTORY ${COMMAND_WORKING_DIRECTORY}
|
||||
OUTPUT_VARIABLE _OUTPUT
|
||||
RESULT_VARIABLE _RESULT)
|
||||
|
||||
if (NOT _RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "-- " ${COMMAND_ERROR})
|
||||
endif (NOT _RESULT EQUAL 0)
|
||||
|
||||
if (COMMAND_STAMPFILE)
|
||||
file(WRITE ${STAMP_FILE} ${_OUTPUT})
|
||||
endif (COMMAND_STAMPFILE)
|
||||
|
||||
if (COMMAND_OUTPUT_VARIABLE)
|
||||
set(${COMMAND_OUTPUT_VARIABLE} ${_OUTPUT} PARENT_SCOPE)
|
||||
endif (COMMAND_OUTPUT_VARIABLE)
|
||||
endfunction ()
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#
|
||||
# Options, flags
|
||||
option(BUILD_SAMPLE "Build sample" OFF)
|
||||
set(DEPOT_TOOLS_PATH "" CACHE STRING "Path to your own depot_tools directory")
|
||||
set(NINJA_ARGS "" CACHE STRING "Ninja arguments to pass before compiling WebRTC")
|
||||
set(GN_EXTRA_ARGS "" CACHE STRING "Extra gn gen arguments to pass before generating build files")
|
||||
set(WEBRTC_REVISION "" CACHE STRING "WebRTC commit hash to checkout")
|
||||
set(WEBRTC_BRANCH_HEAD "${LIBWEBRTC_WEBRTC_HEAD}" CACHE STRING "WebRTC branch head to checkout")
|
||||
|
||||
if (DEPOT_TOOLS_PATH)
|
||||
set(HAS_OWN_DEPOT_TOOLS 1)
|
||||
endif (DEPOT_TOOLS_PATH)
|
||||
|
||||
#
|
||||
# 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,86 +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_DEBIAN_PACKAGE_ARCHITECTURE "${_PACKAGE_ARCH}")
|
||||
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_RPM_PACKAGE_ARCHITECTURE "${_PACKAGE_ARCH}")
|
||||
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)
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}-debug)
|
||||
endif (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
|
||||
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,6 +0,0 @@
|
|||
|
||||
set(TARGET_FILE ${CMAKE_BINARY_DIR}/lib/cmake/LibWebRTC/LibWebRTCTargets.cmake)
|
||||
|
||||
file(READ ${TARGET_FILE} filedata)
|
||||
string(REGEX REPLACE ${CMAKE_BINARY_DIR} ${CMAKE_INSTALL_PREFIX} filedata "${filedata}")
|
||||
file(WRITE ${TARGET_FILE} "${filedata}")
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
set(TARGET_FILE ${CMAKE_ARGV3})
|
||||
|
||||
file(READ ${TARGET_FILE} filedata)
|
||||
string(REGEX REPLACE ":static_crt" ":dynamic_crt" filedata "${filedata}")
|
||||
file(WRITE ${TARGET_FILE} "${filedata}")
|
||||
|
|
@ -1,10 +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@ @LIBWEBRTC_PC_LIBS_PRIVATE@
|
||||
Cflags: -I${includedir} @LIBWEBRTC_PC_DEFINITIONS@ @LIBWEBRTC_PC_CXXFLAGS@
|
||||
|
|
@ -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,23 +0,0 @@
|
|||
include(LibWebRTCExecute)
|
||||
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=-dirty
|
||||
OUTPUT_VARIABLE _LIBWEBRTC_TAG
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
STAMPFILE webrtc-current-tag
|
||||
STATUS "Retrieving current git tag"
|
||||
ERROR "Unable to retrieve the current git tag"
|
||||
)
|
||||
string(STRIP ${_LIBWEBRTC_TAG} _LIBWEBRTC_TAG)
|
||||
|
||||
string(REGEX REPLACE "^v?([0-9]+)\\..*" "\\1" LIBWEBRTC_MAJOR_VERSION "${_LIBWEBRTC_TAG}")
|
||||
string(REGEX REPLACE "^v?[0-9]+\\.([0-9]+).*" "\\1" LIBWEBRTC_MINOR_VERSION "${_LIBWEBRTC_TAG}")
|
||||
string(REGEX REPLACE "^v?[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" LIBWEBRTC_PATCH_VERSION "${_LIBWEBRTC_TAG}")
|
||||
string(REGEX REPLACE "^v?[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" LIBWEBRTC_BUILD_VERSION "${_LIBWEBRTC_TAG}")
|
||||
|
||||
set(LIBWEBRTC_API_VERSION
|
||||
"${LIBWEBRTC_MAJOR_VERSION}.${LIBWEBRTC_MINOR_VERSION}.${LIBWEBRTC_PATCH_VERSION}")
|
||||
set(LIBWEBRTC_VERSION
|
||||
${LIBWEBRTC_API_VERSION}${LIBWEBRTC_BUILD_VERSION})
|
||||
|
||||
set(LIBWEBRTC_WEBRTC_HEAD refs/branch-heads/4103)
|
||||
133
README.md
133
README.md
|
|
@ -4,7 +4,7 @@ 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
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
project(sample)
|
||||
|
||||
find_package(LibWebRTC REQUIRED)
|
||||
|
|
@ -17,7 +17,7 @@ target_link_libraries(sample ${LIBWEBRTC_LIBRARIES})
|
|||
|
||||
## Prerequisites
|
||||
|
||||
- CMake 3.3 or later
|
||||
- CMake 3.9 or later
|
||||
- Python 2.7 (optional for Windows since it will use the interpreter located
|
||||
inside the `depot_tools` installation)
|
||||
|
||||
|
|
@ -54,14 +54,26 @@ target_link_libraries(sample ${LIBWEBRTC_LIBRARIES})
|
|||
[Windows Driver Kit 10][wdk10] installed in the same Windows 10 SDK
|
||||
installation directory.
|
||||
|
||||
## Compiling
|
||||
|
||||
Clone the repository, create an output directory, browse inside it,
|
||||
then run CMake to configure project.
|
||||
## 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
|
||||
|
||||
# Linux
|
||||
./sync.sh [WEBRTC_VERSION]
|
||||
|
||||
# Windows
|
||||
sync.bat [WEBRTC_VERSION]
|
||||
```
|
||||
|
||||
## Compiling
|
||||
|
||||
Create an output directory, browse inside it, then run CMake to configure project.
|
||||
|
||||
```
|
||||
git clone https://github.com/UltraCoderRU/libwebrtc-build.git
|
||||
cd libwebrtc-build
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
|
|
@ -103,48 +115,12 @@ while configuring your project:
|
|||
cmake -DCMAKE_PREFIX_PATH=<install_path> ...
|
||||
```
|
||||
|
||||
## Fetching a specific revision
|
||||
|
||||
The latest working release will be fetched by default, unless you decide to
|
||||
retrieve a specific commit by setting it's hash into the **WEBRTC_REVISION**
|
||||
CMake variable, or another branch head ref into the **WEBRTC_BRANCH_HEAD**
|
||||
variable.
|
||||
|
||||
```
|
||||
cmake -DWEBRTC_REVISION=be22d51 ..
|
||||
cmake -DWEBRTC_BRANCH_HEAD=refs/branch-heads/4103 ..
|
||||
```
|
||||
|
||||
If both variables are set, it will focus on fetching the commit defined inside
|
||||
**WEBRTC_REVISION**.
|
||||
|
||||
## 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 unit tests and mocked classes such as `FakeAudioCaptureModule`.
|
||||
|
||||
- **BUILD_SAMPLE**
|
||||
|
||||
Build an executable located inside the `sample` folder.
|
||||
|
||||
- **DEPOT_TOOLS_PATH**
|
||||
|
||||
Set this variable to your own `depot_tools` directory. This will prevent
|
||||
CMake from fetching the one matching with the desired WebRTC revision.
|
||||
|
||||
- **GN_EXTRA_ARGS**
|
||||
|
||||
Add extra arguments to the `gn gen --args` parameter.
|
||||
|
|
@ -153,39 +129,6 @@ perform cross-compiling.
|
|||
|
||||
Arguments to pass while executing the `ninja` command.
|
||||
|
||||
- **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`
|
||||
|
||||
- **WEBRTC_BRANCH_HEAD**
|
||||
|
||||
Set the branch head ref to retrieve, it is set to the latest working one.
|
||||
This variable is ignored if **WEBRTC_REVISION** is set.
|
||||
|
||||
- **WEBRTC_REVISION**
|
||||
|
||||
Set a specific commit hash to check-out.
|
||||
|
||||
## Status
|
||||
|
||||
The following table displays the current state of this project, including
|
||||
|
|
@ -195,19 +138,12 @@ 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 align="center">-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="center">macOS</th>
|
||||
<td align="center">-</td>
|
||||
<td align="center">✔</td>
|
||||
<td align="center">-</td>
|
||||
|
|
@ -215,8 +151,29 @@ supported platforms and architectures.
|
|||
</tr>
|
||||
<tr>
|
||||
<th align="center">Windows</th>
|
||||
<td align="center">-</td>
|
||||
<td align="center">✔</td>
|
||||
<td align="center">✔</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>
|
||||
|
|
@ -229,14 +186,12 @@ Many thanks to Dr. Alex Gouaillard for being an excellent mentor for this
|
|||
project.
|
||||
|
||||
Everything started from his
|
||||
« [Automating libwebrtc build with CMake][webrtc-dr-alex-cmake] » blog article,
|
||||
«[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
|
||||
[osx1011sdk]: https://github.com/phracker/MacOSX-SDKs/releases/download/MacOSX10.11.sdk/MacOSX10.11.sdk.tar.xz
|
||||
[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
|
||||
[author]:https://axel.isouard.fr
|
||||
|
|
|
|||
39
appveyor.yml
39
appveyor.yml
|
|
@ -1,39 +0,0 @@
|
|||
image: Visual Studio 2017
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
platform:
|
||||
- x86
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
- Debug
|
||||
|
||||
clone_folder: c:\projects\libwebrtc
|
||||
|
||||
before_build:
|
||||
- cmd: set GYP_MSVS_VERSION=2017
|
||||
- cd c:\projects\libwebrtc
|
||||
- if "%platform%"=="x86" set CMAKE_GENERATOR_NAME=Visual Studio 15 2017
|
||||
- if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 15 2017 Win64
|
||||
- cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% -DWEBRTC_BRANCH_HEAD=refs/branch-heads/4103 -DCMAKE_INSTALL_PREFIX=c:\projects\libwebrtc .
|
||||
|
||||
build:
|
||||
project: PACKAGE.vcxproj
|
||||
|
||||
artifacts:
|
||||
- path: libwebrtc-*.zip
|
||||
name: Releases
|
||||
|
||||
deploy:
|
||||
provider: GitHub
|
||||
auth_token:
|
||||
secure: QQrYk1F7DLgQ9eht+J6hvDiDRu8a+AKKwsOetybrL8B32UYxlNJKSZIpD0yHPVsx
|
||||
artifact: /libwebrtc-.*\.zip/
|
||||
draft: false
|
||||
prerelease: false
|
||||
on:
|
||||
appveyor_repo_tag: true
|
||||
|
||||
test: off
|
||||
59
cmake/AddWebRTCTarget.cmake
Normal file
59
cmake/AddWebRTCTarget.cmake
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
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_custom_libcxx=false use_custom_libcxx_for_host=false rtc_enable_protobuf=false")
|
||||
|
||||
if (MSVC)
|
||||
set(GEN_ARGS_COMMON "${GEN_ARGS_COMMON} is_clang=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 ()
|
||||
|
||||
if (MSVC)
|
||||
# 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 ()
|
||||
execute_process(COMMAND ${GN_EXECUTABLE} gen ${BUILD_DIR}/Debug "--args=${GEN_ARGS}" WORKING_DIRECTORY ${SOURCE_DIR})
|
||||
|
||||
# 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 ()
|
||||
execute_process(COMMAND ${GN_EXECUTABLE} gen ${BUILD_DIR}/Release "--args=${GEN_ARGS}" WORKING_DIRECTORY ${SOURCE_DIR})
|
||||
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 ()
|
||||
execute_process(COMMAND ${GN_EXECUTABLE} gen ${BUILD_DIR} "--args=${GEN_ARGS}" WORKING_DIRECTORY ${SOURCE_DIR})
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
add_custom_target(webrtc-build ALL ninja -C "${BUILD_DIR}/$<CONFIG>" :webrtc jsoncpp libyuv)
|
||||
add_custom_target(webrtc-clean ${GN_EXECUTABLE} clean "${BUILD_DIR}/$<CONFIG>" WORKING_DIRECTORY ${SOURCE_DIR})
|
||||
else ()
|
||||
add_custom_target(webrtc-build ALL ninja -C "${BUILD_DIR}" :webrtc jsoncpp libyuv)
|
||||
add_custom_target(webrtc-clean ${GN_EXECUTABLE} clean "${BUILD_DIR}" WORKING_DIRECTORY ${SOURCE_DIR})
|
||||
endif ()
|
||||
|
||||
endfunction()
|
||||
|
|
@ -10,8 +10,8 @@ if (UNIX AND NOT APPLE)
|
|||
find_package(Threads REQUIRED)
|
||||
if (CMAKE_HAVE_THREADS_LIBRARY)
|
||||
list(APPEND LIBWEBRTC_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif (CMAKE_HAVE_THREADS_LIBRARY)
|
||||
endif (UNIX AND NOT APPLE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
||||
|
|
@ -22,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
|
||||
crypt32.lib iphlpapi.lib ole32.lib secur32.lib winmm.lib ws2_32.lib)
|
||||
endif (WIN32)
|
||||
endif ()
|
||||
7
cmake/PatchFile.cmake
Normal file
7
cmake/PatchFile.cmake
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
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()
|
||||
|
|
@ -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,16 +55,17 @@ 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 WEBRTC_MAC)
|
||||
endif (APPLE)
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS_DEBUG WEBRTC_MAC)
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS_RELEASE ${LIBWEBRTC_DEFINITIONS_DEBUG})
|
||||
endif ()
|
||||
|
||||
if (UNIX)
|
||||
if (TARGET_CPU STREQUAL "x86")
|
||||
|
|
@ -79,16 +78,15 @@ if (UNIX)
|
|||
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "${LIBWEBRTC_REQUIRED_CXX_FLAGS} -pthread")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS _GLIBCXX_DEBUG=1 _DEBUG=1)
|
||||
endif (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS WEBRTC_POSIX)
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS_DEBUG WEBRTC_POSIX _DEBUG=1)
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS_RELEASE WEBRTC_POSIX)
|
||||
elseif (WIN32)
|
||||
set(LIBWEBRTC_REQUIRED_C_FLAGS_DEBUG "/MDd")
|
||||
set(LIBWEBRTC_REQUIRED_C_FLAGS_RELEASE "/MD")
|
||||
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG "/MDd")
|
||||
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE "/MD")
|
||||
list(APPEND LIBWEBRTC_DEFINITIONS WEBRTC_WIN NOMINMAX _CRT_SECURE_NO_WARNINGS)
|
||||
endif (UNIX)
|
||||
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})")
|
||||
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,27 +0,0 @@
|
|||
if (DEPOT_TOOLS_PATH)
|
||||
return()
|
||||
endif (DEPOT_TOOLS_PATH)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
if (WIN32)
|
||||
set(GCLIENT_EXECUTABLE ${CMAKE_BINARY_DIR}/depot_tools/gclient.bat)
|
||||
else (WIN32)
|
||||
set(GCLIENT_EXECUTABLE ${CMAKE_BINARY_DIR}/depot_tools/gclient)
|
||||
endif (WIN32)
|
||||
|
||||
ExternalProject_Add(
|
||||
depot-tools
|
||||
|
||||
GIT_REPOSITORY https://chromium.googlesource.com/chromium/tools/depot_tools
|
||||
|
||||
PREFIX ${CMAKE_BINARY_DIR}/depot_tools
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
PATCH_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
set(_NEXT_DEPENDS depot-tools)
|
||||
|
|
@ -1,94 +1,83 @@
|
|||
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/modules/audio_coding/delay_test/utility${_OBJ_EXT}
|
||||
${WEBRTC_OUTPUT_DIR}/obj/webrtc/modules/modules_tests/utility${_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 ()
|
||||
|
||||
set(CMAKE_DEBUG_POSTFIX d)
|
||||
|
||||
add_library(webrtc STATIC ${_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)
|
||||
# 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)
|
||||
configure_file(LibWebRTCTargets.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCTargets.cmake @ONLY)
|
||||
|
||||
######################
|
||||
# INSTALL SECTION
|
||||
######################
|
||||
|
||||
# Install headers
|
||||
install(FILES "${WEBRTC_SOURCE_DIR}/common_types.h" DESTINATION "include/webrtc")
|
||||
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"
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
"${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"
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
if (EXISTS "${WEBRTC_SOURCE_DIR}/common_types.h")
|
||||
install(FILES "${WEBRTC_SOURCE_DIR}/common_types.h" DESTINATION "include/webrtc")
|
||||
endif ()
|
||||
|
||||
install(DIRECTORY "${WEBRTC_SOURCE_DIR}/third_party/jsoncpp"
|
||||
DESTINATION "include/webrtc/third_party"
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
DESTINATION "include/webrtc/third_party"
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
install(DIRECTORY "${WEBRTC_SOURCE_DIR}/third_party/libyuv"
|
||||
DESTINATION "include/webrtc/third_party"
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
DESTINATION "include/webrtc/third_party"
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
install(DIRECTORY "${WEBRTC_SOURCE_DIR}/third_party/abseil-cpp/absl"
|
||||
DESTINATION "include/webrtc"
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
DESTINATION "include/webrtc"
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
# Install pdb files
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
file(GLOB_RECURSE PDB_FILES [${WEBRTC_OUTPUT_DIR} "*.pdb")
|
||||
install(FILES ${PDB_FILES} DESTINATION lib)
|
||||
if (MSVC)
|
||||
# TODO: fix install on first run
|
||||
file(GLOB_RECURSE PDB_FILES "${WEBRTC_BUILD_DIR}/Debug/*.pdb")
|
||||
install(FILES DESTINATION lib CONFIGURATIONS Debug)
|
||||
endif()
|
||||
|
||||
# Install library
|
||||
install(TARGETS webrtc
|
||||
EXPORT LibWebRTCTargets
|
||||
ARCHIVE DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
INCLUDES DESTINATION include)
|
||||
if (MSVC)
|
||||
install(FILES ${WEBRTC_BUILD_DIR}/Debug/obj/webrtc.lib DESTINATION lib RENAME "webrtcd.lib" CONFIGURATIONS Debug)
|
||||
install(FILES ${WEBRTC_BUILD_DIR}/Release/obj/webrtc.lib DESTINATION lib RENAME "webrtc.lib" CONFIGURATIONS Release)
|
||||
else ()
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install(FILES ${WEBRTC_BUILD_DIR}/obj/libwebrtc.a DESTINATION lib RENAME "libwebrtcd.a")
|
||||
else ()
|
||||
install(FILES ${WEBRTC_BUILD_DIR}/obj/libwebrtc.a DESTINATION lib RENAME "libwebrtc.a")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
install(EXPORT LibWebRTCTargets
|
||||
FILE LibWebRTCTargets.cmake
|
||||
DESTINATION ${INSTALL_CMAKE_DIR})
|
||||
install(FILES
|
||||
UseLibWebRTC.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfig.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfigVersion.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCTargets.cmake
|
||||
DESTINATION "lib/cmake/LibWebRTC"
|
||||
)
|
||||
|
||||
install(FILES ${CMAKE_MODULE_PATH}/Templates/UseLibWebRTC.cmake
|
||||
DESTINATION ${INSTALL_CMAKE_DIR})
|
||||
if (MSVC)
|
||||
install(FILES LibWebRTCTargets-debug.cmake DESTINATION "lib/cmake/LibWebRTC" CONFIGURATIONS Debug)
|
||||
install(FILES LibWebRTCTargets-release.cmake DESTINATION "lib/cmake/LibWebRTC" CONFIGURATIONS Release)
|
||||
else ()
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install(FILES LibWebRTCTargets-debug.cmake DESTINATION "lib/cmake/LibWebRTC")
|
||||
else ()
|
||||
install(FILES LibWebRTCTargets-release.cmake DESTINATION "lib/cmake/LibWebRTC")
|
||||
endif ()
|
||||
endif ()
|
||||
|
|
|
|||
|
|
@ -8,39 +8,19 @@
|
|||
# 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_WEBRTC_BRANCH_HEAD - WebRTC's Git branch head refspec used for that release
|
||||
# LIBWEBRTC_API_VERSION - full version without build prefix
|
||||
# LIBWEBRTC_VERSION - full version with build prefix
|
||||
# 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
|
||||
|
||||
# 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_API_VERSION "@LIBWEBRTC_API_VERSION@")
|
||||
set(LIBWEBRTC_VERSION "@LIBWEBRTC_VERSION@")
|
||||
set(LIBWEBRTC_WEBRTC_REVISION "@WEBRTC_REVISION@")
|
||||
set(LIBWEBRTC_WEBRTC_BRANCH_HEAD "@WEBRTC_BRANCH_HEAD@")
|
||||
# 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@")
|
||||
|
||||
# Include directory
|
||||
set(LIBWEBRTC_INCLUDE_DIRS "@INSTALL_INCLUDE_DIR@/webrtc")
|
||||
|
||||
# Libraries directory
|
||||
set(LIBWEBRTC_LIBRARY_DIRS "@INSTALL_LIB_DIR@")
|
||||
|
||||
# Set the expected libraries variable
|
||||
set(LIBWEBRTC_LIBRARIES @LIBWEBRTC_LIBRARIES@)
|
||||
|
||||
|
|
@ -52,10 +32,11 @@ 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 "@LIBWEBRTC_DEFINITIONS@")
|
||||
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 "@INSTALL_CMAKE_DIR@")
|
||||
set(LIBWEBRTC_CMAKE_DIR "@CMAKE_INSTALL_PREFIX@/lib/cmake/LibWebRTC")
|
||||
set(LIBWEBRTC_USE_FILE "${LIBWEBRTC_CMAKE_DIR}/UseLibWebRTC.cmake")
|
||||
|
||||
# Import LibWebRTC targets.
|
||||
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.in
Normal file
83
libwebrtc/LibWebRTCTargets.cmake.in
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.
|
||||
set(_IMPORT_PREFIX "@CMAKE_INSTALL_PREFIX@")
|
||||
|
||||
# Create imported target webrtc
|
||||
add_library(webrtc STATIC IMPORTED)
|
||||
|
||||
set_target_properties(webrtc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/webrtc"
|
||||
)
|
||||
|
||||
# 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 ()
|
||||
|
|
@ -26,10 +28,11 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${LIBWEBRTC_REQUIRED_CXX
|
|||
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 ()
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.3)
|
||||
project(sample)
|
||||
|
||||
find_package(LibWebRTC REQUIRED)
|
||||
include(${LIBWEBRTC_USE_FILE})
|
||||
|
||||
set(SOURCE_FILES main.cpp)
|
||||
add_executable(sample ${SOURCE_FILES})
|
||||
target_link_libraries(sample ${LIBWEBRTC_LIBRARIES})
|
||||
|
||||
set(_STAMP_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/check-sample-done)
|
||||
add_custom_command(
|
||||
OUTPUT ${_STAMP_FILE}
|
||||
COMMENT "Run generated sample"
|
||||
COMMAND sample
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${_STAMP_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(check-sample ALL DEPENDS ${_STAMP_FILE})
|
||||
add_dependencies(check-sample sample)
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Axel Isouard <axel@isouard.fr>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <webrtc/api/peerconnectioninterface.h>
|
||||
#include <webrtc/base/ssladapter.h>
|
||||
#include <webrtc/base/thread.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <webrtc/base/win32socketinit.h>
|
||||
#include <webrtc/base/win32socketserver.h>
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#ifdef WIN32
|
||||
rtc::EnsureWinsockInit();
|
||||
rtc::Win32Thread w32_thread;
|
||||
rtc::ThreadManager::Instance()->SetCurrentThread(&w32_thread);
|
||||
#endif
|
||||
|
||||
rtc::InitializeSSL();
|
||||
rtc::InitRandom(rtc::Time());
|
||||
rtc::ThreadManager::Instance()->WrapCurrentThread();
|
||||
|
||||
rtc::Thread *signalingThread = new rtc::Thread();
|
||||
rtc::Thread *workerThread = new rtc::Thread();
|
||||
|
||||
signalingThread->SetName("signaling_thread", NULL);
|
||||
workerThread->SetName("worker_thread", NULL);
|
||||
|
||||
if (!signalingThread->Start() || !workerThread->Start()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pcFactory =
|
||||
webrtc::CreatePeerConnectionFactory(signalingThread,
|
||||
workerThread,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
pcFactory = NULL;
|
||||
|
||||
if (rtc::ThreadManager::Instance()->CurrentThread() == signalingThread) {
|
||||
rtc::ThreadManager::Instance()->SetCurrentThread(NULL);
|
||||
}
|
||||
|
||||
signalingThread->Stop();
|
||||
workerThread->Stop();
|
||||
|
||||
delete signalingThread;
|
||||
delete workerThread;
|
||||
|
||||
rtc::CleanupSSL();
|
||||
return 0;
|
||||
}
|
||||
37
sync.bat
Normal file
37
sync.bat
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
@echo off
|
||||
|
||||
REM To determine last stable WebRTC revision,
|
||||
REM see https://chromiumdash.appspot.com/branches
|
||||
REM and https://chromiumdash.appspot.com/schedule
|
||||
set WEBRTC_REVISION=4280
|
||||
|
||||
if not "%1"=="" set WEBRTC_REVISION="%1"
|
||||
|
||||
set REPO_ROOT=%~dp0
|
||||
set PATH=%REPO_ROOT%depot_tools;%PATH%
|
||||
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
|
||||
cd %REPO_ROOT%
|
||||
if not exist "depot_tools" (
|
||||
echo Cloning Depot Tools...
|
||||
git.exe clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
)
|
||||
|
||||
echo Updating Depot Tools...
|
||||
cd %REPO_ROOT%\depot_tools
|
||||
call update_depot_tools.bat
|
||||
|
||||
cd %REPO_ROOT%
|
||||
if not exist "webrtc" (
|
||||
echo Cloning WebRTC...
|
||||
mkdir webrtc
|
||||
cd webrtc
|
||||
fetch --nohooks --no-history webrtc
|
||||
)
|
||||
|
||||
echo Updating WebRTC to version %WEBRTC_REVISION%...
|
||||
cd %REPO_ROOT%\webrtc\src
|
||||
git.exe checkout -B %WEBRTC_REVISION% branch-heads/%WEBRTC_REVISION%
|
||||
call gclient sync --force -D
|
||||
|
||||
cd %REPO_ROOT%
|
||||
39
sync.sh
Executable file
39
sync.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# To determine last stable WebRTC revision,
|
||||
# see https://chromiumdash.appspot.com/branches
|
||||
# and https://chromiumdash.appspot.com/schedule
|
||||
WEBRTC_REVISION=4280
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
WEBRTC_REVISION=$1
|
||||
fi
|
||||
|
||||
REPO_ROOT=$(dirname $(readlink -f $0))
|
||||
export PATH=${REPO_ROOT}/depot_tools:$PATH
|
||||
|
||||
cd ${REPO_ROOT}
|
||||
if [ ! -d depot_tools ];
|
||||
then
|
||||
echo "Cloning Depot Tools..."
|
||||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
fi
|
||||
|
||||
echo "Updating Depot Tools..."
|
||||
cd ${REPO_ROOT}/depot_tools
|
||||
./update_depot_tools
|
||||
|
||||
cd ${REPO_ROOT}
|
||||
if [ ! -d webrtc ];
|
||||
then
|
||||
echo "Cloning WebRTC..."
|
||||
mkdir webrtc
|
||||
cd webrtc
|
||||
fetch --nohooks --no-history webrtc
|
||||
fi
|
||||
|
||||
echo "Updating WebRTC to version ${WEBRTC_REVISION}..."
|
||||
cd ${REPO_ROOT}/webrtc/src
|
||||
git checkout -B ${WEBRTC_REVISION} branch-heads/${WEBRTC_REVISION}
|
||||
gclient sync --force -D
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.3)
|
||||
project(webrtc)
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
if (WIN32)
|
||||
set(PYTHON_EXECUTABLE ${DEPOT_TOOLS_PATH}/python.bat)
|
||||
else (WIN32)
|
||||
find_package(PythonInterp 2.7 REQUIRED)
|
||||
endif (WIN32)
|
||||
|
||||
include(LibWebRTCExecute)
|
||||
|
||||
if (WEBRTC_REVISION)
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} checkout ${WEBRTC_REVISION}
|
||||
OUTPUT_VARIABLE _WEBRTC_CHECKOUT
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
STAMPFILE webrtc-checkout-commit
|
||||
STATUS "Checking out webrtc to commit ${WEBRTC_REVISION}"
|
||||
ERROR "Unable to checkout webrtc to commit ${WEBRTC_REVISION}"
|
||||
)
|
||||
elseif (WEBRTC_BRANCH_HEAD)
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch +refs/branch-heads/*:refs/remotes/branch-heads/* ^\\+refs/branch-heads/\\*:.*$
|
||||
OUTPUT_VARIABLE _WEBRTC_CONFIG_FETCH
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
STAMPFILE webrtc-config-fetch
|
||||
STATUS "Setting up branch-heads refspecs"
|
||||
ERROR "Unable to add branch-heads refspec to the git config"
|
||||
)
|
||||
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} fetch origin ${WEBRTC_BRANCH_HEAD}
|
||||
OUTPUT_VARIABLE _WEBRTC_FETCH
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
STAMPFILE webrtc-fetch-branch-heads
|
||||
STATUS "Fetching ${WEBRTC_BRANCH_HEAD}"
|
||||
ERROR "Unable to fetch ${WEBRTC_BRANCH_HEAD}"
|
||||
)
|
||||
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} checkout FETCH_HEAD
|
||||
OUTPUT_VARIABLE _WEBRTC_CHECKOUT
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
STAMPFILE webrtc-checkout-branch-head
|
||||
STATUS "Checking out ${WEBRTC_BRANCH_HEAD}"
|
||||
ERROR "Unable to checkout ${WEBRTC_BRANCH_HEAD}"
|
||||
)
|
||||
endif (WEBRTC_REVISION)
|
||||
|
||||
include(DepotTools)
|
||||
include(GClient)
|
||||
include(Environment)
|
||||
include(LibWebRTCCommand)
|
||||
|
||||
libwebrtc_command(
|
||||
NAME webrtc-sync
|
||||
COMMAND ${GCLIENT_EXECUTABLE} sync --force
|
||||
WORKING_DIRECTORY "${WEBRTC_PARENT_DIR}"
|
||||
COMMENT "Synchronizing WebRTC"
|
||||
)
|
||||
|
||||
libwebrtc_command(
|
||||
NAME webrtc-clang
|
||||
COMMAND ${PYTHON_EXECUTABLE} src/tools/clang/scripts/update.py
|
||||
WORKING_DIRECTORY "${WEBRTC_PARENT_DIR}"
|
||||
COMMENT "Updating clang"
|
||||
DEPENDS webrtc-sync
|
||||
)
|
||||
set(_DEPENDENCIES webrtc-clang)
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
set(SYSROOT_ARCH ${TARGET_CPU})
|
||||
|
||||
if (SYSROOT_ARCH STREQUAL "x64")
|
||||
set(SYSROOT_ARCH "amd64")
|
||||
elseif (SYSROOT_ARCH STREQUAL "x86")
|
||||
set(SYSROOT_ARCH "i386")
|
||||
endif (SYSROOT_ARCH STREQUAL "x64")
|
||||
|
||||
libwebrtc_command(
|
||||
NAME webrtc-toolchain
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${WEBRTC_PARENT_DIR}/src/build/linux/sysroot_scripts/install-sysroot.py --arch=${SYSROOT_ARCH}
|
||||
WORKING_DIRECTORY "${WEBRTC_PARENT_DIR}"
|
||||
COMMENT "Retrieving sysroot"
|
||||
DEPENDS webrtc-sync
|
||||
)
|
||||
set(_DEPENDENCIES ${_DEPENDENCIES} webrtc-toolchain)
|
||||
|
||||
set(_PLATFORM linux*)
|
||||
set(_FOLDER linux64)
|
||||
elseif (APPLE)
|
||||
set(_PLATFORM darwin)
|
||||
set(_FOLDER mac)
|
||||
elseif (WIN32)
|
||||
libwebrtc_command(
|
||||
NAME webrtc-toolchain
|
||||
COMMAND ${PYTHON_EXECUTABLE} src/build/vs_toolchain.py update
|
||||
WORKING_DIRECTORY "${WEBRTC_PARENT_DIR}"
|
||||
COMMENT "Retrieving Visual Studio toolchain"
|
||||
DEPENDS webrtc-sync
|
||||
)
|
||||
set(_DEPENDENCIES ${_DEPENDENCIES} webrtc-toolchain)
|
||||
|
||||
set(_PLATFORM win32)
|
||||
set(_FOLDER win)
|
||||
set(_SUFFIX .exe)
|
||||
set(_SCRIPT_SUFFIX .bat)
|
||||
endif (UNIX AND NOT APPLE)
|
||||
|
||||
set(_GN_COMMAND download_from_google_storage${_SCRIPT_SUFFIX} --no_resume --platform=${_PLATFORM}
|
||||
--no_auth --bucket chromium-gn
|
||||
-s src/buildtools/${_FOLDER}/gn${_SUFFIX}.sha1)
|
||||
|
||||
#libwebrtc_command(
|
||||
#NAME webrtc-gn
|
||||
#COMMAND ${_GN_COMMAND}
|
||||
#WORKING_DIRECTORY "${WEBRTC_PARENT_DIR}"
|
||||
#COMMENT "Fetching gn${_SUFFIX} for ${_PLATFORM}"
|
||||
#DEPENDS webrtc-sync
|
||||
#)
|
||||
#set(_DEPENDENCIES ${_DEPENDENCIES} webrtc-gn)
|
||||
|
||||
set(_CLANG_FORMAT_COMMAND download_from_google_storage${_SCRIPT_SUFFIX} --no_resume
|
||||
--platform=${_PLATFORM} --no_auth --bucket chromium-clang-format
|
||||
-s src/buildtools/${_FOLDER}/clang-format${_SUFFIX}.sha1)
|
||||
|
||||
libwebrtc_command(
|
||||
NAME webrtc-clang-format
|
||||
COMMAND ${_CLANG_FORMAT_COMMAND}
|
||||
WORKING_DIRECTORY "${WEBRTC_PARENT_DIR}"
|
||||
COMMENT "Fetching clang-format${_SUFFIX} for ${_PLATFORM}"
|
||||
DEPENDS webrtc-sync
|
||||
)
|
||||
set(_DEPENDENCIES ${_DEPENDENCIES} webrtc-clang-format)
|
||||
|
||||
if (WIN32)
|
||||
libwebrtc_command(
|
||||
NAME webrtc-patch-crt
|
||||
COMMAND ${CMAKE_COMMAND} -P ${WEBRTC_PARENT_DIR}/../../CMakeModules/PatchWebRTC.cmake ${WEBRTC_PARENT_DIR}/src/build/config/win/BUILD.gn
|
||||
WORKING_DIRECTORY "${WEBRTC_PARENT_DIR}"
|
||||
COMMENT "Patching webrtc to use dynamic runtime"
|
||||
DEPENDS webrtc-sync
|
||||
)
|
||||
set(_DEPENDENCIES ${_DEPENDENCIES} webrtc-patch-crt)
|
||||
endif()
|
||||
|
||||
include(Gn)
|
||||
|
||||
libwebrtc_command(
|
||||
NAME webrtc-generate
|
||||
COMMAND ${_GEN_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
COMMENT "Generating build files"
|
||||
DEPENDS ${_DEPENDENCIES}
|
||||
)
|
||||
|
||||
set(_NINJA_COMMAND ninja ${NINJA_ARGS} -C ${_NINJA_BUILD_DIR} :webrtc jsoncpp libyuv)
|
||||
|
||||
libwebrtc_command(
|
||||
NAME webrtc-build
|
||||
COMMAND ${_NINJA_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
COMMENT "Running ninja"
|
||||
DEPENDS webrtc-generate
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue