CMakeLists.txt 11.6 KB
Newer Older
1 2
############################################################################
# CMakeLists.txt
3
# Copyright (C) 2014-2018  Belledonne Communications, Grenoble France
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 21
#
############################################################################
22

23 24 25 26 27 28 29 30
set(FLEXISIP_LIBS
	${BCTOOLBOX_CORE_LIBRARIES}
	${BELR_LIBRARIES}
	${CMAKE_THREAD_LIBS_INIT}
	${LINPHONECXX_LIBRARIES}
	${ORTP_LIBRARIES}
	${SOFIASIPUA_LIBRARIES}
)
31

32
set(FLEXISIP_INCLUDES )
33

34 35
set(FLEXISIP_DEPENDENCIES)

36
set(FLEXISIP_SOURCES
37
	agent.cc
38 39 40 41
	auth/auth-module.cc
	auth/flexisip-auth-module.cc
	auth/flexisip-auth-module-base.cc
	auth/nonce-store.cc
42 43 44 45
	authdb-file.cc
	authdb.cc
	callcontext-mediarelay.cc
	callstore.cc
46
	cli.cc
47
	cJSON.c
48
	common.cc
49
	sip-boolean-expressions.cc
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
	configdumper.cc
	configmanager.cc
	contact-masquerader.cc
	domain-registrations.cc
	entryfilter.cc
	etchosts.cc
	event.cc
	eventlogs/eventlogs.cc
	forkbasiccontext.cc
	forkcallcontext.cc
	forkcontext.cc
	forkmessagecontext.cc
	h264iframefilter.cc
	log/logmanager.cc
	lpconfig.cc
	mediarelay.cc
	module-auth.cc
67
	module-authentication-base.cc
68 69
	module-contact-route-inserter.cc
	module-dos.cc
70
	module-forward.cc
71
	module-garbage-in.cc
72
	module-gatewayadapter.cc
73 74
	module-loadbalancer.cc
	module-mediarelay.cc
75
	module-nat-helper.cc
76
	module-pushnotification.cc
77
	module-redirect.cc module-presence.cc
78
	module-registrar.cc
79
	module-router.cc
80
	module-sanitychecker.cc
81
	module-statistics-collector.cc
82 83 84
	module-transcode.cc
	module.cc
	monitor.cc
85
	plugin/plugin-loader.cc
86
	pushnotification/pushnotification.cc
87 88 89 90 91 92 93 94
	pushnotification/applepush.cc
	pushnotification/firebasepush.cc
	pushnotification/genericpush.cc
	pushnotification/googlepush.cc
	pushnotification/microsoftpush.cc
	pushnotification/pushnotificationclient_wp.cc
	pushnotification/pushnotificationclient.cc
	pushnotification/pushnotificationservice.cc
95 96 97 98 99
	recordserializer-c.cc
	recordserializer-json.cc
	registrardb-internal.cc
	registrardb.cc
	sdp-modifier.cc
100
	service-server.cc
101 102
	stun.cc
	stun/stun_udp.c
103
	stun/stun.c
104 105 106
	telephone-event-filter.cc
	transaction.cc
	uac-register.cc
107
	utils/digest.cc utils/digest.hh
108
	utils/sip-uri.cc
109
	utils/string-formater.cc
110
	utils/string-utils.cc
111
	utils/threadpool.cc
112
	utils/timer.cc
113
	utils/uri-utils.cc
114
)
115

116
list(APPEND FLEXISIP_INCLUDES ${FLEXISIP_HEADER_DIR} ${BCTOOLBOX_INCLUDE_DIRS} ${BELR_INCLUDE_DIRS})
117

