File: CMakeLists.txt

package info (click to toggle)
crtmpserver 1.0~dfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,372 kB
  • ctags: 7,905
  • sloc: cpp: 56,355; sh: 411; makefile: 21
file content (195 lines) | stat: -rw-r--r-- 7,358 bytes parent folder | download | duplicates (3)
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
cmake_minimum_required(VERSION 2.6.3)

IF(DEFINED CMAKE_BUILD_TYPE)
     SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel")
ELSE(DEFINED CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel")
ENDIF(DEFINED CMAKE_BUILD_TYPE)

PROJECT(all)

IF(NOT DEFINED CRTMPSERVER_SOURCES_ROOT)
	SET(CRTMPSERVER_SOURCES_ROOT "../../sources")
ENDIF(NOT DEFINED CRTMPSERVER_SOURCES_ROOT)
GET_FILENAME_COMPONENT(CRTMPSERVER_SOURCES_ROOT "${CRTMPSERVER_SOURCES_ROOT}" ABSOLUTE)
#MESSAGE("CRTMPSERVER_SOURCES_ROOT: ${CRTMPSERVER_SOURCES_ROOT}")

IF(NOT DEFINED CRTMPSERVER_CONSTANTS_ROOT)
    SET(CRTMPSERVER_CONSTANTS_ROOT "../../constants")
ENDIF(NOT DEFINED CRTMPSERVER_CONSTANTS_ROOT)
GET_FILENAME_COMPONENT(CRTMPSERVER_CONSTANTS_ROOT "${CRTMPSERVER_CONSTANTS_ROOT}" ABSOLUTE)
#MESSAGE("CRTMPSERVER_CONSTANTS_ROOT: ${CRTMPSERVER_CONSTANTS_ROOT}")

IF(NOT DEFINED CRTMPSERVER_3RDPARTY_ROOT)
	SET(CRTMPSERVER_3RDPARTY_ROOT "../../3rdparty")
ENDIF(NOT DEFINED CRTMPSERVER_3RDPARTY_ROOT)
GET_FILENAME_COMPONENT(CRTMPSERVER_3RDPARTY_ROOT "${CRTMPSERVER_3RDPARTY_ROOT}" ABSOLUTE)
#MESSAGE("CRTMPSERVER_3RDPARTY_ROOT: ${CRTMPSERVER_3RDPARTY_ROOT}")

SET(CRTMPSERVER_ROOT "lib/crtmpserver")

IF(DEFINED CRTMPSERVER_INSTALL_PREFIX)
	SET(CMAKE_INSTALL_PREFIX ${CRTMPSERVER_INSTALL_PREFIX})
	SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
	SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
	SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CRTMPSERVER_ROOT}")
	SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${CRTMPSERVER_ROOT}")
ELSE(DEFINED CRTMPSERVER_INSTALL_PREFIX)
	SET(CMAKE_INSTALL_PREFIX /tmp/crtmpserver)
ENDIF(DEFINED CRTMPSERVER_INSTALL_PREFIX)

#sample commit to trigger HUDSON

#detect additional libraries
SET(OpenSSL_FIND_REQUIRED true)
SET(CRYPTO_FIND_REQUIRED true)
INCLUDE(cmake_find_modules/Find_openssl.cmake)
INCLUDE(cmake_find_modules/Find_dl.cmake)
INCLUDE(cmake_find_modules/pch_support.cmake)
INCLUDE(CMakeDetermineSystem)
INCLUDE(TestBigEndian)
INCLUDE(FindPkgConfig)

#setup the endianess if not already defined in toolchain file
if(NOT DEFINED NO_ENDIANESS)
	TEST_BIG_ENDIAN(ENDIANESS)
	IF(ENDIANESS)
		ADD_DEFINITIONS(-DBIG_ENDIAN_BYTE_ALIGNED)
	ELSE(ENDIANESS)
		ADD_DEFINITIONS(-DLITTLE_ENDIAN_BYTE_ALIGNED)
	ENDIF(ENDIANESS)
ENDIF(NOT DEFINED NO_ENDIANESS)

