mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-28 11:15:13 +00:00
Merge branch refactor-depot-tools
This commit is contained in:
commit
6aab703673
23 changed files with 559 additions and 328 deletions
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
|
|
||||||
|
|
@ -43,10 +43,10 @@ install:
|
||||||
- git submodule update
|
- git submodule update
|
||||||
- mkdir out
|
- mkdir out
|
||||||
- cd out
|
- cd out
|
||||||
- cmake -DNINJA_ARGS="-j 4" -DGN_EXTRA_ARGS="clang_use_chrome_plugins=false" ..
|
- cmake ..
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make package
|
- make -j 4 package
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
|
|
||||||
105
CMakeLists.txt
105
CMakeLists.txt
|
|
@ -8,10 +8,113 @@ cmake_policy(SET CMP0057 NEW)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
||||||
${CMAKE_SOURCE_DIR}/CMakeModules)
|
${CMAKE_SOURCE_DIR}/CMakeModules)
|
||||||
|
|
||||||
|
find_package(Git REQUIRED)
|
||||||
|
|
||||||
include(FindLibraries)
|
include(FindLibraries)
|
||||||
include(Version)
|
include(Version)
|
||||||
include(Options)
|
include(Options)
|
||||||
include(TargetOsAndCpu)
|
include(TargetOsAndCpu)
|
||||||
|
|
||||||
add_subdirectory(Targets)
|
if (HAS_OWN_DEPOT_TOOLS)
|
||||||
|
find_package(DepotTools REQUIRED)
|
||||||
|
endif (HAS_OWN_DEPOT_TOOLS)
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
find_package(PythonInterp 2.7 REQUIRED)
|
||||||
|
endif (NOT WIN32)
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
if (NOT HAS_OWN_DEPOT_TOOLS)
|
||||||
|
if (WIN32)
|
||||||
|
set(GCLIENT_EXECUTABLE ${CMAKE_BINARY_DIR}/depot_tools/src/depot-tools/gclient.bat)
|
||||||
|
else (WIN32)
|
||||||
|
set(GCLIENT_EXECUTABLE ${CMAKE_BINARY_DIR}/depot_tools/src/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)
|
||||||
|
set(DEPOT_TOOLS_PATH ${CMAKE_BINARY_DIR}/depot_tools/src/depot-tools)
|
||||||
|
endif (NOT HAS_OWN_DEPOT_TOOLS)
|
||||||
|
|
||||||
|
set(_WEBRTC_CMAKE_ARGS
|
||||||
|
-DDEPOT_TOOLS_PATH:PATH=${DEPOT_TOOLS_PATH}
|
||||||
|
-DGCLIENT_EXECUTABLE:PATH=${GCLIENT_EXECUTABLE}
|
||||||
|
-DHAS_OWN_DEPOT_TOOLS:PATH=${HAS_OWN_DEPOT_TOOLS}
|
||||||
|
-DCMAKE_MODULE_PATH:PATH=${CMAKE_MODULE_PATH}
|
||||||
|
-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
|
||||||
|
-DLIBRARY_TYPE:STRING=${LIBRARY_TYPE}
|
||||||
|
-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/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)
|
||||||
|
|
||||||
export(PACKAGE LibWebRTC)
|
export(PACKAGE LibWebRTC)
|
||||||
|
|
|
||||||
47
CMakeModules/DepotTools.cmake
Normal file
47
CMakeModules/DepotTools.cmake
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
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}"
|
||||||
|
)
|
||||||
34
CMakeModules/Environment.cmake
Normal file
34
CMakeModules/Environment.cmake
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
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,16 +1,17 @@
|
||||||
find_program(GCLIENT_EXECUTABLE
|
find_program(GCLIENT_EXECUTABLE
|
||||||
NAMES gclient gclient.bat
|
NAMES gclient gclient.bat
|
||||||
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/depot_tools)
|
DOC "Path to gclient executable"
|
||||||
|
HINTS ${DEPOT_TOOLS_PATH} ENV DEPOT_TOOLS_PATH)
|
||||||
|
|
||||||
find_path(DEPOTTOOLS_PATH
|
find_path(DEPOT_TOOLS_PATH
|
||||||
NAMES gclient gclient.py gclient.bat
|
NAMES gclient gclient.py gclient.bat
|
||||||
gn gn.py gn.bat
|
|
||||||
ninja ninja.exe ninja-linux32 ninja-linux64 ninja-mac
|
ninja ninja.exe ninja-linux32 ninja-linux64 ninja-mac
|
||||||
download_from_google_storage download_from_google_storage.bat
|
download_from_google_storage download_from_google_storage.bat
|
||||||
download_from_google_storage.py
|
download_from_google_storage.py
|
||||||
HINTS ${CMAKE_CURRENT_SOURCE_DIR}/depot_tools)
|
DOC "Path to depot_tools directory"
|
||||||
|
HINTS ${DEPOT_TOOLS_PATH} ENV DEPOT_TOOLS_PATH)
|
||||||
|
|
||||||
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||||||
find_package_handle_standard_args(DepotTools
|
find_package_handle_standard_args(DepotTools
|
||||||
REQUIRED_VARS GCLIENT_EXECUTABLE
|
REQUIRED_VARS GCLIENT_EXECUTABLE DEPOT_TOOLS_PATH
|
||||||
FAIL_MESSAGE "Could not find the gclient executable.")
|
FAIL_MESSAGE "Could not find depot_tools.")
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,5 @@
|
||||||
#
|
#
|
||||||
# Find required packages
|
# 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)
|
list(APPEND LIBWEBRTC_LIBRARIES webrtc)
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
|
|
|
||||||
22
CMakeModules/GClient.cmake
Normal file
22
CMakeModules/GClient.cmake
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
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,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")
|
|
||||||
30
CMakeModules/Gn.cmake
Normal file
30
CMakeModules/Gn.cmake
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
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>$<$<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 (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 (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,9 +1,14 @@
|
||||||
|
if(LIBWEBRTC_COMMAND_INCLUDED)
|
||||||
|
return()
|
||||||
|
endif(LIBWEBRTC_COMMAND_INCLUDED)
|
||||||
|
set(LIBWEBRTC_COMMAND_INCLUDED true)
|
||||||
|
|
||||||
include(CMakeParseArguments)
|
include(CMakeParseArguments)
|
||||||
include(Prefix)
|
include(Environment)
|
||||||
|
|
||||||
function(libwebrtc_command)
|
function(libwebrtc_command)
|
||||||
set(ONE_VALUE_ARGS NAME COMMENT DEPENDS WORKING_DIRECTORY)
|
set(ONE_VALUE_ARGS NAME COMMENT WORKING_DIRECTORY)
|
||||||
set(MULTI_VALUE_ARGS COMMAND)
|
set(MULTI_VALUE_ARGS COMMAND DEPENDS)
|
||||||
cmake_parse_arguments(COMMAND "" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN} )
|
cmake_parse_arguments(COMMAND "" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN} )
|
||||||
|
|
||||||
set(CMF_DIR ${CMAKE_BINARY_DIR}/CMakeFiles)
|
set(CMF_DIR ${CMAKE_BINARY_DIR}/CMakeFiles)
|
||||||
|
|
@ -19,5 +24,7 @@ function(libwebrtc_command)
|
||||||
|
|
||||||
add_custom_target(${COMMAND_NAME} ALL DEPENDS ${STAMP_FILE})
|
add_custom_target(${COMMAND_NAME} ALL DEPENDS ${STAMP_FILE})
|
||||||
|
|
||||||
add_dependencies(${COMMAND_NAME} ${COMMAND_DEPENDS})
|
if (COMMAND_DEPENDS)
|
||||||
|
add_dependencies(${COMMAND_NAME} ${COMMAND_DEPENDS})
|
||||||
|
endif (COMMAND_DEPENDS)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
||||||
52
CMakeModules/LibWebRTCExecute.cmake
Normal file
52
CMakeModules/LibWebRTCExecute.cmake
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
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}/CMakeFiles)
|
||||||
|
|
||||||
|
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,12 +1,17 @@
|
||||||
#
|
#
|
||||||
# Options, flags
|
# Options, flags
|
||||||
option(BUILD_TESTS "Build test binaries" OFF)
|
option(BUILD_TESTS "Build test binaries" 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(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(GN_EXTRA_ARGS "" CACHE STRING "Extra gn gen arguments to pass before generating build files")
|
||||||
option(BUILD_SHARED_LIB "Build WebRTC as a shared library" OFF)
|
option(BUILD_SHARED_LIB "Build WebRTC as a shared library" OFF)
|
||||||
set(WEBRTC_REVISION "" CACHE STRING "WebRTC commit hash to checkout")
|
set(WEBRTC_REVISION "" CACHE STRING "WebRTC commit hash to checkout")
|
||||||
set(WEBRTC_BRANCH_HEAD "${LIBWEBRTC_WEBRTC_HEAD}" CACHE STRING "WebRTC branch head 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)
|
||||||
|
|
||||||
if(BUILD_SHARED_LIB)
|
if(BUILD_SHARED_LIB)
|
||||||
set(LIBRARY_TYPE SHARED)
|
set(LIBRARY_TYPE SHARED)
|
||||||
else()
|
else()
|
||||||
|
|
|
||||||
|
|
@ -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}
|
|
||||||
")
|
|
||||||
|
|
@ -82,4 +82,4 @@ elseif (WIN32)
|
||||||
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG "/MTd")
|
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG "/MTd")
|
||||||
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE "/MT")
|
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE "/MT")
|
||||||
list(APPEND LIBWEBRTC_DEFINITIONS WEBRTC_WIN NOMINMAX _CRT_SECURE_NO_WARNINGS)
|
list(APPEND LIBWEBRTC_DEFINITIONS WEBRTC_WIN NOMINMAX _CRT_SECURE_NO_WARNINGS)
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
#
|
|
||||||
# Set the project's version
|
|
||||||
|
|
||||||
set(LIBWEBRTC_MAJOR_VERSION 0)
|
set(LIBWEBRTC_MAJOR_VERSION 0)
|
||||||
set(LIBWEBRTC_MINOR_VERSION 0)
|
set(LIBWEBRTC_MINOR_VERSION 0)
|
||||||
set(LIBWEBRTC_PATCH_VERSION 1)
|
set(LIBWEBRTC_PATCH_VERSION 1)
|
||||||
|
|
|
||||||
81
README.md
81
README.md
|
|
@ -3,7 +3,7 @@
|
||||||
This repository contains a collection of CMake scripts to help you embed
|
This repository contains a collection of CMake scripts to help you embed
|
||||||
Google's native WebRTC implementation inside your project as simple as this:
|
Google's native WebRTC implementation inside your project as simple as this:
|
||||||
|
|
||||||
```
|
```cmake
|
||||||
cmake_minimum_required(VERSION 3.3)
|
cmake_minimum_required(VERSION 3.3)
|
||||||
project(sample)
|
project(sample)
|
||||||
|
|
||||||
|
|
@ -45,8 +45,8 @@ supported platforms and architectures.
|
||||||
<th align="center">macOS</th>
|
<th align="center">macOS</th>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td align="center">✔</td>
|
<td align="center">✔</td>
|
||||||
<td></td>
|
<td align="center">-</td>
|
||||||
<td></td>
|
<td align="center">-</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="center">Windows</th>
|
<th align="center">Windows</th>
|
||||||
|
|
@ -65,7 +65,7 @@ supported platforms and architectures.
|
||||||
|
|
||||||
### Debian & Ubuntu
|
### Debian & Ubuntu
|
||||||
|
|
||||||
Install the required development packages
|
Install the required development packages:
|
||||||
|
|
||||||
```
|
```
|
||||||
# apt-get install build-essential libglib2.0-dev libgtk2.0-dev libxtst-dev \
|
# apt-get install build-essential libglib2.0-dev libgtk2.0-dev libxtst-dev \
|
||||||
|
|
@ -96,15 +96,12 @@ Install the required development packages
|
||||||
|
|
||||||
## Compiling
|
## Compiling
|
||||||
|
|
||||||
Clone the repository, initialize the submodules if `depot_tools` is not
|
Clone the repository, create an output directory, browse inside it,
|
||||||
installed on your system or not defined inside your `PATH` environment variable.
|
then run CMake.
|
||||||
Create an output directory, browse inside it, then run CMake.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ git clone https://github.com/aisouard/libwebrtc.git
|
$ git clone https://github.com/aisouard/libwebrtc.git
|
||||||
$ cd libwebrtc
|
$ cd libwebrtc
|
||||||
$ git submodule init
|
|
||||||
$ git submodule update
|
|
||||||
$ mkdir out
|
$ mkdir out
|
||||||
$ cd out
|
$ cd out
|
||||||
$ cmake ..
|
$ cmake ..
|
||||||
|
|
@ -135,7 +132,7 @@ 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
|
automatically find the required libraries, define the proper compiling flags and
|
||||||
include directories.
|
include directories.
|
||||||
|
|
||||||
```
|
```cmake
|
||||||
find_package(LibWebRTC REQUIRED)
|
find_package(LibWebRTC REQUIRED)
|
||||||
include(${LIBWEBRTC_USE_FILE})
|
include(${LIBWEBRTC_USE_FILE})
|
||||||
|
|
||||||
|
|
@ -149,6 +146,35 @@ linker flags by specifying `LibWebRTC` as the package name.
|
||||||
$ pkg-config --cflags --libs LibWebRTC
|
$ pkg-config --cflags --libs LibWebRTC
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 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/57 ..
|
||||||
|
```
|
||||||
|
|
||||||
|
If both variables are set, it will focus on fetching the commit defined inside
|
||||||
|
**WEBRTC_REVISION**.
|
||||||
|
|
||||||
|
## Managing depot_tools
|
||||||
|
|
||||||
|
CMake will retrieve the latest revision of the `depot_tools` repository. It will
|
||||||
|
get the WebRTC repository's commit date, then check-out `depot_tools` to the
|
||||||
|
commit having the closest date to WebRTC's, in order to ensure a high
|
||||||
|
compatibility with `gclient` and other tools.
|
||||||
|
|
||||||
|
It is possible to prevent this behavior by specifying the location to your own
|
||||||
|
`depot_tools` repository by defining the **DEPOT_TOOLS_PATH** variable.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cmake -DDEPOT_TOOLS_PATH=/opt/depot_tools ..
|
||||||
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The library will be compiled and usable on the same host's platform and
|
The library will be compiled and usable on the same host's platform and
|
||||||
|
|
@ -172,13 +198,18 @@ perform cross-compiling.
|
||||||
Defaults to OFF, will define the `component_build` gn argument to `true` if
|
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.
|
enabled. This option will build a shared library instead of a static one.
|
||||||
|
|
||||||
|
- **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.
|
||||||
|
|
||||||
- **NINJA_ARGS**
|
- **NINJA_ARGS**
|
||||||
|
|
||||||
Arguments to pass while executing the `ninja` command. For instance, you can
|
Arguments to pass while executing the `ninja` command.
|
||||||
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_OS**
|
||||||
|
|
||||||
|
|
@ -204,6 +235,15 @@ perform cross-compiling.
|
||||||
- `arm64`
|
- `arm64`
|
||||||
- `mipsel`
|
- `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.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Feel free to open an issue if you wish a bug to be fixed, to discuss a new
|
Feel free to open an issue if you wish a bug to be fixed, to discuss a new
|
||||||
|
|
@ -213,6 +253,16 @@ 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!
|
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.
|
You can also reach me on [Twitter][twitter] for further discussion.
|
||||||
|
|
||||||
|
## Acknowledgements
|
||||||
|
|
||||||
|
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,
|
||||||
|
which was a great source of inspiration for me to create the easiest way to link
|
||||||
|
the WebRTC library in any native project.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Apache License 2.0 © [Axel Isouard][author]
|
Apache License 2.0 © [Axel Isouard][author]
|
||||||
|
|
@ -230,4 +280,5 @@ Apache License 2.0 © [Axel Isouard][author]
|
||||||
[w10sdk]:https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
|
[w10sdk]:https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
|
||||||
[wdk10]:https://go.microsoft.com/fwlink/p/?LinkId=526733
|
[wdk10]:https://go.microsoft.com/fwlink/p/?LinkId=526733
|
||||||
[twitter]:https://twitter.com/aisouard
|
[twitter]:https://twitter.com/aisouard
|
||||||
|
[webrtc-dr-alex-cmake]:http://webrtcbydralex.com/index.php/2015/07/22/automating-libwebrtc-build-with-cmake
|
||||||
[author]:https://axel.isouard.fr
|
[author]:https://axel.isouard.fr
|
||||||
|
|
|
||||||
|
|
@ -1,205 +0,0 @@
|
||||||
include(ExternalProject)
|
|
||||||
include(LibWebRTCCommand)
|
|
||||||
include(GClientConfig)
|
|
||||||
|
|
||||||
set(_DOWNLOAD_COMMAND ${GCLIENT_EXECUTABLE} sync --with_branch_heads --nohooks)
|
|
||||||
if (WEBRTC_REVISION)
|
|
||||||
set(_DOWNLOAD_COMMAND ${_DOWNLOAD_COMMAND} --revision ${WEBRTC_REVISION})
|
|
||||||
endif (WEBRTC_REVISION)
|
|
||||||
|
|
||||||
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 ""
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
)
|
|
||||||
|
|
||||||
set(_NEXT_DEPENDS webrtc-src)
|
|
||||||
if (NOT WEBRTC_REVISION)
|
|
||||||
libwebrtc_command(
|
|
||||||
NAME webrtc-fetch-refs
|
|
||||||
COMMAND ${GIT_EXECUTABLE} fetch origin ${WEBRTC_BRANCH_HEAD}
|
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src"
|
|
||||||
COMMENT "Fetching branch heads"
|
|
||||||
DEPENDS webrtc-src
|
|
||||||
)
|
|
||||||
|
|
||||||
libwebrtc_command(
|
|
||||||
NAME webrtc-checkout-fetch-head
|
|
||||||
COMMAND ${GIT_EXECUTABLE} checkout FETCH_HEAD
|
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src"
|
|
||||||
COMMENT "Checking out fetch head"
|
|
||||||
DEPENDS webrtc-fetch-refs
|
|
||||||
)
|
|
||||||
|
|
||||||
set(_NEXT_DEPENDS webrtc-checkout-fetch-head)
|
|
||||||
endif (NOT WEBRTC_REVISION)
|
|
||||||
|
|
||||||
libwebrtc_command(
|
|
||||||
NAME webrtc-update-clang
|
|
||||||
COMMAND ${PYTHON_EXECUTABLE} src/tools/clang/scripts/update.py
|
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
|
||||||
COMMENT "Updating clang"
|
|
||||||
DEPENDS ${_NEXT_DEPENDS}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(_NEXT_DEPENDS webrtc-update-clang)
|
|
||||||
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)
|
|
||||||
|
|
||||||
set(_GEN_ARGS ${_GEN_ARGS} ${GN_EXTRA_ARGS})
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
@ -13,8 +13,10 @@ build:
|
||||||
before_build:
|
before_build:
|
||||||
- cd c:\projects\libwebrtc
|
- cd c:\projects\libwebrtc
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
- cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=c:\projects\libwebrtc -DNINJA_ARGS="-j 2" .
|
- cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=c:\projects\libwebrtc .
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: libwebrtc-0.0.1-rc.4-win32-x64.7z
|
- path: libwebrtc-0.0.1-rc.4-win-x64.zip
|
||||||
name: libwebrtc-0.0.1-rc.4-win32-x64.7z
|
name: libwebrtc-0.0.1-rc.4-win-x64.zip
|
||||||
|
|
||||||
|
test: off
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 33e88a4e19aa1eb306fe66431e8b0621773eb66c
|
|
||||||
27
depot_tools/CMakeLists.txt
Normal file
27
depot_tools/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
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)
|
||||||
146
webrtc/CMakeLists.txt.in
Normal file
146
webrtc/CMakeLists.txt.in
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
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 --nohooks
|
||||||
|
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)
|
||||||
|
libwebrtc_command(
|
||||||
|
NAME webrtc-toolchain
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${WEBRTC_PARENT_DIR}/src/build/linux/sysroot_scripts/install-sysroot.py --running-as-hook
|
||||||
|
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)
|
||||||
|
|
||||||
|
include(Gn)
|
||||||
|
|
||||||
|
libwebrtc_command(
|
||||||
|
NAME webrtc-generate
|
||||||
|
COMMAND ${_GEN_COMMAND}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
COMMENT "Generating build files"
|
||||||
|
DEPENDS webrtc-clang ${_DEPENDENCIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(_NINJA_COMMAND ninja ${NINJA_ARGS} -C ${_NINJA_BUILD_DIR} pc)
|
||||||
|
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