Ghislain MARY's avatar
Ghislain MARY committed
118 119 120 121
if(LIBXSD_FOUND)
	list(APPEND FLEXISIP_LIBS ${LIBXSD_LIBRARIES})
	list(APPEND FLEXISIP_INCLUDES ${LIBXSD_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/xml)
	list(APPEND FLEXISIP_SOURCES xml/fthttp.cc xml/fthttp.hh)
122
endif()
123

124 125 126 127 128
if(ENABLE_MSGPACK)
	message(STATUS "Enabling MSGPACK with includes at ${MSGPACK_INCLUDE_DIRS}")
	list(APPEND FLEXISIP_INCLUDES ${MSGPACK_INCLUDE_DIRS})
	list(APPEND FLEXISIP_SOURCES recordserializer-msgpack.cc)
endif()
129 130 131 132


if(ENABLE_SNMP)
	list(APPEND FLEXISIP_SOURCES snmp-agent.cc snmp-agent.h)
133 134
	list(APPEND FLEXISIP_LIBS ${NET_SNMP_LIBRARIES})
	list(APPEND FLEXISIP_INCLUDES ${NET_SNMP_INCLUDE_DIRS} ${CMAKE_CURRENT_LIST_DIR}/mib)
135 136 137
endif()

if(ENABLE_TRANSCODER)
138 139
	list(APPEND FLEXISIP_SOURCES callcontext-transcoder.cc callcontext-transcoder.hh)
	list(APPEND FLEXISIP_LIBS ${MEDIASTREAMER2_LIBRARIES})
140 141 142 143 144 145 146 147 148
	list(APPEND FLEXISIP_INCLUDES ${MEDIASTREAMER2_INCLUDE_DIRS})
endif()

if(ENABLE_DATEHANDLER)
	list(APPEND FLEXISIP_SOURCES module-datehandler.cc)
endif()

if(ENABLE_REDIS)
	list(APPEND FLEXISIP_SOURCES registrardb-redis-async.cc registrardb-redis.hh registrardb-redis-sofia-event.h)
149
	list(APPEND FLEXISIP_LIBS ${HIREDIS_LIBRARIES})
150 151 152 153 154 155 156 157
	list(APPEND FLEXISIP_INCLUDES ${HIREDIS_INCLUDE_DIRS})
	add_definitions(-DENABLE_REDIS)
endif()

if(ENABLE_PROTOBUF)
	# TODO: generate the protobuf wrapper
	# protoc --proto_path=$(builddir) --cpp_out=$(builddir) $(pb_files)
	set(PROTOBUF_GENERATED_FILES ${CMAKE_CURRENT_BINARY_DIR}/recordserializer-protobuf.pb.cc ${CMAKE_CURRENT_BINARY_DIR}/recordserializer-protobuf.pb.h)
158
	set(PROTOBUF_PROTO ${CMAKE_CURRENT_LIST_DIR}/recordserializer-protobuf.proto)
159
	add_custom_command(OUTPUT ${PROTOBUF_GENERATED_FILES}
160 161
		COMMAND "${PROTOBUF_PROTOC_EXECUTABLE}" "--proto_path=${CMAKE_CURRENT_SOURCE_DIR}" "--cpp_out=${CMAKE_CURRENT_BINARY_DIR}" "${PROTOBUF_PROTO}"
		COMMENT "Generate protobuf wrappers")
162 163 164
	set_source_files_properties(${PROTOBUF_GENERATED_FILES} PROPERTIES GENERATED ON)

	list(APPEND FLEXISIP_SOURCES recordserializer-protobuf.cc ${PROTOBUF_GENERATED_FILES})
165
	list(APPEND FLEXISIP_LIBS ${PROTOBUF_LIBRARIES})
166 167 168 169
	list(APPEND FLEXISIP_INCLUDES ${PROTOBUF_INCLUDE_DIRS})
	add_definitions(-DENABLE_PROTOBUF)
endif()

170 171 172 173 174 175
if(ENABLE_PRESENCE OR ENABLE_MDNS)
	list(APPEND FLEXISIP_LIBS ${BELLESIP_LIBRARIES})
	list(APPEND FLEXISIP_INCLUDES ${BELLESIP_INCLUDE_DIRS})
	add_definitions(-DBELLE_SIP_USE_STL ${BELLE_SIP_CFLAGS})
endif()

176
if(ENABLE_PRESENCE)
Ghislain MARY's avatar
Ghislain MARY committed
177
	if(NOT LIBXSD_FOUND)
178 179
		message(FATAL_ERROR "Presence asked but XSD not enabled! Please enable it first.")
	endif()
Ghislain MARY's avatar
Ghislain MARY committed
180
	add_definitions(-DBELLE_SIP_USE_STL ${BELLE_SIP_CFLAGS})
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
	set(XML_SOURCES
		xml/data-model.cc
		xml/data-model.hh
		xml/pidf+xml.cc
		xml/pidf+xml.hh
		xml/pidf-oma-pres.cc
		xml/pidf-oma-pres.hh
		xml/resource-lists.cc
		xml/resource-lists.hh
		xml/rlmi+xml.cc
		xml/rlmi+xml.hh
		xml/rpid.cc
		xml/rpid.hh
		xml/xml.cc
		xml/xml.hh
	)
197 198
	list(APPEND FLEXISIP_LIBS ${XERCES_LIBS})
	list(APPEND FLEXISIP_INCLUDES presence)
Ghislain MARY's avatar
Ghislain MARY committed
199 200 201 202 203 204
	list(APPEND FLEXISIP_SOURCES
		presence/bellesip-signaling-exception.cc
		presence/bellesip-signaling-exception.hh
		presence/etag-manager.hh
		presence/file-resource-list-manager.cc
		presence/file-resource-list-manager.hh
205 206 207 208
		presence/list-subscription/body-list-subscription.cc
		presence/list-subscription/body-list-subscription.hh
		presence/list-subscription/list-subscription.cc
		presence/list-subscription/list-subscription.hh
Ghislain MARY's avatar
Ghislain MARY committed
209 210 211 212 213 214 215 216 217 218 219
		presence/presence-configmanager.cc
		presence/presence-configmanager.hh
		presence/presence-longterm.cc
		presence/presence-longterm.hh
		presence/presence-server.cc
		presence/presence-server.hh
		presence/presentity-manager.hh
		presence/presentity-presenceinformation.cc
		presence/presentity-presenceinformation.hh
		presence/subscription.cc
		presence/subscription.hh
220
		${XML_SOURCES}
Ghislain MARY's avatar
Ghislain MARY committed
221
	)
222 223 224 225 226 227
	if(ENABLE_SOCI)
		list(APPEND FLEXISIP_SOURCES
			presence/list-subscription/external-list-subscription.cc
			presence/list-subscription/external-list-subscription.hh
		)
	endif()
228 229
endif()

Erwan Croze's avatar
Erwan Croze committed
230
if(ENABLE_CONFERENCE)
231 232
	list(APPEND FLEXISIP_LIBS ${BELLESIP_LIBRARIES} ${LINPHONE_LIBRARIES})
	list(APPEND FLEXISIP_INCLUDES ${BELLESIP_INCLUDE_DIRS} ${LINPHONE_INCLUDE_DIRS})
Erwan Croze's avatar
Erwan Croze committed
233
	list(APPEND FLEXISIP_SOURCES
234 235
		conference/conference-address-generator.cc
		conference/conference-address-generator.hh
Erwan Croze's avatar
Erwan Croze committed
236 237
		conference/conference-server.cc
		conference/conference-server.hh
238 239
		conference/registration-subscription.cc
		conference/registration-subscription.hh
240 241
		conference/participant-registration-subscription-handler.cc
		conference/participant-registration-subscription-handler.hh
Erwan Croze's avatar
Erwan Croze committed
242 243 244
	)
endif()

245
if(ENABLE_PUSHNOTIFICATION)
Ghislain MARY's avatar
Ghislain MARY committed
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
	list(APPEND FLEXISIP_SOURCES
		module-pushnotification.cc
		pushnotification/applepush.cc
		pushnotification/applepush.hh
		pushnotification/firebasepush.cc
		pushnotification/firebasepush.hh
		pushnotification/genericpush.cc
		pushnotification/genericpush.hh
		pushnotification/googlepush.cc
		pushnotification/googlepush.hh
		pushnotification/microsoftpush.cc
		pushnotification/microsoftpush.hh
		pushnotification/pushnotificationclient.cc
		pushnotification/pushnotificationclient.hh
		pushnotification/pushnotificationclient_wp.cc
		pushnotification/pushnotificationclient_wp.hh
		pushnotification/pushnotificationservice.cc
		pushnotification/pushnotificationservice.hh
	)
265
endif()
266

267 268
list(APPEND FLEXISIP_LIBS ${OPENSSL_LIBRARIES})
list(APPEND FLEXISIP_INCLUDES ${OPENSSL_INCLUDE_DIR})
269

270
if(ENABLE_SOCI)
271
	add_definitions(-DENABLE_SOCI)
272
	list(APPEND FLEXISIP_SOURCES authdb-soci.cc soci-helper.cc soci-helper.hh)
273 274 275 276
	list(APPEND FLEXISIP_LIBS ${SOCI_LIBRARY})
	list(APPEND FLEXISIP_INCLUDES ${SOCI_INCLUDE_DIRS} ${SOCI_MYSQL_INCLUDES})
endif()

277 278
message(STATUS "Flexisip LIBS : ${FLEXISIP_LIBS}")
message(STATUS "Flexisip INCLUDES : ${FLEXISIP_INCLUDES}")
279
message(STATUS "Flexisip DEPENDENCIES : ${FLEXISIP_DEPENDENCIES}")
280

281 282
bc_apply_compile_flags(FLEXISIP_SOURCES CPP_BUILD_FLAGS CXX_BUILD_FLAGS)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
283
	if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.0.0)