#supported features
ADD_DEFINITIONS(-DHAS_PROTOCOL_HTTP)
ADD_DEFINITIONS(-DHAS_PROTOCOL_RTMP)
ADD_DEFINITIONS(-DHAS_PROTOCOL_LIVEFLV)
ADD_DEFINITIONS(-DHAS_PROTOCOL_RTP)
ADD_DEFINITIONS(-DHAS_PROTOCOL_TS)
ADD_DEFINITIONS(-DHAS_PROTOCOL_VAR)
ADD_DEFINITIONS(-DHAS_PROTOCOL_CLI)
#ADD_DEFINITIONS(-DHAS_PROTOCOL_MMS)
ADD_DEFINITIONS(-DHAS_PROTOCOL_HLS)
#ADD_DEFINITIONS(-DHAS_PROTOCOL_RAWHTTPSTREAM)
ADD_DEFINITIONS(-DHAS_MEDIA_MP3)
ADD_DEFINITIONS(-DHAS_MEDIA_MP4)
ADD_DEFINITIONS(-DHAS_MEDIA_FLV)
#ADD_DEFINITIONS(-DHAS_MEDIA_NSV)
#ADD_DEFINITIONS(-DHAS_SYSLOG)
IF($ENV{COMPILE_STATIC} MATCHES "1")
	MESSAGE(STATUS "Compile static")
	ADD_DEFINITIONS(-DCOMPILE_STATIC)
	SET(LIB_TYPE STATIC)
	ADD_SUBDIRECTORY(lua lua)
	ADD_SUBDIRECTORY(tinyxml tinyxml)
	SET(LUA_LIBRARY_PATH "lua")
	SET(LUA_INCLUDE_PATH "${CRTMPSERVER_3RDPARTY_ROOT}/lua-dev")
	SET(TINYXML_LIBRARY_PATH "tinyxml")
	SET(TINYXML_INCLUDE_PATH "${CRTMPSERVER_3RDPARTY_ROOT}/tinyxml")
#	SET(TEMP_EXE_LINK_C_FLAGS "${CMAKE_EXE_LINK_STATIC_C_FLAGS}")
#	SET(TEMP_EXE_LINK_CXX_FLAGS "${CMAKE_EXE_LINK_STATIC_CXX_FLAGS}")
#	SET(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS ${TEMP_EXE_LINK_C_FLAGS})
#	SET(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS ${TEMP_EXE_LINK_CXX_FLAGS})
#	SET(CMAKE_EXE_LINK_STATIC_C_FLAGS ${TEMP_EXE_LINK_C_FLAGS})
#	SET(CMAKE_EXE_LINK_STATIC_CXX_FLAGS ${TEMP_EXE_LINK_CXX_FLAGS})
ELSE($ENV{COMPILE_STATIC} MATCHES "1")
	MESSAGE(STATUS "Compile dynamic")
	SET(LIB_TYPE SHARED)
	
	INCLUDE(cmake_find_modules/Find_lua.cmake)
	IF(NOT LUA_FOUND)
		ADD_SUBDIRECTORY(lua lua)
	ENDIF(NOT LUA_FOUND)

       PKG_CHECK_MODULES(TINYXML REQUIRED tinyxml)
ENDIF($ENV{COMPILE_STATIC} MATCHES "1")

#fine tunning
ADD_DEFINITIONS(-DCreateRTCPPacket=CreateRTCPPacket_mystyle_only_once)
ADD_DEFINITIONS(-DFeedDataAudioMPEG4Generic=FeedDataAudioMPEG4Generic_one_by_one)
ADD_DEFINITIONS(-DHandleTSVideoData=HandleVideoData_version3)

ADD_DEFINITIONS(-DHAS_LUA)

#INCLUDE(cmake_find_modules/Find_v8.cmake)
#IF(V8_FOUND)
#    ADD_DEFINITIONS(-DHAS_V8)
#ENDIF(V8_FOUND)

#memory pool
#ADD_DEFINITIONS(-DUSE_MEM_POOL)
#ADD_DEFINITIONS(-DDEBUG_MEM_POOL)

SET(GENERIC_FLAGS "-Wall")

