CMakeLists.txt 4.24 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 23 24 25 26 27 28 29
############################################################################
# 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.
#
############################################################################

set(LIBS ${ANTLR3C_LIBRARIES})
if(NOT WIN32)
	list(APPEND LIBS pthread)
endif(NOT WIN32)
if(${HAVE_LIBDL})
	list(APPEND LIBS dl)
endif(${HAVE_LIBDL})
Ghislain MARY's avatar
Ghislain MARY committed
30

31 32 33 34 35 36 37 38
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}
39 40
	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
41 42 43 44 45 46 47 48 49 50
)

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}
51 52
	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
53 54
)

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
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
	)
	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})

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

126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
if(${ENABLE_STATIC})
	add_library(bellesip STATIC ${SOURCE_FILES})
	target_link_libraries(bellesip ${LIBS})
else(${ENABLE_STATIC})
	add_library(bellesip SHARED ${SOURCE_FILES})
	set_target_properties(bellesip PROPERTIES VERSION 0.0.0 SOVERSION 0)
	target_link_libraries(bellesip ${LIBS})
	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})
Ghislain MARY's avatar
Ghislain MARY committed
142
install(TARGETS bellesip
143 144 145
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib
146 147
	PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)