forked from TzuHuanTai/RaspberryPi-WebRTC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
138 lines (131 loc) · 3.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
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
cmake_minimum_required(VERSION 3.18)
project(pi_webrtc)
set(CMAKE_CXX_STANDARD 17)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(BUILD_TEST "" CACHE STRING "test")
set(WEBRTC_INCLUDE_DIR /usr/local/include/webrtc)
set(WEBRTC_LIBRARY_DIR /usr/local/lib/libwebrtc.a)
set(WEBRTC_LINK_LIBS X11 dl)
set(SIGNALR_LINK_LIBS microsoft-signalr cpprest ssl crypto)
set(FFMPEG_LINK_LIBS avformat avcodec avutil swscale avdevice)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
message(STATUS "BUILD_TEST: ${BUILD_TEST}")
message(STATUS "WEBRTC_INCLUDE_DIR: ${WEBRTC_INCLUDE_DIR}")
message(STATUS "WEBRTC_LIBRARY_DIR: ${WEBRTC_LIBRARY_DIR}")
add_compile_definitions(
WEBRTC_POSIX
WEBRTC_LINUX
USE_CPPRESTSDK
)
add_compile_options(
-pipe
-fdeclspec
)
include_directories(
./src
${WEBRTC_INCLUDE_DIR}
${WEBRTC_INCLUDE_DIR}/third_party/abseil-cpp
${WEBRTC_INCLUDE_DIR}/third_party/libyuv/include
${WEBRTC_INCLUDE_DIR}/tools/json_schema_compiler
)
add_library(common)
target_sources(common
PRIVATE
src/v4l2_utils.cpp
src/recorder.cpp
src/processor.cpp
)
if(BUILD_TEST STREQUAL "recorder")
add_subdirectory(src/capture)
add_executable(recorder test/test_recorder.cpp)
target_link_libraries(recorder
capture
common
)
target_link_libraries(recorder
${WEBRTC_LINK_LIBS}
${FFMPEG_LINK_LIBS}
Threads::Threads
${WEBRTC_LIBRARY_DIR}
)
elseif(BUILD_TEST STREQUAL "v4l2_capture")
add_subdirectory(src/capture)
add_executable(v4l2_capture test/test_v4l2_capture.cpp)
target_link_libraries(v4l2_capture
capture
common
)
target_link_libraries(v4l2_capture
${WEBRTC_LINK_LIBS}
Threads::Threads
${WEBRTC_LIBRARY_DIR}
)
elseif(BUILD_TEST STREQUAL "v4l2m2m_encoder")
add_subdirectory(src/capture)
add_subdirectory(src/encoder)
add_executable(v4l2m2m_encoder test/test_v4l2m2m_encoder.cpp)
target_link_libraries(v4l2m2m_encoder
capture
encoder
common
)
target_link_libraries(v4l2m2m_encoder
${WEBRTC_LINK_LIBS}
${FFMPEG_LINK_LIBS}
Threads::Threads
${WEBRTC_LIBRARY_DIR}
)
elseif(BUILD_TEST STREQUAL "v4l2m2m_decoder")
add_subdirectory(src/capture)
add_subdirectory(src/decoder)
add_subdirectory(src/scaler)
add_executable(v4l2m2m_decoder test/test_v4l2m2m_decoder.cpp)
target_link_libraries(v4l2m2m_decoder
capture
decoder
scaler
common
)
target_link_libraries(v4l2m2m_decoder
${WEBRTC_LINK_LIBS}
${FFMPEG_LINK_LIBS}
Threads::Threads
${WEBRTC_LIBRARY_DIR}
)
elseif(BUILD_TEST STREQUAL "v4l2m2m_scaler")
add_subdirectory(src/capture)
add_subdirectory(src/scaler)
add_executable(v4l2m2m_scaler test/test_v4l2m2m_scaler.cpp)
target_link_libraries(v4l2m2m_scaler
capture
scaler
common
)
target_link_libraries(v4l2m2m_scaler
${WEBRTC_LINK_LIBS}
${FFMPEG_LINK_LIBS}
Threads::Threads
${WEBRTC_LIBRARY_DIR}
)
else()
add_subdirectory(src)
add_executable(${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAME}
src
encoder
common
capture
track
)
target_link_libraries(${PROJECT_NAME}
${WEBRTC_LINK_LIBS}
${SIGNALR_LINK_LIBS}
boost_program_options
${FFMPEG_LINK_LIBS}
Threads::Threads
${WEBRTC_LIBRARY_DIR}
)
endif()