-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
126 lines (97 loc) · 4.57 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
cmake_minimum_required (VERSION 2.6)
project(srs_librtmp)
option(BUILD_WITH_TEST "build with demo " OFF)
option(BUILD_WITH_STATIC "build with static" ON)
option(BUILD_WITH_SHARD "build with shard" OFF)
#configure_file(${CMAKE_CURRENT_LIST_DIR}srs_auto_headers.hpp.in )
set(SRC_ROOT ${CMAKE_CURRENT_LIST_DIR}/src)
include_directories(${CMAKE_CURRENT_LIST_DIR}/objs)
include_directories(${SRC_ROOT}/core)
include_directories(${SRC_ROOT}/kernel)
include_directories(${SRC_ROOT}/libs)
include_directories(${SRC_ROOT}/protocol)
file(GLOB OBJS_HEADERS "${CMAKE_CURRENT_LIST_DIR}/objs/*.h*" )
file(GLOB CORE_HEADERS "${SRC_ROOT}/core/*.h*" )
file(GLOB CORE_SRCS "${SRC_ROOT}/core/*.c*")
file(GLOB KERNEL_HEADERS "${SRC_ROOT}/kernel/*.h*" )
file(GLOB KERNEL_SRCS "${SRC_ROOT}/kernel/*.c*")
file(GLOB LIBS_HEADERS "${SRC_ROOT}/libs/*.h*" )
file(GLOB LIBS_SRCS "${SRC_ROOT}/libs/*.c*")
file(GLOB PROTOCOL_HEADERS "${SRC_ROOT}/protocol/*.h*" )
file(GLOB PROTOCOL_SRCS "${SRC_ROOT}/protocol/*.c*")
if(BUILD_WITH_STATIC)
option(BUILD_IMP_DISABLE " Disable IMP lib" ON)
if(BUILD_IMP_DISABLE)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
string(REPLACE "/Ob0" "" ${CompilerFlag} "${${CompilerFlag}}")
string(REPLACE "/TC" "" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
endif()
add_library(srs_librtmp STATIC ${OBJS_HEADERS}
${CORE_HEADERS} ${CORE_SRCS}
${KERNEL_HEADERS} ${KERNEL_SRCS}
${LIBS_HEADERS} ${LIBS_SRCS}
${PROTOCOL_HEADERS} ${PROTOCOL_SRCS})
install(TARGETS srs_librtmp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib )
endif()
if(BUILD_WITH_SHARD)
set(LIB_NAME srs_librtmp)
if(BUILD_WITH_STATIC)
set(LIB_NAME srs_librtmp_shared)
endif()
add_library(${LIB_NAME} SHARED ${ROOT_HEADERS} ${ROOT_SRCS}
${CORE_HEADERS} ${CORE_SRCS}
${KERNEL_HEADERS} ${KERNEL_SRCS}
${LIBS_HEADERS} ${LIBS_SRCS}
${PROTOCOL_HEADERS} ${PROTOCOL_SRCS})
install(TARGETS ${LIB_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib )
endif()
if(BUILD_WITH_TEST)
if(UNIX)
set(EXTRA_LIBS ${EXTRA_LIBS} stdc++ z pthread dl)
elseif(MSVC)
set(EXTRA_LIBS ${EXTRA_LIBS} ws2_32 winmm vfw32 wininet Userenv)
endif()
add_executable(srs_aac_raw_publish ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_aac_raw_publish.c)
TARGET_LINK_LIBRARIES(srs_aac_raw_publish srs_librtmp ${EXTRA_LIBS})
add_executable(srs_bandwidth_check ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_bandwidth_check.c)
TARGET_LINK_LIBRARIES(srs_bandwidth_check srs_librtmp ${EXTRA_LIBS})
add_executable(srs_detect_rtmp ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_detect_rtmp.c)
TARGET_LINK_LIBRARIES(srs_detect_rtmp srs_librtmp ${EXTRA_LIBS})
add_executable(srs_flv_injecter ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_flv_injecter.c)
TARGET_LINK_LIBRARIES(srs_flv_injecter srs_librtmp ${EXTRA_LIBS})
add_executable(srs_flv_parser ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_flv_parser.c)
TARGET_LINK_LIBRARIES(srs_flv_parser srs_librtmp ${EXTRA_LIBS})
add_executable(srs_h264_raw_publish ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_h264_raw_publish.c)
TARGET_LINK_LIBRARIES(srs_h264_raw_publish srs_librtmp ${EXTRA_LIBS})
add_executable(srs_ingest_flv ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_ingest_flv.c)
TARGET_LINK_LIBRARIES(srs_ingest_flv srs_librtmp ${EXTRA_LIBS})
add_executable(srs_ingest_rtmp ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_ingest_rtmp.c)
TARGET_LINK_LIBRARIES(srs_ingest_rtmp srs_librtmp ${EXTRA_LIBS})
add_executable(srs_play ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_play.c)
TARGET_LINK_LIBRARIES(srs_play srs_librtmp ${EXTRA_LIBS})
add_executable(srs_publish ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_publish.c)
TARGET_LINK_LIBRARIES(srs_publish srs_librtmp ${EXTRA_LIBS})
add_executable(srs_rtmp_dump ${CMAKE_CURRENT_LIST_DIR}/research/librtmp/srs_rtmp_dump.c)
TARGET_LINK_LIBRARIES(srs_rtmp_dump srs_librtmp ${EXTRA_LIBS})
endif()
install(FILES ${ROOT_HEADERS} ${CORE_HEADERS} ${KERNEL_HEADERS} ${LIBS_HEADERS} ${PROTOCOL_HEADERS} DESTINATION include )
install(TARGETS ${PG_LIB_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib )