Commit ad17bd7d authored by Ghislain MARY's avatar Ghislain MARY

Enable compilation using CMake.

parent 418085fe
cmake_minimum_required(VERSION 2.6)
############################################################################
# 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.
#
############################################################################
cmake_minimum_required(VERSION 2.8)
project(BELLESIP C)
set(PACKAGE "belle-sip")
set(PACKAGE_NAME "${PACKAGE}")
set(PACKAGE_VERSION "1.2.4")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "jehan.monnier@linphone.org")
set(PACKAGE_TARNAME "belle-sip")
set(PACKAGE_URL "")
set(VERSION "${PACKAGE_VERSION}")
option(ENABLE_STATIC "Build static library (default is shared library)." OFF)
option(ENABLE_TLS "Enable TLS support" ON)
option(ENABLE_TUNNEL "Enable tunnel support" OFF)
option(ENABLE_TESTS "Enable compilation of tests" ON)
set(WITH_ANTLR "${CMAKE_INSTALL_PREFIX}" CACHE STRING "Set prefix where libantlr3c can be found (ex:/usr or /usr/local)")
set(WITH_POLARSSL "${CMAKE_INSTALL_PREFIX}" CACHE STRING "Set prefix where polarssl can be found (ex:/usr or /usr/local)")
include(CMakePushCheckState)
include(CheckIncludeFile)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
check_include_file("dlfcn.h" HAVE_DLFCN_H)
check_include_file("inttypes.h" HAVE_INTTYPES_H)
check_include_file("memory.h" HAVE_MEMORY_H)
check_include_file("stdint.h" HAVE_STDINT_H)
check_include_file("stdlib.h" HAVE_STDLIB_H)
check_include_file("strings.h" HAVE_STRINGS_H)
check_include_file("string.h" HAVE_STRING_H)
check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
check_include_file("unistd.h" HAVE_UNISTD_H)
check_library_exists("dl" "dlopen" "" HAVE_LIBDL)
check_library_exists("rt" "clock_gettime" "" HAVE_LIBRT)
check_symbol_exists("res_ndestroy" "resolv.h" HAVE_RES_NDESTROY)
set(CMAKE_REQUIRED_LIBRARIES resolv)
check_c_source_compiles("#include <resolv.h>
int main(int argc, char *argv[]) {
res_getservers(NULL,NULL,0);
return 0;
}"
HAVE_RES_GETSERVERS)
cmake_reset_check_state()
if(NOT "${HAVE_RES_NDESTROY}" STREQUAL "" AND NOT "${HAVE_RES_GETSERVERS}" STREQUAL "")
set(HAVE_RESINIT 1)
endif(NOT "${HAVE_RES_NDESTROY}" STREQUAL "" AND NOT "${HAVE_RES_GETSERVERS}" STREQUAL "")
find_package(Java)
find_package(Antlr3)
if(${ENABLE_TLS})
find_package(PolarSSL)
set(HAVE_POLARSSL ${POLARSSL_FOUND})
endif(${ENABLE_TLS})
find_package(CUnit)
if(${CUNIT_FOUND})
check_library_exists("cunit" "CU_get_suite" "" HAVE_CU_GET_SUITE)
check_library_exists("cunit" "CU_curses_run_tests" "" HAVE_CU_CURSES)
else(${CUNIT_FOUND})
message(WARNING "Could not find cunit framework, tests will not be compiled.")
set(ENABLE_TESTS OFF CACHE "Enable compilation of tests" FORCE)
endif(${CUNIT_FOUND})
find_package(Tunnel)
set(HAVE_TUNNEL ${TUNNEL_FOUND})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${prefix}/bin)
set(libdir ${prefix}/lib)
set(includedir ${prefix}/include)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/belle-sip.pc.in ${CMAKE_CURRENT_BINARY_DIR}/belle-sip.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/belle-sip.pc DESTINATION lib/pkgconfig)
include_directories(
include/
${CMAKE_CURRENT_BINARY_DIR}/src/
src/
${CMAKE_INSTALL_PREFIX}/include
include
src
${CMAKE_CURRENT_BINARY_DIR}
)
add_definitions(-DHAVE_CONFIG_H -Wall -Werror -Wno-error=unknown-pragmas)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
add_definitions(-Wno-error=unknown-warning-option)
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
add_definitions(-Wno-error=pragmas)
endif()
add_subdirectory(include)
add_subdirectory(src)
if(${ENABLE_TESTS})
enable_testing()
add_subdirectory(tester)
endif(${ENABLE_TESTS})
############################################################################
# FindAntlr3.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.
#
############################################################################
#
# - Find the antlr3c include file and library and antlr.jar
#
# ANTLR3C_FOUND - system has antlr3c
# ANTLR3C_INCLUDE_DIR - the antlr3c include directory
# ANTLR3C_LIBRARIES - The libraries needed to use antlr3c
# ANTLR3_JAR_FOUND - sytem has antlr.jar
# ANTLR3_JAR_PATH - the antlr.jar path
include(CMakePushCheckState)
include(CheckIncludeFile)
include(CheckFunctionExists)
if(WIN32)
set(_ANTLR3C_ROOT_PATHS
${WITH_ANTLR}
${CMAKE_INSTALL_PREFIX}
)
set(_ANTLR3_JAR_ROOT_PATHS
${WITH_ANTLR}
${CMAKE_INSTALL_PREFIX}
)
else(WIN32)
set(_ANTLR3C_ROOT_PATHS
${WITH_ANTLR}
${CMAKE_SYSTEM_INCLUDE_PATH}
)
set(_ANTLR3_JAR_ROOT_PATHS
${WITH_ANTLR}
${CMAKE_INSTALL_PREFIX}
/usr/local
/usr
/opt/local
)
endif(WIN32)
check_include_file("antlr3.h" HAVE_ANTLR3_H)
if(${HAVE_ANTLR3_H})
find_path(ANTLR3C_INCLUDE_DIR
NAMES antlr3.h
HINTS _ANTLR3C_ROOT_PATHS
PATH_SUFFIXES include
)
find_library(ANTLR3C_LIBRARIES
NAMES antlr3c
HINTS _ANTLR3C_ROOT_PATHS
PATH_SUFFIXES bin lib
)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES "antlr3.h")
set(CMAKE_REQUIRED_LIBRARIES "antlr3c")
check_function_exists("antlr3StringStreamNew" HAVE_ANTLR_STRING_STREAM_NEW)
cmake_pop_check_state()
endif(${HAVE_ANTLR3_H})
if(${HAVE_ANTLR3_H} AND NOT "${ANTLR3C_INCLUDE_DIR}" STREQUAL "" AND NOT "${ANTLR3C_LIBRARIES}" STREQUAL "")
set(ANTLR3C_FOUND TRUE)
endif(${HAVE_ANTLR3_H} AND NOT "${ANTLR3C_INCLUDE_DIR}" STREQUAL "" AND NOT "${ANTLR3C_LIBRARIES}" STREQUAL "")
mark_as_advanced(ANTLR3C_INCLUDE_DIR ANTLR3C_LIBRARIES)
find_file(ANTLR3_JAR_PATH
NAMES antlr.jar antlr3.jar
HINTS _ANTLR3_JAR_ROOT_PATHS
PATH_SUFFIXES share/java
)
if(NOT "${ANTLR3_JAR_PATH}" STREQUAL "")
set(ANTLR3_JAR_FOUND TRUE)
endif(NOT "${ANTLR3_JAR_PATH}" STREQUAL "")
mark_as_advanced(ANTLR3_JAR_PATH)
############################################################################
# FindCUnit.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.
#
############################################################################
#
# - Find the CUnit include file and library
#
# CUNIT_FOUND - system has CUnit
# CUNIT_INCLUDE_DIRS - the CUnit include directory
# CUNIT_LIBRARIES - The libraries needed to use CUnit
if(UNIX)
find_package(PkgConfig)
pkg_check_modules(_CUNIT QUIET cunit)
endif(UNIX)
if(WIN32)
set(_CUNIT_ROOT_PATHS "${CMAKE_INSTALL_PREFIX}")
endif(WIN32)
find_path(CUNIT_INCLUDE_DIR
NAMES CUnit/CUnit.h
HINTS _CUNIT_ROOT_PATHS
PATH_SUFFIXES include
)
if(WIN32)
find_library(CUNIT_LIBRARIES
NAMES cunit
HINTS ${_CUNIT_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
else(WIN32)
find_library(CUNIT_LIBRARIES
NAMES cunit
HINTS ${_CUNIT_LIBDIR}
PATH_SUFFIXES lib
)
endif(WIN32)
if(CUNIT_INCLUDE_DIR AND CUNIT_LIBRARIES)
include(CheckIncludeFile)
include(CheckLibraryExists)
check_include_file("CUnit/CUnit.h" HAVE_CUNIT_CUNIT_H)
check_library_exists("cunit" "CU_add_suite" "" HAVE_CU_ADD_SUITE)
endif(CUNIT_INCLUDE_DIR AND CUNIT_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUnit
REQUIRED_VARS
CUNIT_LIBRARIES
CUNIT_INCLUDE_DIR
FAIL_MESSAGE
"Could NOT find CUnit"
)
mark_as_advanced(CUNIT_INCLUDE_DIR CUNIT_LIBRARIES)
############################################################################
# FindPolarSSL.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.
#
############################################################################
#
# - Find the polarssl include file and library
#
# POLARSSL_FOUND - system has polarssl
# POLARSSL_INCLUDE_DIR - the polarssl include directory
# POLARSSL_LIBRARIES - The libraries needed to use polarssl
include(CMakePushCheckState)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
if(WIN32)
set(_POLARSSL_ROOT_PATHS ${CMAKE_INSTALL_PREFIX})
else(WIN32)
set(_POLARSSL_ROOT_PATHS ${CMAKE_SYSTEM_INCLUDE_PATH})
endif(WIN32)
check_include_file("polarssl/ssl.h" HAVE_POLARSSL_SSL_H)
if(${HAVE_POLARSSL_SSL_H})
find_path(POLARSSL_INCLUDE_DIR
NAMES polarssl/ssl.h
HINTS _POLARSSL_ROOT_PATHS
PATH_SUFFIXES include
)
find_library(POLARSSL_LIBRARIES
NAMES polarssl
HINTS _POLARSSL_ROOT_PATHS
PATH_SUFFIXES bin lib
)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${POLARSSL_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES polarssl)
check_c_source_compiles("#include <polarssl/version.h>
#include <polarssl/x509.h>
#if POLARSSL_VERSION_NUMBER >= 0x01030000
#include <polarssl/compat-1.2.h>
#endif
int main(int argc, char *argv[]) {
x509parse_crtpath(0,0);
return 0;
}"
X509PARSE_CRTPATH_OK)
cmake_pop_check_state()
endif(${HAVE_POLARSSL_SSL_H})
if(${HAVE_POLARSSL_SSL_H} AND ${X509PARSE_CRTPATH_OK} AND NOT "${POLARSSL_INCLUDE_DIR}" STREQUAL "" AND NOT "${POLARSSL_LIBRARIES}" STREQUAL "")
set(POLARSSL_FOUND TRUE)
endif(${HAVE_POLARSSL_SSL_H} AND ${X509PARSE_CRTPATH_OK} AND NOT "${POLARSSL_INCLUDE_DIR}" STREQUAL "" AND NOT "${POLARSSL_LIBRARIES}" STREQUAL "")
mark_as_advanced(POLARSSL_INCLUDE_DIR POLARSSL_LIBRARIES)
############################################################################
# FindTunnel.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.
#
############################################################################
#
# - Find the tunnel include file and library
#
# TUNNEL_FOUND - system has tunnel
# TUNNEL_INCLUDE_DIRS - the tunnel include directory
# TUNNEL_LIBRARIES - The libraries needed to use tunnel
if(UNIX)
find_package(PkgConfig)
pkg_check_modules(_TUNNEL QUIET tunnel)
endif(UNIX)
if(WIN32)
set(_TUNNEL_ROOT_PATHS "${CMAKE_INSTALL_PREFIX}")
endif(WIN32)
find_path(TUNNEL_INCLUDE_DIR
NAMES tunnel/common.hh
HINTS _TUNNEL_ROOT_PATHS
PATH_SUFFIXES include
)
if(WIN32)
find_library(TUNNEL_LIBRARIES
NAMES tunnel
HINTS ${_TUNNEL_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
else(WIN32)
find_library(TUNNEL_LIBRARIES
NAMES tunnel
HINTS ${_TUNNEL_LIBDIR}
PATH_SUFFIXES lib
)
endif(WIN32)
if(TUNNEL_INCLUDE_DIR AND TUNNEL_LIBRARIES)
include(CheckIncludeFile)
check_include_file("tunnel/common.hh" HAVE_TUNNEL_COMMON_HH)
endif(TUNNEL_INCLUDE_DIR AND TUNNEL_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(tunnel
REQUIRED_VARS
TUNNEL_LIBRARIES
TUNNEL_INCLUDE_DIR
FAIL_MESSAGE
"Could NOT find tunnel"
)
mark_as_advanced(TUNNEL_INCLUDE_DIR TUNNEL_LIBRARIES)
/***************************************************************************
* antlr3config.h.cmake
* 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.
*
****************************************************************************/
#cmakedefine PACKAGE "@PACKAGE@"
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@"
#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
#cmakedefine PACKAGE_URL "@PACKAGE_URL@"
#cmakedefine VERSION "@VERSION@"
#ifndef HAVE_DLFCN_H
#cmakedefine HAVE_DLFCN_H
#endif
#ifndef HAVE_INTTYPES_H
#cmakedefine HAVE_INTTYPES_H
#endif
#ifndef HAVE_MEMORY_H
#cmakedefine HAVE_MEMORY_H
#endif
#ifndef HAVE_STDINT_H
#cmakedefine HAVE_STDINT_H
#endif
#ifndef HAVE_STDLIB_H
#cmakedefine HAVE_STDLIB_H
#endif
#ifndef HAVE_STRINGS_H
#cmakedefine HAVE_STRINGS_H
#endif
#ifndef HAVE_STRING_H
#cmakedefine HAVE_STRING_H
#endif
#ifndef HAVE_SYS_STAT_H
#cmakedefine HAVE_SYS_STAT_H
#endif
#ifndef HAVE_SYS_TYPES_H
#cmakedefine HAVE_SYS_TYPES_H
#endif
#ifndef HAVE_UNISTD_H
#cmakedefine HAVE_UNISTD_H
#endif
#cmakedefine HAVE_LIBDL
#cmakedefine HAVE_LIBRT
#cmakedefine HAVE_RESINIT
#cmakedefine HAVE_ANTLR3_H
#cmakedefine HAVE_ANTLR_STRING_STREAM_NEW
#cmakedefine HAVE_POLARSSL_SSL_H
#cmakedefine HAVE_POLARSSL
#cmakedefine HAVE_CUNIT_CUNIT_H
#cmakedefine HAVE_CU_CURSES
#cmakedefine HAVE_CU_GET_SUITE
#cmakedefine HAVE_TUNNEL
find_library(LIBANTLR3C NAMES antlr3c)
find_library(LIBPOLARSSL NAMES polarssl)
############################################################################
# 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})
set(SDP_GENERATED_SOURCE_FILES
${CMAKE_CURRENT_BINARY_DIR}/belle_sdpLexer.c
......@@ -9,8 +36,8 @@ set(SDP_GENERATED_SOURCE_FILES
)
add_custom_command(
OUTPUT ${SDP_GENERATED_SOURCE_FILES}
COMMAND java -jar ${ANTLR3_ROOT_DIR}/antlr-3.4-complete.jar -make -fo ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/belle_sdp.g
DEPENDS belle_sdp.g
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
)
set(SIP_MESSAGE_GENERATED_SOURCE_FILES
......@@ -21,15 +48,36 @@ set(SIP_MESSAGE_GENERATED_SOURCE_FILES
)
add_custom_command(
OUTPUT ${SIP_MESSAGE_GENERATED_SOURCE_FILES}
COMMAND java -jar ${ANTLR3_ROOT_DIR}/antlr-3.4-complete.jar -make -fo ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/belle_sip_message.g
DEPENDS belle_sip_message.g
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
)
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})
set(SOURCE_FILES
auth_event.c
auth_helper.c
belle_sdp_impl.c
belle_sip_dict.c
belle_sip_headers_impl.c
belle_sip_internal.h
belle_sip_loop.c
belle_sip_object.c
belle_sip_parameters.c
......@@ -37,58 +85,63 @@ set(SOURCE_FILES
belle_sip_uri_impl.c
belle_sip_utils.c
channel.c
channel.h
clock_gettime.c
clock_gettime.h
dialog.c
dns.c
dns.h
generic-uri.c
http-listener.c
http-message.c
http-provider.c
ict.c
ist.c
listeningpoint.c
listeningpoint_internal.h
md5.c
md5.h
message.c
nict.c
nist.c
parserutils.h
port.c
port.h
provider.c
refresher.c
siplistener.c
sipstack.c
transaction.c
transports/stream_channel.c
transports/stream_channel.h
transports/stream_listeningpoint.c
transports/tls_channel_polarssl.c
transports/tls_listeningpoint_polarssl.c
transports/udp_channel.c
transports/udp_listeningpoint.c
${SDP_GENERATED_SOURCE_FILES}
${SIP_MESSAGE_GENERATED_SOURCE_FILES}
${TLS_SOURCE_FILES}
${TUNNEL_SOURCE_FILES}
)
add_definitions(
-DBELLESIP_EXPORTS
-DBELLESIP_INTERNAL_EXPORTS
-DHAVE_POLARSSL
-DHAVE_ANTLR_STRING_STREAM_NEW
-DPACKAGE_VERSION="1.2.4"
)
if(WIN32)
set(LIBS ws2_32)
endif(WIN32)
set(LIBS ${LIBS} ${LIBANTLR3C} ${LIBPOLARSSL})
add_library(bellesip SHARED ${SOURCE_FILES})
set_target_properties(bellesip PROPERTIES VERSION 1.2.4 SOVERSION 1)
target_link_libraries(bellesip ${LIBS})
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})
install(TARGETS bellesip
DESTINATION ${LIB_INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
if(WIN32)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/bellesip.pdb
DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
endif(WIN32)
############################################################################
# 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(TESTER_SOURCES
auth_helper_tester.c
belle_generic_uri_tester.c
belle_http_tester.c
belle_sdp_tester.c
belle_sip_core_tester.c
belle_sip_dialog_tester.c
belle_sip_headers_tester.c
belle_sip_message_tester.c
belle_sip_refresher_tester.c
belle_sip_register_tester.c
belle_sip_resolver_tester.c
belle_sip_tester.c
belle_sip_tester.h
belle_sip_uri_tester.c
cast_test.c
register_tester.h
)
add_executable(belle_sip_tester ${TESTER_SOURCES})
target_link_libraries(belle_sip_tester ${CUNIT_LIBRARIES} bellesip)
add_test(NAME belle_sip_tester COMMAND belle_sip_tester --verbose)
set(OBJECT_DESCRIBE_SOURCES describe.c)
add_executable(belle_sip_object_describe ${OBJECT_DESCRIBE_SOURCES})
target_link_libraries(belle_sip_object_describe bellesip)
set(PARSE_SOURCES parse.c)
add_executable(belle_sip_parse ${PARSE_SOURCES})
target_link_libraries(belle_sip_parse bellesip)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment