-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathCMakeLists.txt
439 lines (424 loc) · 17.2 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
cmake_minimum_required(VERSION 3.7.1)
project(cpp_media_server)
IF (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -g -Wno-declaration-after-statement -Wno-deprecated -Wno-deprecated-declarations -Wno-reorder -Wall -fexceptions -frtti -D__STDC_FORMAT_MACROS -fPIC")
ELSEIF (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -g -Wno-deprecated -Wno-deprecated-declarations -Wno-reorder -Wall -fexceptions -frtti -D__STDC_FORMAT_MACROS -fPIC")
ENDIF ()
set(CMAKE_OUTPUT_BASE ${CMAKE_BINARY_DIR}/output)
set(BUILD_OUTPUT_BASE ${CMAKE_BINARY_DIR}/output)
set(PREFIX_DIR "${BUILD_OUTPUT_BASE}")
set(INSTALL_RPATH "${PREFIX_DIR}/lib")
# set output static libary
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/output/lib)
# set pkgconfig path
set(CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/output/lib/pkgconfig")
# set include path
include_directories(src
src/net
src/net/http
src/net/rtmp
src/net/websocket
src/net/websocket/wsimple
src/net/tcp
src/net/stun
src/net/httpflv
src/net/rtprtcp
src/net/hls
src/net/webrtc
src/net/webrtc/libwebrtc
src/transcode
src/format
src/format/flv
src/utils
src/utils/av
3rdparty/libsdptransform/include
${CMAKE_BINARY_DIR}/output/include
${CMAKE_BINARY_DIR}/output/include/srtp2
${CMAKE_BINARY_DIR}/output/include/openssl
/usr/local/include)
# set lib path
#link_directories(${CMAKE_BINARY_DIR}/output/lib /usr/local/lib64 /usr/local/lib)
link_directories(${CMAKE_BINARY_DIR}/output/lib /usr/local/lib64 /usr/local/lib)
add_subdirectory(3rdparty)
#add_executable(ws_server_demo
# src/net/websocket/ws_server_demo.cpp
# src/net/websocket/ws_server.cpp
# src/net/websocket/ws_session.cpp
# src/net/websocket/ws_format.cpp
# src/utils/logger.cpp
# src/utils/base64.cpp
# src/utils/byte_crypto.cpp
# src/utils/data_buffer.cpp)
#
#IF (APPLE)
#target_link_libraries(ws_server_demo dl z m ssl crypto pthread uv)
#ELSEIF (UNIX)
#target_link_libraries(ws_server_demo rt dl z m ssl crypto pthread uv)
#ENDIF ()
#add_executable(echo_demo
# src/net/tcp/echo_demo.cpp
# src/utils/logger.cpp
# src/utils/data_buffer.cpp)
#
#IF (APPLE)
#target_link_libraries(echo_demo dl z m ssl crypto pthread uv)
#ELSEIF (UNIX)
#target_link_libraries(echo_demo rt dl z m ssl crypto pthread uv)
#ENDIF ()
#add_executable(flv_demux_demo
# ./src/format/flv/flv_demux.cpp
# ./src/format/flv/flv_demux_demo.cpp
# ./src/utils/logger.cpp
# ./src/utils/data_buffer.cpp
# ./src/utils/byte_stream.cpp)
#IF (APPLE)
#target_link_libraries(flv_demux_demo pthread dl z m)
#ELSEIF (UNIX)
#target_link_libraries(flv_demux_demo pthread rt dl z m)
#ENDIF ()
#
#add_executable(flv_mux_demo
# src/format/flv/flv_mux.cpp
# src/format/flv/flv_demux.cpp
# src/format/flv/flv_mux_demo.cpp
# src/utils/logger.cpp
# src/utils/data_buffer.cpp
# src/utils/byte_stream.cpp)
#IF (APPLE)
#target_link_libraries(flv_mux_demo pthread dl z m)
#ELSEIF (UNIX)
#target_link_libraries(flv_mux_demo pthread rt dl z m)
#ENDIF ()
#
#add_executable(mpegts_demux_demo
# src/format/mpegts/mpegts_demux_demo.cpp
# src/format/mpegts/mpegts_demux.cpp
# src/utils/logger.cpp
# src/utils/data_buffer.cpp
# src/utils/byte_stream.cpp)
#IF (APPLE)
#target_link_libraries(mpegts_demux_demo pthread dl z m)
#ELSEIF (UNIX)
#target_link_libraries(mpegts_demux_demo pthread rt dl z m)
#ENDIF ()
#
#add_executable(mpegts_mux_demo
# src/format/mpegts/mpegts_mux_demo.cpp
# src/format/mpegts/mpegts_mux.cpp
# src/format/flv/flv_demux.cpp
# src/utils/logger.cpp
# src/utils/data_buffer.cpp
# src/utils/byte_stream.cpp)
#IF (APPLE)
#target_link_libraries(mpegts_mux_demo pthread dl z m)
#ELSEIF (UNIX)
#target_link_libraries(mpegts_mux_demo pthread rt dl z m)
#ENDIF ()
#
#add_executable(http_client_demo
# src/net/http/http_client_demo.cpp
# src/net/http/http_client.cpp
# src/net/http/http_client.hpp
# src/utils/data_buffer.cpp
# src/utils/logger.cpp)
#IF (APPLE)
#target_link_libraries(http_client_demo dl z m ssl crypto pthread uv)
#ELSEIF (UNIX)
#target_link_libraries(http_client_demo rt dl z m ssl crypto pthread uv)
#ENDIF ()
#
#add_executable(http_server_demo
# src/net/http/http_server_demo.cpp
# src/net/http/http_server.cpp
# src/net/http/http_session.cpp
# src/utils/data_buffer.cpp
# src/utils/logger.cpp)
#IF (APPLE)
#target_link_libraries(http_server_demo dl z m ssl crypto pthread uv)
#ELSEIF (UNIX)
#target_link_libraries(http_server_demo rt dl z m ssl crypto pthread uv)
#ENDIF ()
#add_executable(https_server_demo
# src/net/http/https_server_demo.cpp
# src/net/http/http_server.cpp
# src/net/http/http_session.cpp
# src/utils/data_buffer.cpp
# src/utils/logger.cpp)
#IF (APPLE)
#target_link_libraries(https_server_demo dl z m ssl crypto pthread uv)
#ELSEIF (UNIX)
#target_link_libraries(https_server_demo rt dl z m ssl crypto pthread uv)
#ENDIF ()
#
#add_executable(rtmp_play_demo
# src/net/rtmp/client_demo/rtmp_play_demo.cpp
# src/net/rtmp/rtmp_client_session.cpp
# src/net/rtmp/rtmp_session_base.cpp
# src/net/rtmp/rtmp_control_handler.cpp
# src/net/rtmp/rtmp_handshake.cpp
# src/net/rtmp/chunk_stream.cpp
# src/format/flv/flv_mux.cpp
# src/utils/logger.cpp
# src/utils/data_buffer.cpp
# src/utils/byte_stream.cpp)
#add_dependencies(rtmp_play_demo openssl)
#
#IF (APPLE)
#target_link_libraries(rtmp_play_demo pthread dl z m ssl crypto pthread uv)
#ELSEIF (UNIX)
#target_link_libraries(rtmp_play_demo pthread rt dl z m ssl crypto pthread uv)
#ENDIF ()
#
#add_executable(rtmp_publish_demo
# src/net/rtmp/client_demo/rtmp_publish_demo.cpp
# src/net/rtmp/rtmp_client_session.cpp
# src/net/rtmp/rtmp_session_base.cpp
# src/net/rtmp/rtmp_control_handler.cpp
# src/net/rtmp/rtmp_handshake.cpp
# src/net/rtmp/chunk_stream.cpp
# src/format/flv/flv_demux.cpp
# src/format/flv/flv_mux.cpp
# src/utils/logger.cpp
# src/utils/data_buffer.cpp
# src/utils/byte_stream.cpp)
#add_dependencies(rtmp_publish_demo openssl)
#
#IF (APPLE)
#target_link_libraries(rtmp_publish_demo pthread dl z m ssl crypto pthread uv)
#ELSEIF (UNIX)
#target_link_libraries(rtmp_publish_demo pthread rt dl z m ssl crypto pthread uv)
#ENDIF ()
add_executable(cpp_media_server
src/media_server.cpp
src/media_server.hpp
src/format/flv/flv_demux.cpp
src/format/flv/flv_demux.hpp
src/format/flv/flv_mux.cpp
src/format/flv/flv_mux.hpp
src/format/flv/flv_pub.hpp
src/format/mpegts/mpegts_mux.cpp
src/format/mpegts/mpegts_mux.hpp
src/format/audio_pub.hpp
src/format/av_format_interface.hpp
src/format/h264_header.hpp
src/transcode/transcode_pub.hpp
src/transcode/decode.cpp
src/transcode/decode.hpp
src/transcode/encode.cpp
src/transcode/encode.hpp
src/transcode/filter.cpp
src/transcode/filter.hpp
src/transcode/transcode.cpp
src/transcode/transcode.hpp
src/net/tcp/tcp_server.hpp
src/net/tcp/tcp_session.hpp
src/net/udp/udp_server.hpp
src/net/http/http_session.cpp
src/net/http/http_server.cpp
src/net/http/http_common.hpp
src/net/http/http_server.hpp
src/net/http/http_session.hpp
src/net/hls/hls_worker.cpp
src/net/hls/hls_worker.hpp
src/net/hls/hls_writer.cpp
src/net/hls/hls_writer.hpp
src/net/hls/mpegts_handle.cpp
src/net/hls/mpegts_handle.hpp
src/net/rtmp/amf/amf0.hpp
src/net/rtmp/rtmp_pub.hpp
src/net/rtmp/rtmp_request.hpp
src/net/rtmp/rtmp_server.cpp
src/net/rtmp/rtmp_server.hpp
src/net/rtmp/rtmp_server_session.cpp
src/net/rtmp/rtmp_server_session.hpp
src/net/rtmp/rtmp_client_session.cpp
src/net/rtmp/rtmp_client_session.hpp
src/net/rtmp/rtmp_session_base.cpp
src/net/rtmp/rtmp_session_base.hpp
src/net/rtmp/rtmp_control_handler.cpp
src/net/rtmp/rtmp_control_handler.hpp
src/net/rtmp/rtmp_handshake.cpp
src/net/rtmp/rtmp_handshake.hpp
src/net/rtmp/chunk_stream.cpp
src/net/rtmp/chunk_stream.hpp
src/net/rtmp/rtmp_writer.cpp
src/net/rtmp/rtmp_writer.hpp
src/net/rtmp/rtmp_relay.cpp
src/net/rtmp/rtmp_relay.hpp
src/net/rtmp/rtmp_relay_mgr.cpp
src/net/rtmp/rtmp_relay_mgr.hpp
src/net/rtprtcp/rtp_packet.cpp
src/net/rtprtcp/rtp_packet.hpp
src/net/rtprtcp/rtcp_fb_pub.hpp
src/net/rtprtcp/rtcp_pspli.hpp
src/net/rtprtcp/rtcp_rr.hpp
src/net/rtprtcp/rtcp_sr.hpp
src/net/rtprtcp/rtcp_xr_dlrr.hpp
src/net/rtprtcp/rtcp_xr_rrt.hpp
src/net/rtprtcp/rtcpfb_nack.hpp
src/net/rtprtcp/rtcpfb_remb.hpp
src/net/rtprtcp/rtprtcp_pub.hpp
src/net/websocket/ws_format.cpp
src/net/websocket/ws_format.hpp
src/net/websocket/ws_server.cpp
src/net/websocket/ws_server.hpp
src/net/websocket/ws_session.cpp
src/net/websocket/ws_session.hpp
src/net/websocket/wsimple/protoo_pub.hpp
src/net/websocket/wsimple/flv_websocket.cpp
src/net/websocket/wsimple/flv_websocket.hpp
src/net/websocket/wsimple/protoo_server.cpp
src/net/websocket/wsimple/protoo_server.hpp
src/net/stun/stun_packet.cpp
src/net/stun/stun_packet.hpp
src/net/webrtc/rtc_session_pub.hpp
src/net/webrtc/rtc_stream_pub.hpp
src/net/webrtc/webrtc_pub.hpp
src/net/webrtc/room_service.cpp
src/net/webrtc/room_service.hpp
src/net/webrtc/sdp_analyze.cpp
src/net/webrtc/sdp_analyze.hpp
src/net/webrtc/user_info.cpp
src/net/webrtc/user_info.hpp
src/net/webrtc/rtc_media_info.cpp
src/net/webrtc/rtc_media_info.hpp
src/net/webrtc/rtc_base_session.cpp
src/net/webrtc/rtc_base_session.hpp
src/net/webrtc/webrtc_session.cpp
src/net/webrtc/webrtc_session.hpp
src/net/webrtc/rtc_subscriber.cpp
src/net/webrtc/rtc_subscriber.hpp
src/net/webrtc/rtc_dtls.cpp
src/net/webrtc/rtc_dtls.hpp
src/net/webrtc/srtp_session.cpp
src/net/webrtc/srtp_session.hpp
src/net/webrtc/support_rtc_info.cpp
src/net/webrtc/support_rtc_info.hpp
src/net/webrtc/rtc_publisher.cpp
src/net/webrtc/rtc_publisher.hpp
src/net/webrtc/rtp_recv_stream.cpp
src/net/webrtc/rtp_recv_stream.hpp
src/net/webrtc/rtp_send_stream.cpp
src/net/webrtc/rtp_send_stream.hpp
src/net/webrtc/nack_generator.cpp
src/net/webrtc/nack_generator.hpp
src/net/webrtc/pack_handle_audio.hpp
src/net/webrtc/pack_handle_pub.hpp
src/net/webrtc/jitterbuffer.cpp
src/net/webrtc/jitterbuffer.hpp
src/net/webrtc/jitterbuffer_pub.hpp
src/net/webrtc/pack_handle_h264.cpp
src/net/webrtc/pack_handle_h264.hpp
src/net/webrtc/pack_handle_vp8.cpp
src/net/webrtc/pack_handle_vp8.hpp
src/net/webrtc/rtp_h264_pack.cpp
src/net/webrtc/rtp_h264_pack.hpp
src/net/webrtc/rtmp2rtc.cpp
src/net/webrtc/rtmp2rtc.hpp
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/bwe_defines.cc
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/include/bwe_defines.h
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/inter_arrival.cc
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/inter_arrival.h
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/overuse_detector.cc
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/overuse_detector.h
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/rate_control.cc
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/rate_control.h
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/overuse_estimator.h
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/overuse_estimator.cc
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/overuse_estimator.h
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc
src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h
src/net/httpflv/httpflv_server.cpp
src/net/httpflv/httpflv_server.hpp
src/net/httpflv/httpflv_writer.cpp
src/net/httpflv/httpflv_writer.hpp
src/net/httpapi/httpapi_server.cpp
src/net/httpapi/httpapi_server.hpp
src/utils/base64.cpp
src/utils/base64.h
src/utils/ipaddress.hpp
src/utils/session_aliver.hpp
src/utils/stream_statics.hpp
src/utils/stringex.hpp
src/utils/timeex.hpp
src/utils/timer.hpp
src/utils/uuid.hpp
src/utils/logger.cpp
src/utils/logger.hpp
src/utils/config.cpp
src/utils/config.hpp
src/utils/data_buffer.cpp
src/utils/data_buffer.hpp
src/utils/byte_stream.cpp
src/utils/byte_stream.hpp
src/utils/byte_crypto.cpp
src/utils/byte_crypto.hpp
src/utils/av/media_stream_manager.cpp
src/utils/av/media_stream_manager.hpp
src/utils/av/gop_cache.cpp
src/utils/av/gop_cache.hpp)
add_dependencies(cpp_media_server ffmpeg openssl sdptransform libsrtp libx264 libopus)
IF (APPLE)
target_link_libraries(cpp_media_server pthread dl z m
srtp2 ssl crypto pthread sdptransform
avfilter avformat avcodec avutil postproc swscale swresample
uv)
ELSEIF (UNIX)
target_link_libraries(cpp_media_server
avfilter avformat avcodec avutil postproc swscale swresample
x264 fdk-aac opus
ssl crypto
srtp2 pthread sdptransform
pthread rt dl z m bz2
uv)
ENDIF ()
#IF (NATIVE_CLIENT STREQUAL on)
#add_executable(native_client
# src/native_client/client.cpp
# src/native_client/base_player.cpp
# src/native_client/base_player.hpp
# src/native_client/rtmp_player.cpp
# src/native_client/rtmp_player.hpp
# src/native_client/httpflv_player.cpp
# src/native_client/httpflv_player.hpp
# src/native_client/sdl_player.hpp
# src/native_client/sdl_player.cpp
# src/format/flv/flv_demux.cpp
# src/format/flv/flv_demux.hpp
# src/net/http/http_client.cpp
# src/net/http/http_client.hpp
# src/net/rtmp/rtmp_client_session.cpp
# src/net/rtmp/rtmp_client_session.hpp
# src/net/rtmp/rtmp_session_base.cpp
# src/net/rtmp/rtmp_session_base.hpp
# src/net/rtmp/rtmp_control_handler.cpp
# src/net/rtmp/rtmp_control_handler.hpp
# src/net/rtmp/rtmp_handshake.cpp
# src/net/rtmp/rtmp_handshake.hpp
# src/net/rtmp/chunk_stream.cpp
# src/net/rtmp/chunk_stream.hpp
# src/utils/logger.cpp
# src/utils/logger.hpp
# src/utils/data_buffer.cpp
# src/utils/data_buffer.hpp
# src/utils/byte_stream.cpp
# src/utils/byte_stream.hpp
# src/transcode/transcode_pub.hpp
# src/transcode/decode.cpp
# src/transcode/decode.hpp
# src/transcode/filter.cpp
# src/transcode/filter.hpp
# )
#add_dependencies(native_client ffmpeg openssl libx264 libopus sdl)
#
#IF (APPLE)
#target_link_libraries(native_client pthread dl z m ssl crypto pthread
# SDL2 iconv bz2
# "-framework CoreFoundation -framework Security -framework VideoToolbox -framework CoreMedia -framework CoreVideo -framework AudioToolbox"
# avfilter avformat avcodec avutil postproc swscale swresample
# uv)
#ENDIF ()
#
#ENDIF()