Commit 02aac129 authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI

CMake builder (still in progress)

parent d9a429f7
......@@ -39,7 +39,6 @@ debian/flexisip
config.guess
config.sub
flexisip-config.h
flexisip-config.h.in
ltmain.sh
scripts/flexisip.conf.sample
stamp-h1
......
############################################################################
# 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 3.0.0 FATAL_ERROR)
project(flexisip C CXX)
set(FLEXISIP_MAJOR_VERSION "0")
set(FLEXISIP_MINOR_VERSION "8")
set(FLEXISIP_MICRO_VERSION "0")
set(FLEXISIP_VERSION "${FLEXISIP_MAJOR_VERSION}.${FLEXISIP_MINOR_VERSION}.${FLEXISIP_MICRO_VERSION}")
set(FLEXISIP_SO_VERSION "6")
include(CMakePushCheckState)
include(CMakeDependentOption)
include(CheckSymbolExists)
include(CheckIncludeFile)
include(CheckFunctionExists)
option(ENABLE_STATIC "Build static library (default is shared library)." NO)
option(ENABLE_BOOSTLOG "" YES)
option(ENABLE_DATEHANDLER "" NO)
option(ENABLE_DOC "" YES)
option(ENABLE_ODB "" YES)
option(ENABLE_ODB_MYSQL "" YES)
option(ENABLE_MONOTONIC_CLOCK_REGISTRATIONS "" NO)
option(ENABLE_ODBC "Build ODBC support" YES)
option(ENABLE_PRESENCE "Build presence support" NO)
option(ENABLE_PROTOBUF "" NO)
option(ENABLE_PUSHNOTIFICATION "" YES)
option(ENABLE_REDIS "" NO)
option(ENABLE_SNMP "Build with SNMP support" YES)
option(ENABLE_TRANSCODER "" YES)
cmake_dependent_option(ENABLE_SPECIFIC_FEATURES "Enable mediarelay specific features" OFF "ENABLE_TRANSCODER" OFF)
set(XSDCXX_ROOT_PATH ${CMAKE_INSTALL_PREFIX} CACHE STRING "Path of where the bin/xsdcxx executable will be found. Comes from http://www.codesynthesis.com/products/xsd/download.xhtml")
set(SYSCONFIGROOT "" CACHE STRING "Config directory, the place where flexisip expects its flexisip.conf file to reside" )
set(CONFIG_DIR ${SYSCONFIGROOT}/etc)
message(STATUS "Config dir: ${CONFIG_DIR}")
function(FIND_PROGRAM_REQUIRED varname progname)
find_program(${varname} NAMES "${progname}")
if(NOT ${varname})
message(FATAL_ERROR "Program '${progname}' is required but could not be found")
endif()
endfunction()
# Configure CMAKE
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_definitions(-DHAVE_CONFIG_H)
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
# Required packages
find_package(SofiaSipUa REQUIRED)
find_package(ORTP 0.21 REQUIRED)
find_library(XERCES_LIBS NAMES xerces-c)
if(NOT XERCES_LIBS)
message(FATAL_ERROR "Failed to find the Xerces library.")
endif()
find_program(XSDCXX_PROG NAMES "xsdcxx" "xsd" HINTS ${XSDCXX_ROOT_PATH}/bin NO_DEFAULT_PATH)
if(NOT XSDCXX_PROG)
message(FATAL_ERROR "Program 'xsdcxx' is required but could not be found")
endif()
check_function_exists(arc4random HAVE_ARC4RANDOM)
find_file(HAVE_SYS_PRCTL_H NAMES sys/prctl.h)
# TODO: check monotonic clock support (we expect yes) see configure.ac
# Options
if(ENABLE_ODB)
if(ENABLE_ODB_MYSQL)
find_package(odb REQUIRED COMPONENTS mysql)
else()
find_package(odb REQUIRED)
endif()
if(NOT ODB_FOUND)
message(FATAL_ERROR "ODB not found")
endif()
include(${ODB_USE_FILE})
endif()
if(ENABLE_SNMP)
# todo: Not quite ready
FIND_PROGRAM_REQUIRED(NET_SNMP_PROG net-snmp-config)
find_path(NET_SNMP_INCLUDE_DIRS NAMES net-snmp/net-snmp-config.h)
if(NOT NET_SNMP_INCLUDE_DIRS)
message(FATAL_ERROR "SNMP header files not found")
endif()
execute_process(COMMAND "${NET_SNMP_PROG}" "--agent-libs" OUTPUT_VARIABLE NET_SNMP_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(ENABLE_ODBC)
FIND_PROGRAM_REQUIRED(ODBC_PROG odbc_config )
execute_process(COMMAND "${ODBC_PROG}" "--libs" OUTPUT_VARIABLE ODBC_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${ODBC_PROG}" "--cflags" OUTPUT_VARIABLE ODBC_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${ODBC_PROG}" "--include-prefix" OUTPUT_VARIABLE ODBC_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${ODBC_PROG}" "--lib-prefix" OUTPUT_VARIABLE ODBC_LIBRARY_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "ODBC libraries: ${ODBC_LIBRARIES}")
message(STATUS "ODBC headers: ${ODBC_CFLAGS}")
# check SQL headers
find_path(ODBC_SQL_HEADERS NAMES sql.h sqlext.h sqltypes.h mysql/mysql.h PATHS ODBC_INCLUDE_DIRS )
if(NOT ODBC_SQL_HEADERS)
message(FATAL_ERROR "ODBC Mysql headers not found.")
else()
message(STATUS "ODBCK Mysql ${ODBC_SQL_HEADERS}")
endif()
# check that odbc_config gives us a correct library path
find_library(ODBC_LIB_FOUND NAMES odbc PATHS ODBC_LIBRARY_DIR)
if(NOT ODBC_LIB_FOUND )
message(FATAL_ERROR "ODBC library not found.")
endif()
endif()
if(ENABLE_TRANSCODER)
find_package(Mediastreamer2 2.9.0 REQUIRED)
endif()
if(ENABLE_SPECIFIC_FEATURES)
set(MEDIARELAY_SPECIFIC_FEATURES_ENABLED ON)
endif()
if(ENABLE_MONOTONIC_CLOCK_REGISTRATIONS)
set(MONOTONIC_CLOCK_REGISTRATIONS ON)
endif()
if(ENABLE_DATEHANDLER)
set(HAVE_DATEHANDLER ON)
endif()
if(ENABLE_REDIS)
find_path(HIREDIS_INCLUDE_DIRS NAMES hiredis/hiredis.h )
find_library(HIREDIS_LIBRARIES NAMES hiredis)
if(NOT HIREDIS_INCLUDE_DIRS)
message(FATAL_ERROR "hiredis headers not found")
endif()
if(NOT HIREDIS_LIBRARIES)
message(FATAL_ERROR "hiredis library not found")
endif()
# check that the async mode is supported
cmake_push_check_state(RESET)
list(APPEND CMAKE_REQUIRED_INCLUDES ${HIREDIS_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${HIREDIS_LIBRARIES})
check_symbol_exists("redisAsyncCommand" "hiredis/async.h" HIREDIS_ASYNC_ENABLED)
if(NOT HIREDIS_ASYNC_ENABLED)
message(FATAL_ERROR "Hiredis needs support for Async commands.")
endif()
cmake_pop_check_state()
endif()
if(ENABLE_PROTOBUF)
find_package(protobuf REQUIRED)
# package finder for protobuf does not exit on REQUIRED..
if(NOT PROTOBUF_FOUND)
message(FATAL_ERROR "Protobuf not found and is required")
endif()
if(NOT PROTOBUF_PROTOC_EXECUTABLE)
message(FATAL_ERROR "Protobuf 'protoc' executable not found and is required")
endif()
endif()
if(ENABLE_DOC)
FIND_PROGRAM_REQUIRED(PDFLATEX_PROG pdflatex)
endif()
if(ENABLE_PRESENCE)
find_package(belle-sip 1.2.4 REQUIRED)
endif()
# Boost checks
set(BOOST_COMPONENTS )
if(ENABLE_BOOSTLOG)
list(APPEND BOOST_COMPONENTS log regex system thread)
endif()
if(ENABLE_PUSHNOTIFICATION)
find_package(openssl 0.9.8 REQUIRED)
list(APPEND BOOST_COMPONENTS system)
endif()
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
include_directories(
src/
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/src/
${SOFIA_SIP_UA_INCLUDE_DIRS}
${ORTP_INCLUDE_DIRS}
)
configure_file(${PROJECT_SOURCE_DIR}/cmake/flexisip-config.h.in ${PROJECT_BINARY_DIR}/flexisip-config.h)
set_source_files_properties(${PROJECT_BINARY_DIR}/flexisip-config.h PROPERTIES GENERATED ON)
add_subdirectory(src)
# Packaging
set(CPACK_GENERATOR TGZ;DEB;RPM)
set(CPACK_PACKAGE_VERSION_MAJOR ${FLEXISIP_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${FLEXISIP_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${FLEXISIP_MICRO_VERSION})
set(CPACK_PACKAGE_VERSION ${FLEXISIP_VERSION})
set(CPACK_PACKAGE_CONTACT info@belledonne-communications.com)
include(CPack)
\ No newline at end of file
#
# This module defines the following variables:
#
# ODB_USE_FILE - Path to the UseODB.cmake file. Use it to include the ODB use file.
# The use file defines the needed functionality to compile and use
# odb generated headers.
#
# ODB_FOUND - All required components and the core library were found
# ODB_INCLUDR_DIRS - Combined list of all components include dirs
# ODB_LIBRARIES - Combined list of all componenets libraries
#
# ODB_LIBODB_FOUND - Libodb core library was found
# ODB_LIBODB_INCLUDE_DIRS - Include dirs for libodb core library
# ODB_LIBODB_LIBRARIES - Libraries for libodb core library
#
# For each requested component the following variables are defined:
#
# ODB_<component>_FOUND - The component was found
# ODB_<component>_INCLUDE_DIRS - The components include dirs
# ODB_<component>_LIBRARIES - The components libraries
#
# <component> is the original or uppercase name of the component
#
# The component names relate directly to the odb module names.
# So for the libodb-mysql.so library, the component is named mysql,
# for the libodb-qt.so module it's qt, and so on.
#
set(ODB_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseODB.cmake")
find_package(PkgConfig QUIET)
function(find_odb_api component)
string(TOUPPER "${component}" component_u)
set(ODB_${component_u}_FOUND FALSE PARENT_SCOPE)
pkg_check_modules(PC_ODB_${component} QUIET "libodb-${component}")
find_path(ODB_${component}_INCLUDE_DIR
NAMES odb/${component}/version.hxx
HINTS
${ODB_LIBODB_INCLUDE_DIRS}
${PC_ODB_${component}_INCLUDE_DIRS})
find_library(ODB_${component}_LIBRARY
NAMES odb-${component} libodb-${component}
HINTS
${ODB_LIBRARY_PATH}
${PC_ODB_${component}_LIBRARY_DIRS})
set(ODB_${component_u}_INCLUDE_DIRS ${ODB_${component}_INCLUDE_DIR} CACHE STRING "ODB ${component} include dirs")
set(ODB_${component_u}_LIBRARIES ${ODB_${component}_LIBRARY} CACHE STRING "ODB ${component} libraries")
mark_as_advanced(ODB_${component}_INCLUDE_DIR ODB_${component}_LIBRARY)
if(ODB_${component_u}_INCLUDE_DIRS AND ODB_${component_u}_LIBRARIES)
set(ODB_${component_u}_FOUND TRUE PARENT_SCOPE)
set(ODB_${component}_FOUND TRUE PARENT_SCOPE)
list(APPEND ODB_INCLUDE_DIRS ${ODB_${component_u}_INCLUDE_DIRS})
list(REMOVE_DUPLICATES ODB_INCLUDE_DIRS)
set(ODB_INCLUDE_DIRS ${ODB_INCLUDE_DIRS} PARENT_SCOPE)
list(APPEND ODB_LIBRARIES ${ODB_${component_u}_LIBRARIES})
list(REMOVE_DUPLICATES ODB_LIBRARIES)
set(ODB_LIBRARIES ${ODB_LIBRARIES} PARENT_SCOPE)
endif()
endfunction()
pkg_check_modules(PC_LIBODB QUIET "libodb")
set(ODB_LIBRARY_PATH "" CACHE STRING "Common library search hint for all ODB libs")
find_path(libodb_INCLUDE_DIR
NAMES odb/version.hxx
HINTS
${PC_LIBODB_INCLUDE_DIRS})
find_library(libodb_LIBRARY
NAMES odb libodb
HINTS
${ODB_LIBRARY_PATH}
${PC_LIBODB_LIBRARY_DIRS})
find_program(odb_BIN
NAMES odb
HINTS
${libodb_INCLUDE_DIR}/../bin)
set(ODB_LIBODB_INCLUDE_DIRS ${libodb_INCLUDE_DIR} CACHE STRING "ODB libodb include dirs")
set(ODB_LIBODB_LIBRARIES ${libodb_LIBRARY} CACHE STRING "ODB libodb library")
set(ODB_EXECUTABLE ${odb_BIN} CACHE STRING "ODB executable")
mark_as_advanced(libodb_INCLUDE_DIR libodb_LIBRARY odb_BIN)
if(ODB_LIBODB_INCLUDE_DIRS AND ODB_LIBODB_LIBRARIES)
set(ODB_LIBODB_FOUND TRUE)
endif()
set(ODB_INCLUDE_DIRS ${ODB_LIBODB_INCLUDE_DIRS})
set(ODB_LIBRARIES ${ODB_LIBODB_LIBRARIES})
foreach(component ${ODB_FIND_COMPONENTS})
find_odb_api(${component})
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ODB
FOUND_VAR ODB_FOUND
REQUIRED_VARS ODB_EXECUTABLE ODB_LIBODB_FOUND
HANDLE_COMPONENTS)
############################################################################
# FindSofiaSipUa.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 sofia-sip include file and library
#
# SOFIA_SIP_UA_FOUND - system has sofia-sip
# SOFIA_SIP_UA_INCLUDE_DIRS - the sofia-sip include directory
# SOFIA_SIP_UA_LIBRARIES - The libraries needed to use sofia-sip
# SOFIA_SIP_UA_CPPFLAGS - The cflags needed to use sofia-sip
set(_SOFIA_SIP_UA_ROOT_PATHS
${WITH_SOFIA_SIP_UA}
${CMAKE_INSTALL_PREFIX}
)
find_path(SOFIA_SIP_UA_INCLUDE_DIRS
NAMES sofia-sip/sip.h
HINTS _SOFIA_SIP_UA_ROOT_PATHS
PATH_SUFFIXES include/sofia-sip-1.13 include/sofia-sip-1.12
)
if(SOFIA_SIP_UA_INCLUDE_DIRS)
set(HAVE_SOFIA_SIP_UA_SOFIA_SIP_UA_H 1)
endif()
find_library(SOFIA_SIP_UA_LIBRARIES
NAMES sofia-sip-ua
HINTS ${_SOFIA_SIP_UA_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
if(WIN32)
list(APPEND SOFIA_SIP_UA_LIBRARIES ws2_32 delayimp Winmm Qwave)
endif(WIN32)
list(REMOVE_DUPLICATES SOFIA_SIP_UA_INCLUDE_DIRS)
list(REMOVE_DUPLICATES SOFIA_SIP_UA_LIBRARIES)
set(SOFIA_SIP_UA_CPPFLAGS "")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SOFIA_SIP_UA
DEFAULT_MSG
SOFIA_SIP_UA_INCLUDE_DIRS SOFIA_SIP_UA_LIBRARIES
)
mark_as_advanced(SOFIA_SIP_UA_INCLUDE_DIRS SOFIA_SIP_UA_LIBRARIES SOFIA_SIP_UA_CPPFLAGS)
set(ODB_COMPILE_DEBUG FALSE)
set(ODB_COMPILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/odb_gen")
set(ODB_COMPILE_HEADER_SUFFIX ".h")
set(ODB_COMPILE_INLINE_SUFFIX "_inline.h")
set(ODB_COMPILE_SOURCE_SUFFIX ".cpp")
set(ODB_COMPILE_FILE_SUFFIX "_odb")
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
function(odb_compile outvar)
if(NOT ODB_EXECUTABLE)
message(FATAL_ERROR "odb compiler executable not found")
endif()
set(options GENERATE_QUERY GENERATE_SESSION GENERATE_SCHEMA GENERATE_PREPARED)
set(oneValueParams SCHEMA_FORMAT SCHEMA_NAME TABLE_PREFIX
STANDARD SLOC_LIMIT
HEADER_PROLOGUE INLINE_PROLOGUE SOURCE_PROLOGUE
HEADER_EPILOGUE INLINE_EPILOGUE SOURCE_EPILOGUE
MULTI_DATABASE
PROFILE)
set(multiValueParams FILES INCLUDE DB)
cmake_parse_arguments(PARAM "${options}" "${oneValueParams}" "${multiValueParams}" ${ARGN})
if(PARAM_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "invalid arguments passed to odb_wrap_cpp: ${PARAM_UNPARSED_ARGUMENTS}")
endif()
if(NOT PARAM_FILES)
message(FATAL_ERROR: "no input files to odb_compile")
endif()
set(ODB_ARGS)
if(PARAM_MULTI_DATABASE)
list(APPEND ODB_ARGS --multi-database "${PARAM_MULTI_DATABASE}")
list(APPEND PARAM_DB common)
endif()
foreach(db ${PARAM_DB})
list(APPEND ODB_ARGS -d "${db}")
endforeach()
if(PARAM_GENERATE_QUERY)
list(APPEND ODB_ARGS --generate-query)
endif()
if(PARAM_GENERATE_SESSION)
list(APPEND ODB_ARGS --generate-session)
endif()
if(PARAM_GENERATE_SCHEMA)
list(APPEND ODB_ARGS --generate-schema)
endif()
if(PARAM_GENERATE_PREPARED)
list(APPEND ODB_ARGS --generate-prepared)
endif()
if(PARAM_SCHEMA_FORMAT)
list(APPEND ODB_ARGS --schema-format "${PARAM_SCHEMA_FORMAT}")
endif()
if(PARAM_SCHEMA_NAME)
list(APPEND ODB_ARGS --schema-name "${PARAM_SCHEMA_NAME}")
endif()
if(PARAM_TABLE_PREFIX)
list(APPEND ODB_ARGS --table-prefix "${PARAM_TABLE_PREFIX}")
endif()
if(PARAM_STANDARD)
list(APPEND ODB_ARGS --std "${PARAM_STANDARD}")
endif()
if(PARAM_SLOC_LIMIT)
list(APPEND ODB_ARGS --sloc-limit "${PARAM_SLOC_LIMIT}")
endif()
if(PARAM_HEADER_PROLOGUE)
list(APPEND ODB_ARGS --hxx-prologue-file "${PARAM_HEADER_PROLOGUE}")
endif()
if(PARAM_INLINE_PROLOGUE)
list(APPEND ODB_ARGS --ixx-prologue-file "${PARAM_INLINE_PROLOGUE}")
endif()
if(PARAM_SOURCE_PROLOGUE)
list(APPEND ODB_ARGS --cxx-prologue-file "${PARAM_SOURCE_PROLOGUE}")
endif()
if(PARAM_HEADER_EPILOGUE)
list(APPEND ODB_ARGS --hxx-epilogue-file "${PARAM_HEADER_EPILOGUE}")
endif()
if(PARAM_INLINE_EPILOGUE)
list(APPEND ODB_ARGS --ixx-epilogue-file "${PARAM_INLINE_EPILOGUE}")
endif()
if(PARAM_SOURCE_EPILOGUE)
list(APPEND ODB_ARGS --cxx-epilogue-file "${PARAM_SOURCE_EPILOGUE}")
endif()
if(PARAM_PROFILE)
list(APPEND ODB_ARGS --profile "${PARAM_PROFILE}")
endif()
list(APPEND ODB_ARGS --output-dir "${ODB_COMPILE_OUTPUT_DIR}")
list(APPEND ODB_ARGS --hxx-suffix "${ODB_COMPILE_HEADER_SUFFIX}")
list(APPEND ODB_ARGS --ixx-suffix "${ODB_COMPILE_INLINE_SUFFIX}")
list(APPEND ODB_ARGS --cxx-suffix "${ODB_COMPILE_SOURCE_SUFFIX}")
if(PARAM_MULTI_DATABASE AND NOT "${ODB_COMPILE_FILE_SUFFIX}" MATCHES ".+:.+")
set(osuffix "${ODB_COMPILE_FILE_SUFFIX}")
set(ODB_COMPILE_FILE_SUFFIX)
foreach(db ${PARAM_DB})
if("${db}" MATCHES "common")
list(APPEND ODB_COMPILE_FILE_SUFFIX "${db}:${osuffix}")
else()
list(APPEND ODB_COMPILE_FILE_SUFFIX "${db}:${osuffix}_${db}")
endif()
endforeach()
endif()
foreach(sfx ${ODB_COMPILE_FILE_SUFFIX})
list(APPEND ODB_ARGS --odb-file-suffix "${sfx}")
endforeach()
foreach(dir ${PARAM_INCLUDE} ${ODB_INCLUDE_DIRS})
list(APPEND ODB_ARGS "-I${dir}")
endforeach()
file(REMOVE_RECURSE "${ODB_COMPILE_OUTPUT_DIR}")
file(MAKE_DIRECTORY "${ODB_COMPILE_OUTPUT_DIR}")
foreach(input ${PARAM_FILES})
get_filename_component(fname "${input}" NAME_WE)
set(outputs)
foreach(sfx ${ODB_COMPILE_FILE_SUFFIX})
string(REGEX REPLACE ":.*$" "" pfx "${sfx}")
string(REGEX REPLACE "^.*:" "" sfx "${sfx}")
if(NOT "${PARAM_MULTI_DATABASE}" MATCHES "static" OR NOT "${pfx}" MATCHES "common")
set(output "${ODB_COMPILE_OUTPUT_DIR}/${fname}${sfx}${ODB_COMPILE_SOURCE_SUFFIX}")
list(APPEND ${outvar} "${output}")
list(APPEND outputs "${output}")
endif()
endforeach()
if(ODB_COMPILE_DEBUG)
set(_msg "${ODB_EXECUTABLE} ${ODB_ARGS} ${input}")
string(REPLACE ";" " " _msg "${_msg}")
message(STATUS "${_msg}")
endif()
add_custom_command(OUTPUT ${outputs}
COMMAND ${ODB_EXECUTABLE} ${ODB_ARGS} "${input}"
DEPENDS "${input}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
VERBATIM)
endforeach()
set(${outvar} ${${outvar}} PARENT_SCOPE)
endfunction()
/* flexisip-config.h. Generated from flexisip-config.h.in by configure. */
/* flexisip-config.h.in. Generated from configure.ac by autoheader. */
#cmakedefine CONFIG_DIR "${CONFIG_DIR}"
#cmakedefine ENABLE_SNMP 1
#cmakedefine ENABLE_LIBODB_MYSQL 1
#cmakedefine ENABLE_TRANSCODER 1
#cmakedefine ENABLE_PRESENCE 1
#cmakedefine HAVE_DATEHANDLER 1
#cmakedefine HAVE_ARC4RANDOM 1
#cmakedefine HAVE_SYS_PRCTL_H 1
#cmakedefine MEDIARELAY_SPECIFIC_FEATURES_ENABLED 1
#cmakedefine MONOTONIC_CLOCK_REGISTRATIONS 1
#define SNMP_COMPANY_OID 10000
/* oRTP ABI version */
#define ORTP_ABI_VERSION 9
/* oRTP rtp_session_set_reuseaddr availabled */
#define ORTP_HAS_REUSEADDR 1
/* Define to the version of this package. */
#define PACKAGE_VERSION "${FLEXISIP_VERSION}"
/* Version number of package */
#define VERSION "${FLEXISIP_VERSION}"
set(FLEXISIP_LIBS ${ORTP_LIBRARIES} ${SOFIA_SIP_UA_LIBRARIES} ${XERCES_LIBS})
set(FLEXISIP_INCLUDES)
set(FLEXISIP_SOURCES
main.cc
flexisip-exception.cc flexisip-exception.hh
agent.cc agent.hh
common.cc common.hh
sdp-modifier.hh sdp-modifier.cc
callstore.hh callstore.cc
forkcontext.hh forkcontext.cc
callcontext-mediarelay.hh callcontext-mediarelay.cc
forkcallcontext.hh forkcallcontext.cc
forkmessagecontext.hh forkmessagecontext.cc
forkbasiccontext.cc forkbasiccontext.hh
registrardb-internal.cc registrardb-internal.hh registrardb.cc registrardb.hh
recordserializer-c.cc recordserializer.hh
recordserializer-json.cc cJSON.c cJSON.h
etchosts.cc etchosts.hh
lpconfig.cc lpconfig.h
configmanager.cc configmanager.hh
event.cc event.hh
transaction.cc transaction.hh
module.cc module.hh
monitor.cc monitor.hh
entryfilter.cc entryfilter.hh
stun.cc stun.hh
stun/stun.c stun/stun_udp.c stun/flexisip_stun.h stun/flexisip_stun_udp.h
mediarelay.cc mediarelay.hh
authdb.hh authdb.cc authdb-file.cc
module-sanitychecker.cc
module-garbage-in.cc
module-forward.cc
module-gatewayadapter.cc
module-contact-route-inserter.cc
module-nat-helper.cc
module-registrar.cc
module-router.cc lateforkapplier.hh
module-transcode.cc
module-statistics-collector.cc
module-mediarelay.cc
module-auth.cc
module-loadbalancer.cc
expressionparser.cc expressionparser.hh
sipattrextractor.cc sipattrextractor.hh
h264iframefilter.cc h264iframefilter.hh
telephone-event-filter.cc telephone-event-filter.hh
log/logmanager.cc log/logmanager.hh
eventlogs/eventlogs.cc eventlogs/eventlogs.hh
contact-masquerader.cc contact-masquerader.hh
uac-register.cc uac-register.hh
module-redirect.cc
# TODO: GIT VERSION FILE
)
set(FLEXISIP_DEPENDENCIES fthttp)
function(ADD_XSD_WRAPPERS file _comment)
set(destinations ${CMAKE_CURRENT_BINARY_DIR}/xml/${file}.hxx ${CMAKE_CURRENT_BINARY_DIR}/xml/${file}.cxx)
set(source ${CMAKE_CURRENT_SOURCE_DIR}/xml/${file}.xsd)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/xml")
set(regex "%http://.+/(.+)%\\\$$1%")
add_custom_command(OUTPUT ${destinations}
COMMAND "${XSDCXX_PROG}" "cxx-tree" "--generate-wildcard"
"--generate-serialization" "--generate-ostream"
"--generate-detach" "--std" "c++11" "--type-naming" "java"
"--function-naming" "java" "--location-regex-trace"
"--location-regex" "\"${regex}\""
"--output-dir" "${CMAKE_CURRENT_BINARY_DIR}/xml" "${source}"
COMMENT "${_comment}")
add_custom_target(${file} DEPENDS ${destinations})
set_source_files_properties(${destinations} PROPERTIES GENERATED ON)
set(FLEXISIP_SOURCES ${FLEXISIP_SOURCES} ${destinations} PARENT_SCOPE)
endfunction()
list(APPEND FLEXISIP_INCLUDES ${XSDCXX_ROOT_PATH}/libxsd)
ADD_XSD_WRAPPERS( fthttp "Generating XSD for FTHTTP")
if(ENABLE_ODB)
#list(APPEND FLEXISIP_LIBS ${ODB_LIBRARIES})
#list(APPEND FLEXISIP_INCLUDES ${ODB_INCLUDE_DIRS})
#list(APPEND FLEXISIP_SOURCES eventlogs/eventlogsdb.cc eventlogs/eventlogsdb.hh)
# TODO: generate the cxx and hxx with ODB
#eventlogs/eventlogsdb-odb.hxx eventlogs/eventlogsdb-odb.cxx: eventlogs/eventlogsdb.hh
# odb $(SOFIA_CFLAGS) $(ORTP_CFLAGS) --std c++11 -d mysql --output-dir eventlogs --generate-query --generate-schema --schema-format embedded $<
endif()
if(TOTO)
list(APPEND FLEXISIP_SOURCES LOL)
list(APPEND FLEXISIP_LIBS ${TOTO_LIBRARIES} )
list(APPEND FLEXISIP_INCLUDES ${TOTO_INCLUDE_DIRS})
endif()
if(ENABLE_SNMP)
list(APPEND FLEXISIP_SOURCES snmp-agent.cc snmp-agent.h)
list(APPEND FLEXISIP_LIBS ${NET_SNMP_LIBRARIES} )
list(APPEND FLEXISIP_INCLUDES ${NET_SNMP_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/mib )
endif()
if(ENABLE_ODBC)
add_definitions(-DENABLE_ODBC)
list(APPEND FLEXISIP_SOURCES authdb-odbc.cc)
list(APPEND FLEXISIP_LIBS ${ODBC_LIBRARIES} )
list(APPEND FLEXISIP_INCLUDES ${ODBC_INCLUDE_DIRS})
endif()
if(ENABLE_TRANSCODER)
list(APPEND FLEXISIP_SOURCES callcontext-transcoder.cc callcontext-transcoder.hh )
list(APPEND FLEXISIP_LIBS ${MEDIASTREAMER2_LIBRARIES} )
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)
list(APPEND FLEXISIP_LIBS ${HIREDIS_LIBRARIES} )
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)
set(PROTOBUF_PROTO ${CMAKE_CURRENT_SOURCE_DIR}/recordserializer-protobuf.proto)
add_custom_command(OUTPUT ${PROTOBUF_GENERATED_FILES}
COMMAND "${PROTOBUF_PROTOC_EXECUTABLE}" "--proto_path=${CMAKE_CURRENT_SOURCE_DIR}" "--cpp_out=${CMAKE_CURRENT_BINARY_DIR}" "${PROTOBUF_PROTO}"
COMMENT "Generate protobuf wrappers")
set_source_files_properties(${PROTOBUF_GENERATED_FILES} PROPERTIES GENERATED ON)