-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
141 lines (111 loc) · 5.09 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
138
139
140
141
cmake_minimum_required(VERSION 3.20)
include(CheckCXXSymbolExists)
option(NABTO_WEBRTC_USE_VCPKG "Use vcpkg for providing dependencies" ON)
option(NABTO_WEBRTC_BUILD_TESTS "Build code meant for testing" ON)
if (NABTO_WEBRTC_USE_VCPKG)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file")
endif()
project(EdgeDeviceWebrtc
VERSION 0.0.1
LANGUAGES CXX)
option(NABTO_WEBRTC_BUILD_EXAMPLES "Build nabto webrtc examples" ON)
option(NABTO_WEBRTC_BUILD_TESTS "Build nabto webrtc tests" OFF)
option(NABTO_WEBRTC_BUILD_WITH_VCPKG_DEPENDENCIES "build with vcpkg dependencies, which lacks mbedtls and tinycbor package configuration files" ${NABTO_WEBRTC_USE_VCPKG})
option(NABTO_WEBRTC_BUILD_TESTS "Build tests" OFF)
option(NABTO_WEBRTC_BUILD_EXAMPLES "Build tests" ON)
#option(NABTO_WEBRTC_USE_DATACHANNEL_STATIC_LIB "Use the static libdatachannel library" ${NABTO_WEBRTC_USE_VCPKG})
set(NABTO_WEBRTC_VERSION "" CACHE STRING "Override the default nabto webrtc version from git")
if (NABTO_WEBRTC_BUILD_WITH_VCPKG_DEPENDENCIES)
# vcpkg dependencies for mbedtls 2 and tinycbor does not provide find_package scripts for these libraries
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/vcpkg;${CMAKE_MODULE_PATH}")
endif()
#if (NABTO_WEBRTC_USE_DATACHANNEL_STATIC_LIB)
# set(NABTO_WEBRTC_LIBDATACHANNEL_LIBRARY_NAME LibDataChannelStatic)
#else()
set(NABTO_WEBRTC_LIBDATACHANNEL_LIBRARY_NAME LibDataChannel)
#endif()
include(FetchContent)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(DEVICE_BUILD_EXAMPLES OFF CACHE BOOL "build nabto embedded sdk examples")
set(DEVICE_BUILD_TESTS OFF CACHE BOOL "build nabto embedded sdk tests")
set(DEVICE_BUILD_APPS OFF CACHE BOOL "build nabto embedded sdk apps")
# Some toolchains does not come with std::round e.g. gcc 7.2 with uclibc for the T40 platform.
check_cxx_symbol_exists(std::round "cmath" HAVE_CXX_STD_ROUND)
if (NOT HAVE_CXX_STD_ROUND)
add_definitions(-DNABTO_WEBRTC_CXX_STD_ROUND_FIX)
endif()
include_directories(include)
include_directories(src/modules)
add_subdirectory(src/library)
add_subdirectory(src/modules/util)
add_subdirectory(src/modules/event-queue)
add_subdirectory(src/modules/track-negotiators)
add_subdirectory(src/modules/rtp-client)
add_subdirectory(src/modules/rtsp-client)
add_subdirectory(src/modules/fifo-file-client)
add_subdirectory(src/modules/media-streams)
add_subdirectory(src/modules/rtp-packetizer)
add_subdirectory(src/modules/rtp-repacketizer)
if (NABTO_WEBRTC_BUILD_EXAMPLES)
add_subdirectory(examples/webrtc-demo)
add_subdirectory(examples/simple-webrtc)
endif()
if (NABTO_WEBRTC_BUILD_TESTS)
add_subdirectory(test-apps/simple-webrtc-two-streams)
add_subdirectory(test-apps/simple-webrtc-send-audio-from-browser)
add_subdirectory(test-apps/simple-webrtc-race-condition)
add_subdirectory(test-apps/rtsp-tester)
add_subdirectory(test)
endif()
include(GNUInstallDirs)
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")
include(CMakePackageConfigHelpers)
add_library(EdgeDeviceWebRTC::nabto_device_webrtc ALIAS nabto_device_webrtc)
add_library(EdgeDeviceWebRTC::event_queue_impl ALIAS event_queue_impl)
add_library(EdgeDeviceWebRTC::webrtc_util ALIAS webrtc_util)
add_library(EdgeDeviceWebRTC::media_streams ALIAS media_streams)
add_library(EdgeDeviceWebRTC::track_negotiators ALIAS track_negotiators)
add_library(EdgeDeviceWebRTC::rtp_packetizers ALIAS rtp_packetizers)
add_library(EdgeDeviceWebRTC::rtp_repacketizers ALIAS rtp_repacketizers)
add_library(EdgeDeviceWebRTC::rtp_client ALIAS rtp_client)
add_library(EdgeDeviceWebRTC::rtsp_client ALIAS rtsp_client)
add_library(EdgeDeviceWebRTC::fifo_file_client ALIAS fifo_file_client)
install(
TARGETS nabto_device_webrtc event_queue_impl webrtc_util media_streams track_negotiators rtp_packetizers rtp_repacketizers rtp_client rtsp_client fifo_file_client
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILE_SET public_headers
)
write_basic_package_version_file(
"${version_config}" COMPATIBILITY SameMajorVersion
)
configure_package_config_file(
"cmake-scripts/Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION "${config_install_dir}"
)
# Config
# * <prefix>/lib/cmake/Foo/FooConfig.cmake
# * <prefix>/lib/cmake/Foo/FooConfigVersion.cmake
install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
)
# Config
# * <prefix>/lib/cmake/Foo/FooTargets.cmake
install(
EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)