CMakeLists.txt 4.46 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
############################################################################
# CMakeLists.txt
# Copyright (C) 2014  Belledonne Communications, Grenoble France
#
############################################################################
#
# 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
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
############################################################################

23
set(INCLUDES ${ANTLR3C_INCLUDE_DIR})
24
set(LIBS ${ANTLR3C_LIBRARIES})
25 26

if(${CMAKE_USE_PTHREADS_INIT} AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "QNX")
27
	list(APPEND LIBS pthread)
28
endif(${CMAKE_USE_PTHREADS_INIT} AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "QNX")
29 30 31
if(${HAVE_LIBDL})
	list(APPEND LIBS dl)
endif(${HAVE_LIBDL})
Ghislain MARY's avatar
Ghislain MARY committed
32

33 34 35 36 37 38 39 40
set(SDP_GENERATED_SOURCE_FILES
	${CMAKE_CURRENT_BINARY_DIR}/belle_sdpLexer.c
	${CMAKE_CURRENT_BINARY_DIR}/belle_sdpLexer.h
	${CMAKE_CURRENT_BINARY_DIR}/belle_sdpParser.c
	${CMAKE_CURRENT_BINARY_DIR}/belle_sdpParser.h
)
add_custom_command(
	OUTPUT ${SDP_GENERATED_SOURCE_FILES}
41 42
	COMMAND ${Java_JAVA_EXECUTABLE} -jar ${ANTLR3_JAR_PATH} -make -Xmultithreaded -fo ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/grammars/belle_sdp.g
	DEPENDS grammars/belle_sdp.g
43 44 45 46 47 48 49 50 51 52
)

set(SIP_MESSAGE_GENERATED_SOURCE_FILES
	${CMAKE_CURRENT_BINARY_DIR}/belle_sip_messageLexer.c
	${CMAKE_CURRENT_BINARY_DIR}/belle_sip_messageLexer.h
	${CMAKE_CURRENT_BINARY_DIR}/belle_sip_messageParser.c
	${CMAKE_CURRENT_BINARY_DIR}/belle_sip_messageParser.h
)
add_custom_command(
	OUTPUT ${SIP_MESSAGE_GENERATED_SOURCE_FILES}
53 54
	COMMAND ${Java_JAVA_EXECUTABLE} -jar ${ANTLR3_JAR_PATH} -make -Xmultithreaded -fo ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/grammars/belle_sip_message.g
	DEPENDS grammars/belle_sip_message.g
55 56
)

57 58 59 60 61 62 63
set_source_files_properties(${GRAMMARS_SOURCE_FILES} ${SIP_MESSAGE_GENERATED_SOURCE_FILES} PROPERTIES GENERATED TRUE)

if(${ENABLE_TLS})
	set(TLS_SOURCE_FILES
		transports/tls_listeningpoint_polarssl.c
		transports/tls_channel_polarssl.c
	)
64
	list(APPEND INCLUDES ${POLARSSL_INCLUDE_DIR})
65 66 67 68 69 70 71 72 73 74 75 76
	list(APPEND LIBS ${POLARSSL_LIBRARIES})
endif(${ENABLE_TLS})

if(${ENABLE_TUNNEL})
	set(TUNNEL_SOURCE_FILES
		transports/tunnel_listeningpoint.c
		transports/tunnel_channel.c
		transports/tunnel_wrapper.cc
	)
	list(APPEND LIBS ${TUNNEL_LIBRARIES})
endif(${ENABLE_TUNNEL})

77 78 79 80
set(SOURCE_FILES
	auth_event.c
	auth_helper.c
	belle_sdp_impl.c
81
	belle_sip_dict.c
82
	belle_sip_headers_impl.c
83
	belle_sip_internal.h
84 85 86 87 88 89 90
	belle_sip_loop.c
	belle_sip_object.c
	belle_sip_parameters.c
	belle_sip_resolver.c
	belle_sip_uri_impl.c
	belle_sip_utils.c
	channel.c
91 92 93
	channel.h
	clock_gettime.c
	clock_gettime.h
94 95
	dialog.c
	dns.c
96 97 98 99 100
	dns.h
	generic-uri.c
	http-listener.c
	http-message.c
	http-provider.c
101 102 103
	ict.c
	ist.c
	listeningpoint.c
104
	listeningpoint_internal.h
105
	md5.c
106
	md5.h
107 108 109
	message.c
	nict.c
	nist.c
110
	parserutils.h
111
	port.c
112
	port.h
113 114 115 116 117 118
	provider.c
	refresher.c
	siplistener.c
	sipstack.c
	transaction.c
	transports/stream_channel.c
119
	transports/stream_channel.h
120 121 122 123 124
	transports/stream_listeningpoint.c
	transports/udp_channel.c
	transports/udp_listeningpoint.c
	${SDP_GENERATED_SOURCE_FILES}
	${SIP_MESSAGE_GENERATED_SOURCE_FILES}
125 126
	${TLS_SOURCE_FILES}
	${TUNNEL_SOURCE_FILES}
127 128
)

129 130 131 132 133 134 135 136 137 138 139 140 141 142
if(${ENABLE_STATIC})
	add_library(bellesip STATIC ${SOURCE_FILES})
else(${ENABLE_STATIC})
	add_library(bellesip SHARED ${SOURCE_FILES})
	set_target_properties(bellesip PROPERTIES VERSION 0.0.0 SOVERSION 0)
	if(MSVC)
		if(CMAKE_BUILD_TYPE STREQUAL "Debug")
			install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/bellesip.pdb
				DESTINATION bin
				PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
			)
		endif()
	endif(MSVC)
endif(${ENABLE_STATIC})
143 144 145
target_include_directories(bellesip PUBLIC ${INCLUDES})
target_link_libraries(bellesip ${LIBS})

Ghislain MARY's avatar
Ghislain MARY committed
146
install(TARGETS bellesip
147 148 149
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib
150 151
	PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)