284 285
		set_source_files_properties(cJSON.c PROPERTIES COMPILE_FLAGS "-Wno-error=misleading-indentation")
	endif()
286
	set_source_files_properties(stun/stun.c PROPERTIES COMPILE_FLAGS "-Wno-error=sign-compare")
287 288 289
	if (ENABLE_PRESENCE AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.1.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 9.1.0))
		set_source_files_properties(${XML_SOURCES} PROPERTIES COMPILE_FLAGS "-Wno-error=deprecated-copy")
	endif()
290 291
endif()

292
add_library(flexisip SHARED ${FLEXISIP_SOURCES})
293 294 295
set_property(TARGET flexisip PROPERTY CXX_STANDARD 11)
set_property(TARGET flexisip PROPERTY CXX_STANDARD_REQUIRED ON)

296
if(FLEXISIP_DEPENDENCIES)
297
	add_dependencies(flexisip ${FLEXISIP_DEPENDENCIES})
298
endif()
299
add_dependencies(flexisip flexisip-git-version)
300
target_compile_features(flexisip PRIVATE cxx_auto_type cxx_variadic_macros)
301 302 303 304 305 306 307 308 309 310 311
target_link_libraries(flexisip ${FLEXISIP_LIBS})
target_include_directories(flexisip PUBLIC ${FLEXISIP_INCLUDES})

