-
Notifications
You must be signed in to change notification settings - Fork 35
/
CMakeLists.txt
179 lines (162 loc) · 6.44 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
cmake_minimum_required(VERSION 3.7.1)
project(cpp_media_server)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wno-deprecated -Wno-deprecated-declarations -Wno-reorder -Wall -fexceptions -frtti -D__STDC_FORMAT_MACROS -fPIC")
set(CMAKE_CXX_STANDARD 11)
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(./
./net
./net/http
./net/rtmp
./net/websocket
./net/websocket/wsimple
./net/tcp
./net/stun
./net/httpflv
./net/rtprtcp
./format
./format/flv
./utils
./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(echo_demo net/tcp/echo_demo.cpp
utils/logger.cpp
utils/data_buffer.cpp)
IF (APPLE)
target_link_libraries(echo_demo pthread dl z m boost_thread boost_system)
ELSEIF (UNIX)
target_link_libraries(echo_demo pthread rt dl z m boost_thread boost_system)
ENDIF ()
add_executable(flv_demux_demo
format/flv/flv_demux.cpp
format/flv/flv_demux_demo.cpp
utils/logger.cpp
utils/data_buffer.cpp
utils/byte_stream.cpp)
IF (APPLE)
target_link_libraries(flv_demux_demo pthread dl z m boost_thread boost_system)
ELSEIF (UNIX)
target_link_libraries(flv_demux_demo pthread rt dl z m boost_thread boost_system)
ENDIF ()
add_executable(flv_mux_demo
format/flv/flv_mux.cpp
format/flv/flv_demux.cpp
format/flv/flv_mux_demo.cpp
utils/logger.cpp
utils/data_buffer.cpp
utils/byte_stream.cpp)
IF (APPLE)
target_link_libraries(flv_mux_demo pthread dl z m boost_thread boost_system)
ELSEIF (UNIX)
target_link_libraries(flv_mux_demo pthread rt dl z m boost_thread boost_system)
ENDIF ()
add_executable(http_server_demo
net/http/http_server_demo.cpp
net/http/http_server.cpp
net/http/http_session.cpp
utils/data_buffer.cpp
utils/logger.cpp)
IF (APPLE)
target_link_libraries(http_server_demo pthread dl z m boost_thread boost_system)
ELSEIF (UNIX)
target_link_libraries(http_server_demo pthread rt dl z m boost_thread boost_system)
ENDIF ()
add_executable(rtmp_play_demo
net/rtmp/client_demo/rtmp_play_demo.cpp
net/rtmp/rtmp_client_session.cpp
net/rtmp/rtmp_session_base.cpp
net/rtmp/rtmp_control_handler.cpp
net/rtmp/rtmp_handshake.cpp
net/rtmp/chunk_stream.cpp
format/flv/flv_mux.cpp
utils/logger.cpp
utils/data_buffer.cpp
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 boost_thread boost_system)
ELSEIF (UNIX)
target_link_libraries(rtmp_play_demo pthread rt dl z m ssl crypto pthread boost_thread boost_system)
ENDIF ()
add_executable(rtmp_publish_demo
net/rtmp/client_demo/rtmp_publish_demo.cpp
net/rtmp/rtmp_client_session.cpp
net/rtmp/rtmp_session_base.cpp
net/rtmp/rtmp_control_handler.cpp
net/rtmp/rtmp_handshake.cpp
net/rtmp/chunk_stream.cpp
format/flv/flv_demux.cpp
format/flv/flv_mux.cpp
utils/logger.cpp
utils/data_buffer.cpp
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 boost_thread boost_system)
ELSEIF (UNIX)
target_link_libraries(rtmp_publish_demo pthread rt dl z m ssl crypto pthread boost_thread boost_system)
ENDIF ()
add_executable(media_server
media_server.cpp
format/flv/flv_demux.cpp
format/flv/flv_mux.cpp
net/http/http_session.cpp
net/http/http_server.cpp
net/rtmp/rtmp_server.cpp
net/rtmp/rtmp_server_session.cpp
net/rtmp/rtmp_client_session.cpp
net/rtmp/rtmp_session_base.cpp
net/rtmp/rtmp_control_handler.cpp
net/rtmp/rtmp_handshake.cpp
net/rtmp/chunk_stream.cpp
net/rtmp/rtmp_writer.cpp
net/rtprtcp/rtp_packet.cpp
net/websocket/ws_server.cpp
net/websocket/ws_session.cpp
net/websocket/ws_service_imp.cpp
net/websocket/wsimple/flv_websocket.cpp
net/websocket/wsimple/protoo_server.cpp
net/stun/stun_packet.cpp
net/webrtc/room_service.cpp
net/webrtc/sdp_analyze.cpp
net/webrtc/user_info.cpp
net/webrtc/rtc_media_info.cpp
net/webrtc/rtc_base_session.cpp
net/webrtc/webrtc_session.cpp
net/webrtc/rtc_subscriber.cpp
net/webrtc/rtc_dtls.cpp
net/webrtc/srtp_session.cpp
net/webrtc/support_rtc_info.cpp
net/webrtc/rtc_publisher.cpp
net/webrtc/rtp_recv_stream.cpp
net/webrtc/rtp_send_stream.cpp
net/webrtc/nack_generator.cpp
net/httpflv/httpflv_server.cpp
net/httpflv/httpflv_writer.cpp
utils/logger.cpp
utils/data_buffer.cpp
utils/byte_stream.cpp
utils/byte_crypto.cpp
utils/av/media_stream_manager.cpp
utils/av/gop_cache.cpp)
add_dependencies(media_server openssl sdptransform libsrtp)
IF (APPLE)
target_link_libraries(media_server pthread dl z m srtp2 ssl crypto pthread boost_thread boost_system sdptransform)
ELSEIF (UNIX)
target_link_libraries(media_server pthread rt dl z m srtp2 ssl crypto pthread boost_thread boost_system sdptransform)
ENDIF ()