-
Notifications
You must be signed in to change notification settings - Fork 66
/
CMakeLists.txt
94 lines (77 loc) · 2.52 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
cmake_minimum_required(VERSION 3.8)
project(broadcaster LANGUAGES CXX)
# Set version number.
set(broadcaster_VERSION_MAJOR 0)
set(broadcaster_VERSION_MINOR 1)
# C++ standard requirements.
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message("\n=========== mediasoup-broadcaster-demo Build Configuration ===========\n")
message(STATUS "LIBWEBRTC_INCLUDE_PATH : " ${LIBWEBRTC_INCLUDE_PATH})
message(STATUS "LIBWEBRTC_BINARY_PATH : " ${LIBWEBRTC_BINARY_PATH})
message(STATUS "OPENSSL_INCLUDE_DIR : " ${OPENSSL_INCLUDE_DIR})
message(STATUS "CMAKE_USE_OPENSSL : " ${CMAKE_USE_OPENSSL})
message("")
# Add some compile flags to our source files.
set_source_files_properties(${SOURCE_FILES}
PROPERTIES COMPILE_FLAGS -Wall -Wextra -Wpedantic)
# Create target.
add_executable(${PROJECT_NAME} ${SOURCES})
# Extra libs required in order to use Apple media devices.
if(APPLE)
find_library(APPLICATION_SERVICES ApplicationServices)
find_library(AUDIO_TOOLBOX AudioToolbox)
find_library(AV_FOUNDATION AVFoundation)
find_library(CORE_AUDIO CoreAudio)
find_library(CORE_FOUNDATION Foundation)
find_library(CORE_MEDIA CoreMedia)
find_library(CORE_VIDEO CoreVideo)
find_library(CORE_SERVICES CoreServices)
target_link_libraries(${PROJECT_NAME} PUBLIC
${APPLICATION_SERVICES}
${AUDIO_TOOLBOX}
${AV_FOUNDATION}
${CORE_AUDIO}
${CORE_FOUNDATION}
${CORE_MEDIA}
${CORE_VIDEO}
${CORE_SERVICES}
)
endif(APPLE)
include(FetchContent)
message(STATUS "\nFetching mediasoupclient...\n")
FetchContent_Declare(
mediasoupclient
GIT_REPOSITORY https://github.com/versatica/libmediasoupclient.git
GIT_TAG v3
)
FetchContent_MakeAvailable(mediasoupclient)
message(STATUS "Fetching cpr...\n")
FetchContent_Declare(
cpr
GIT_REPOSITORY https://github.com/whoshuu/cpr
GIT_TAG 1.4.0
)
FetchContent_MakeAvailable(cpr)
target_sources(${PROJECT_NAME} PRIVATE
src/Broadcaster.cpp
src/main.cpp
src/MediaStreamTrackFactory.cpp
)
# Private (implementation) header files.
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/include)
# Source Dependencies.
add_subdirectory(deps/libwebrtc "${CMAKE_CURRENT_BINARY_DIR}/libwebrtc")
# Public (interface) headers from dependencies.
target_include_directories(${PROJECT_NAME} PUBLIC
${mediasoupclient_SOURCE_DIR}/include
${cpr_SOURCE_DIR}/include
"${PROJECT_SOURCE_DIR}/deps/libwebrtc"
)
# Public (interface) dependencies.
target_link_libraries(${PROJECT_NAME} PUBLIC
${LIBWEBRTC_BINARY_PATH}/libwebrtc${CMAKE_STATIC_LIBRARY_SUFFIX}
cpr
mediasoupclient
webrtc_broadcaster
)