add_executable(flexisip_server main.cc)
set_property(TARGET flexisip_server PROPERTY OUTPUT_NAME flexisip)
set_property(TARGET flexisip_server PROPERTY CXX_STANDARD 11)
set_property(TARGET flexisip_server PROPERTY CXX_STANDARD_REQUIRED ON)
target_compile_features(flexisip_server PRIVATE cxx_auto_type cxx_variadic_macros)
target_link_libraries(flexisip_server flexisip)

install(TARGETS flexisip flexisip_server
312 313 314
	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
315 316
	PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
317

318 319 320 321 322 323 324 325 326 327 328 329
add_executable(flexisip_pusher tools/pusher.cc)
target_link_libraries(flexisip_pusher flexisip)
set_property(TARGET flexisip_pusher PROPERTY CXX_STANDARD 11)
set_property(TARGET flexisip_pusher PROPERTY CXX_STANDARD_REQUIRED ON)

install(TARGETS flexisip_pusher
	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
	PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

330
# Build plugins.
331 332 333 334
if(ENABLE_EXTERNAL_AUTH_PLUGIN)
    add_subdirectory(plugin/external-auth-plugin)
endif()

335 336 337
if(ENABLE_JWE_AUTH_PLUGIN)
	add_subdirectory(plugin/jwe-auth-plugin)
endif()
338

339

340 341 342 343 344 345
add_executable(flexisip_serializer tools/serializer.cc)
target_link_libraries(flexisip_serializer flexisip)
set_property(TARGET flexisip_serializer PROPERTY CXX_STANDARD 11)
set_property(TARGET flexisip_serializer PROPERTY CXX_STANDARD_REQUIRED ON)

install(TARGETS flexisip_serializer
346 347 348
	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
349 350
	PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)