#add 64 bit support for 32 but platforms
ADD_DEFINITIONS(-D__USE_FILE_OFFSET64)
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
MESSAGE(STATUS "We have a ${CMAKE_SYSTEM} system")
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
	SET(GENERIC_FLAGS "${GENERIC_FLAGS} -fPIC")
	IF(DEFINED SOCKREACTOR)
		ADD_DEFINITIONS(-D${SOCKREACTOR})
	ELSE(DEFINED SOCKREACTOR)
		ADD_DEFINITIONS(-DNET_KQUEUE)
	ENDIF(DEFINED SOCKREACTOR)
	STRING(TOLOWER ${CMAKE_SYSTEM} TEMP_CMAKE_SYSTEM)
	STRING(REGEX MATCH "kfreebsd*" TEMP_CMAKE_SYSTEM_MATCH ${TEMP_CMAKE_SYSTEM})
	IF(TEMP_CMAKE_SYSTEM_MATCH MATCHES "kfreebsd")
		ADD_DEFINITIONS(-DDFREEBSD)
	ELSE(TEMP_CMAKE_SYSTEM_MATCH MATCHES "kfreebsd")
		ADD_DEFINITIONS(-DFREEBSD)
		INCLUDE(cmake_find_modules/Find_execinfo.cmake)
	ENDIF(TEMP_CMAKE_SYSTEM_MATCH MATCHES "kfreebsd")
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
	SET(GENERIC_FLAGS "${GENERIC_FLAGS} -mmacosx-version-min=10.5")
	ADD_DEFINITIONS(-DOSX)
	IF(DEFINED SOCKREACTOR)
		ADD_DEFINITIONS(-D${SOCKREACTOR})
	ELSE(DEFINED SOCKREACTOR)
		ADD_DEFINITIONS(-DNET_KQUEUE)
	ENDIF(DEFINED SOCKREACTOR)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
	SET(GENERIC_FLAGS "${GENERIC_FLAGS} -fPIC")
	ADD_DEFINITIONS(-DLINUX)
	IF(DEFINED SOCKREACTOR)
		ADD_DEFINITIONS(-D${SOCKREACTOR})
	ELSE(DEFINED SOCKREACTOR)
		ADD_DEFINITIONS(-DNET_EPOLL)
	ENDIF(DEFINED SOCKREACTOR)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
	SET(GENERIC_FLAGS "${GENERIC_FLAGS} -fPIC")
	ADD_DEFINITIONS(-DSOLARIS)
	ADD_DEFINITIONS(-DDONT_DEFINE_HTONLL)
	ADD_DEFINITIONS(-DNET_SELECT)
	SET(SOCKET_LIB "-lsocket")
ELSE(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
	MESSAGE(FATAL_ERROR "Platform ${CMAKE_SYSTEM_NAME} not supported yet")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")

#debug/release
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GENERIC_FLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GENERIC_FLAGS}")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DWITH_SANITY_INPUT_BUFFER -DVALIDATE_FROMAT_SPECIFIERS -Wformat=2")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -fno-strict-aliasing")
#SET(CMAKE_VERBOSE_MAKEFILE TRUE)

#generate defines.h
IF (EXISTS ${CRTMPSERVER_SOURCES_ROOT}/common/include/defines.h)
	MESSAGE(STATUS "Defines are in place")
ELSE (EXISTS ${CRTMPSERVER_SOURCES_ROOT}/common/include/defines.h)
	MESSAGE(STATUS "We need to rebuild the defines")
	EXECUTE_PROCESS(COMMAND lua ${CRTMPSERVER_CONSTANTS_ROOT}/constants.lua cpp ${CRTMPSERVER_SOURCES_ROOT}/common/include/defines.h)
ENDIF(EXISTS ${CRTMPSERVER_SOURCES_ROOT}/common/include/defines.h)


#ADD_DEFINITIONS(-DHAS_SAFE_LOGGER)
ADD_SUBDIRECTORY(common common)
ADD_SUBDIRECTORY(thelib thelib)
#ADD_SUBDIRECTORY(vm vm)
ADD_SUBDIRECTORY(applications applications)
ADD_SUBDIRECTORY(crtmpserver crtmpserver)
#ADD_SUBDIRECTORY(vmtests vmtests)
#ADD_SUBDIRECTORY(tests)
#ADD_SUBDIRECTORY(androidapplestreaming androidapplestreaming)