@@ -21,10 +21,12 @@ else()
2121endif ()
2222
2323set (WEBRTC_INCLUDE_DIR /usr/local/include /webrtc)
24- set (WEBRTC_LIBRARY /usr/local/lib/libwebrtc.a)
25- set (WEBRTC_LINK_LIBS dl)
24+ set (WEBRTC_LIBRARY
25+ /usr/local/lib/libwebrtc.a
26+ avcodec
27+ )
28+
2629set (THREADS_PREFER_PTHREAD_FLAG ON )
27- find_package (Threads REQUIRED)
2830
2931message (STATUS "BUILD_TEST: ${BUILD_TEST} " )
3032message (STATUS "WEBRTC_INCLUDE_DIR: ${WEBRTC_INCLUDE_DIR} " )
@@ -35,7 +37,6 @@ add_compile_definitions(
3537 WEBRTC_POSIX
3638 WEBRTC_LINUX
3739 WEBRTC_USE_H264
38- USE_CPPRESTSDK
3940 OPENSSL_IS_BORINGSSL
4041)
4142
@@ -53,105 +54,75 @@ include_directories(
5354 ${WEBRTC_INCLUDE_DIR} /tools/json_schema_compiler
5455)
5556
57+ add_subdirectory (src/capturer)
58+ add_subdirectory (src/codecs/h264)
59+ add_subdirectory (src/codecs/v4l2)
60+ add_subdirectory (src/common)
61+ add_subdirectory (src/recorder)
62+ add_subdirectory (src/rtc)
63+ add_subdirectory (src/signaling)
64+ add_subdirectory (src/track)
65+
5666if (BUILD_TEST STREQUAL "http_server" )
5767 add_executable (test_http_server test /test_http_server.cpp)
68+ target_link_libraries (test_http_server
69+ signaling
70+ )
5871elseif (BUILD_TEST STREQUAL "pulseaudio" )
5972 add_executable (test_pulseaudio test /test_pulseaudio.cpp)
60-
6173 target_link_libraries (test_pulseaudio
6274 pulse-simple pulse
6375 )
6476elseif (BUILD_TEST STREQUAL "recorder" )
65- add_subdirectory (src/common)
66- add_subdirectory (src/capturer)
67- add_subdirectory (src/recorder)
68- add_subdirectory (src/v4l2_codecs)
6977 add_executable (test_recorder test /test_recorder.cpp)
7078 target_link_libraries (test_recorder
71- capturer
7279 recorder
7380 )
7481elseif (BUILD_TEST STREQUAL "mqtt" )
75- add_subdirectory (src/signaling)
7682 add_executable (test_mqtt test /test_mqtt.cpp)
77-
7883 target_link_libraries (test_mqtt
7984 signaling
8085 )
81- target_link_libraries (test_mqtt
82- Threads::Threads
83- ${MOSQUITTO_LIBS}
84- )
8586elseif (BUILD_TEST STREQUAL "websocket" )
8687 add_executable (test_websocket test /test_websocket.cpp)
87-
8888 target_link_libraries (test_websocket
89- ssl
90- crypto
89+ signaling
9190 )
9291elseif (BUILD_TEST STREQUAL "openh264" )
9392 add_executable (test_openh264 test /test_openh264.cpp)
93+ # Use the OpenH264 library in libwebrtc.a
9494 target_link_libraries (test_openh264
95- ${WEBRTC_LINK_LIBS}
9695 ${WEBRTC_LIBRARY}
9796 )
9897elseif (BUILD_TEST STREQUAL "v4l2_capturer" )
99- add_subdirectory (src/capturer)
100- add_subdirectory (src/common)
101- add_subdirectory (src/v4l2_codecs)
10298 add_executable (test_v4l2_capturer test /test_v4l2_capturer.cpp)
10399 target_link_libraries (test_v4l2_capturer
104100 capturer
105- v4l2_codecs
106101 )
107102elseif (BUILD_TEST STREQUAL "v4l2_encoder" )
108- add_subdirectory (src/capturer)
109- add_subdirectory (src/common)
110- add_subdirectory (src/v4l2_codecs)
111103 add_executable (test_v4l2_encoder test /test_v4l2_encoder.cpp)
112104 target_link_libraries (test_v4l2_encoder
113105 capturer
114- v4l2_codecs
115106 )
116107elseif (BUILD_TEST STREQUAL "v4l2_decoder" )
117- add_subdirectory (src/capturer)
118- add_subdirectory (src/common)
119- add_subdirectory (src/v4l2_codecs)
120108 add_executable (test_v4l2_decoder test /test_v4l2_decoder.cpp)
121109 target_link_libraries (test_v4l2_decoder
122110 capturer
123- v4l2_codecs
124111 )
125112elseif (BUILD_TEST STREQUAL "v4l2_scaler" )
126- add_subdirectory (src/capturer)
127- add_subdirectory (src/common)
128- add_subdirectory (src/v4l2_codecs)
129113 add_executable (test_v4l2_scaler test /test_v4l2_scaler.cpp)
130114 target_link_libraries (test_v4l2_scaler
131115 capturer
132- v4l2_codecs
133116 )
134117elseif (BUILD_TEST STREQUAL "libcamera" )
135- add_subdirectory (src/capturer)
136- add_subdirectory (src/common)
137118 add_executable (test_libcamera test /test_libcamera.cpp)
138119 target_link_libraries (test_libcamera
139120 capturer
140- common
141- )
142- target_link_libraries (test_libcamera
143- ${WEBRTC_LINK_LIBS}
144- Threads::Threads
145- ${WEBRTC_LIBRARY}
146121 )
147122else ()
148123 add_subdirectory (src)
149124 add_executable (${PROJECT_NAME} src/main.cpp)
150125 target_link_libraries (${PROJECT_NAME}
151126 src
152- ${WEBRTC_LINK_LIBS}
153- boost_program_options
154- Threads::Threads
155- ${WEBRTC_LIBRARY}
156127 )
157128endif ()
0 commit comments