-
Notifications
You must be signed in to change notification settings - Fork 190
/
CMakeLists.txt
137 lines (107 loc) · 3.68 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
cmake_minimum_required(VERSION 3.3)
project(libwebrtc)
#
# 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)
include(FindLibraries)
include(Version)
include(Options)
include(TargetOsAndCpu)
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
-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 (BUILD_TESTS)
set(_WEBRTC_CMAKE_ARGS ${_WEBRTC_CMAKE_ARGS} -DBUILD_TESTS=${BUILD_TESTS})
endif (BUILD_TESTS)
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/webrtc
)
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)