CMakeLists.txt 4.74 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

Ghislain MARY's avatar
Ghislain MARY committed
26 27 28 29 30
if(${Threads_FOUND})
	if(${CMAKE_USE_PTHREADS_INIT} AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "QNX")
		list(APPEND LIBS pthread)
	endif(${CMAKE_USE_PTHREADS_INIT} AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "QNX")
endif(${Threads_FOUND})
31 32 33
if(${HAVE_LIBDL})
	list(APPEND LIBS dl)
endif(${HAVE_LIBDL})
34 35 36
if(${HAVE_RESINIT})
	list(APPEND LIBS resolv)
endif(${HAVE_RESINIT})
Ghislain MARY's avatar
Ghislain MARY committed
37

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

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

62 63 64 65 66 67 68
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
	)
69
	list(APPEND INCLUDES ${POLARSSL_INCLUDE_DIR})
70 71 72 73 74 75 76 77 78 79 80 81
	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})

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

134 135 136 137
if(${ENABLE_STATIC})
	add_library(bellesip STATIC ${SOURCE_FILES})
else(${ENABLE_STATIC})
	add_library(bellesip SHARED ${SOURCE_FILES})
Ghislain MARY's avatar
Ghislain MARY committed
138
	set_target_properties(bellesip PROPERTIES VERSION ${PACKAGE_VERSION} SOVERSION 0)
139 140 141 142 143 144 145 146 147
	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})
148
set_target_properties(bellesip PROPERTIES LINK_FLAGS ${LINK_FLAGS})
149 150 151
target_include_directories(bellesip PUBLIC ${INCLUDES})
target_link_libraries(bellesip ${LIBS})

Ghislain MARY's avatar
Ghislain MARY committed
152
install(TARGETS bellesip
153 154 155
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib
156 157
	PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)