[asterisk-scf-commits] asterisk-scf/release/cmake.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Jan 7 21:47:42 UTC 2011
branch "master" has been updated
via 2c88d8184d586c3468902206d29d7bf5d05098da (commit)
from 0d4c69604dd5423c3041062582ee5c7e90cfdc58 (commit)
Summary of changes:
AsteriskSCF.cmake | 1395 +++++++++++++---------------
example/CMakeLists.txt | 36 +-
modules/CMakeCSharpCompiler.cmake.in | 7 -
modules/CMakeCSharpInformation.cmake | 375 --------
modules/CMakeDetermineCSharpCompiler.cmake | 85 --
modules/CMakeTestCSharpCompiler.cmake | 1 -
modules/FindMono.cmake | 36 -
7 files changed, 640 insertions(+), 1295 deletions(-)
delete mode 100644 modules/CMakeCSharpCompiler.cmake.in
delete mode 100644 modules/CMakeCSharpInformation.cmake
delete mode 100644 modules/CMakeDetermineCSharpCompiler.cmake
delete mode 100644 modules/CMakeTestCSharpCompiler.cmake
delete mode 100644 modules/FindMono.cmake
- Log -----------------------------------------------------------------
commit 2c88d8184d586c3468902206d29d7bf5d05098da
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Fri Jan 7 15:38:38 2011 -0600
Remove all multi-language support... since this will only ever be
used for C++ builds.
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 73dfa67..e1d7330 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -1,7 +1,7 @@
#
# Asterisk SCF -- An open-source communications framework.
#
-# Copyright (C) 2010, Digium, Inc.
+# Copyright (C) 2010-2011, Digium, Inc.
#
# See http://www.asterisk.org for more information about
# the Asterisk SCF project. Please do not directly contact
@@ -21,10 +21,10 @@
# * BOOST_ROOT - The preferred installation prefix for searching for
# Boost. Set this if the module has problems finding
# the proper Boost installation.
-# * BOOST_INCLUDEDIR - Set this to the include directory of Boost, if the
+# * BOOST_INCLUDEDIR - Set this to the include directory of Boost, if the
# module has problems finding the proper Boost
# installation
-# * BOOST_LIBRARYDIR - Set this to the lib directory of Boost, if the
+# * BOOST_LIBRARYDIR - Set this to the lib directory of Boost, if the
# module has problems finding the proper Boost
# installation
# * ICE_HOME - The preferred installation prefix for searching for Ice. Set
@@ -47,38 +47,38 @@
#
if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
- message(FATAL_ERROR "This project must not be built in the source directory")
+ message(FATAL_ERROR "This project must not be built in the source directory")
endif()
# Only permit integrated builds to be done at this time
if(NOT integrated_build)
- message(FATAL_ERROR "This project can not be built in a non-integrated fashion. Please use the gitall script present in the gitall repository.")
+ message(FATAL_ERROR "This project can not be built in a non-integrated fashion. Please use the gitall script present in the gitall repository.")
endif()
# Use a compile test to see if shared_ptr is supported. If present then C++0x support exists.
if(CMAKE_COMPILER_IS_GNUCXX)
- try_compile(SHARED_PTR_PRESENT
- ${CMAKE_BINARY_DIR}
- ${CMAKE_SOURCE_DIR}/cmake/tests/SharedPtr.cpp
- COMPILE_DEFINITIONS "-std=c++0x"
- OUTPUT_VARIABLE OUTPUT
+ try_compile(SHARED_PTR_PRESENT
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/cmake/tests/SharedPtr.cpp
+ COMPILE_DEFINITIONS "-std=c++0x"
+ OUTPUT_VARIABLE OUTPUT
)
- if(SHARED_PTR_PRESENT)
- message(STATUS "Support for C++0x Enabled")
- add_definitions("-DCPP_ZEROX_SUPPORT")
- set(CPP_ZEROX_STD "-std=c++0x")
- else()
- message(STATUS "Support for C++0x Disabled")
- endif()
+ if(SHARED_PTR_PRESENT)
+ message(STATUS "Support for C++0x Enabled")
+ add_definitions("-DCPP_ZEROX_SUPPORT")
+ set(CPP_ZEROX_STD "-std=c++0x")
+ else()
+ message(STATUS "Support for C++0x Disabled")
+ endif()
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
# If a build type has not been explicitly specified then use debug
if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE debug CACHE STRING
- "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Profile."
- FORCE)
+ set(CMAKE_BUILD_TYPE debug CACHE STRING
+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Profile."
+ FORCE)
endif()
# since Debug, debug and DeBuG all mean the same thing to cmake, tolower it
@@ -89,61 +89,61 @@ string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
find_package(Threads REQUIRED)
if(CMAKE_SYSTEM MATCHES "SunOS.*")
- set(CMAKE_CXX_FLAGS "-pthreads ")
+ set(CMAKE_CXX_FLAGS "-pthreads ")
endif()
if(CMAKE_COMPILER_IS_GNUC)
- set(CMAKE_C_FLAGS_DEBUG "-Werror -Wall -g3"
- CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+ set(CMAKE_C_FLAGS_DEBUG "-Werror -Wall -g3"
+ CACHE STRING "Flags used by the compiler during debug builds." FORCE)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS "${CPP_ZEROX_STD}"
- CACHE STRING "Flags used by the compiler during release builds." FORCE)
- set(CMAKE_CXX_FLAGS_DEBUG "-Werror -Wall -g3"
- CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+ set(CMAKE_CXX_FLAGS "${CPP_ZEROX_STD}"
+ CACHE STRING "Flags used by the compiler during release builds." FORCE)
+ set(CMAKE_CXX_FLAGS_DEBUG "-Werror -Wall -g3"
+ CACHE STRING "Flags used by the compiler during debug builds." FORCE)
endif()
if(WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL profile)
- message(FATAL_ERROR "Profile builds not supported")
+ message(FATAL_ERROR "Profile builds not supported")
endif()
if(NOT WIN32)
- message(STATUS "Adding profile flags")
- set(CMAKE_C_FLAGS_PROFILE
- "${CMAKE_C_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
- CACHE STRING "Flags used by the compiler during profile builds." FORCE)
- set(CMAKE_CXX_FLAGS_PROFILE
- "${CMAKE_CXX_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
- CACHE STRING "Flags used by the compiler during profile builds." FORCE)
- set(CMAKE_EXE_LINKER_FLAGS_PROFILE
- "${CMAKE_EXE_LINKER_FLAGS_DEBUG}"
- CACHE STRING "Flags used by the linker during profile builds." FORCE)
+ message(STATUS "Adding profile flags")
+ set(CMAKE_C_FLAGS_PROFILE
+ "${CMAKE_C_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
+ CACHE STRING "Flags used by the compiler during profile builds." FORCE)
+ set(CMAKE_CXX_FLAGS_PROFILE
+ "${CMAKE_CXX_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
+ CACHE STRING "Flags used by the compiler during profile builds." FORCE)
+ set(CMAKE_EXE_LINKER_FLAGS_PROFILE
+ "${CMAKE_EXE_LINKER_FLAGS_DEBUG}"
+ CACHE STRING "Flags used by the linker during profile builds." FORCE)
endif()
if(${CMAKE_BUILD_TYPE} STREQUAL profile)
- message(STATUS "Disabling shared libs.")
- set(BUILD_SHARED_LIBS false
- CACHE BOOL "Enables building shared libraries." FORCE)
+ message(STATUS "Disabling shared libs.")
+ set(BUILD_SHARED_LIBS false
+ CACHE BOOL "Enables building shared libraries." FORCE)
endif()
if(NOT DEFINED BUILD_SHARED_LIBS)
- message(STATUS "Enabling shared libs.")
- set(BUILD_SHARED_LIBS true
- CACHE BOOL "Enables building shared libraries." FORCE)
+ message(STATUS "Enabling shared libs.")
+ set(BUILD_SHARED_LIBS true
+ CACHE BOOL "Enables building shared libraries." FORCE)
endif()
# Enable the use of CTest for running unit tests
enable_testing()
if(UNIX AND EXISTS "${CMAKE_SOURCE_DIR}/.svn")
- add_custom_target(update COMMAND svn update WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating checkout")
+ add_custom_target(update COMMAND svn update WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating checkout")
elseif(UNIX AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
- add_custom_target(update COMMAND git pull WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating clone")
- add_custom_target(pull COMMAND git pull WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating clone")
+ add_custom_target(update COMMAND git pull WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating clone")
+ add_custom_target(pull COMMAND git pull WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating clone")
endif()
macro(set_cache_var)
- set(${ARGV} CACHE INTERNAL Bob FORCE)
+ set(${ARGV} CACHE INTERNAL Bob FORCE)
endmacro()
# Function which scans a path for matching files or directories,
@@ -152,321 +152,254 @@ endmacro()
# if there were no matches. Single-character globs (?) can
# be used in the base string, but not multi-character globs (*).
function(find_best_version output base)
- get_filename_component(base_full "${base}" ABSOLUTE)
- file(GLOB path_list "${base_full}*")
- string(LENGTH "${base_full}" base_length)
- foreach(path ${path_list})
- get_filename_component(path_full "${path}" ABSOLUTE)
- string(LENGTH "${path_full}" path_length)
- math(EXPR get "${path_length} - ${base_length}")
- string(SUBSTRING "${path_full}" ${base_length} ${get} ver)
- if(NOT DEFINED best_ver)
- set(best_ver ${ver})
- set(best_path "${path_full}")
- elseif(best_ver VERSION_LESS ver)
- set(best_ver ${ver})
- set(best_path "${path_full}")
- endif()
- endforeach()
- if(DEFINED best_ver)
- set(${output} "${best_path}" PARENT_SCOPE)
- else()
- set(${output} "NOTFOUND" PARENT_SCOPE)
- endif()
+ get_filename_component(base_full "${base}" ABSOLUTE)
+ file(GLOB path_list "${base_full}*")
+ string(LENGTH "${base_full}" base_length)
+ foreach(path ${path_list})
+ get_filename_component(path_full "${path}" ABSOLUTE)
+ string(LENGTH "${path_full}" path_length)
+ math(EXPR get "${path_length} - ${base_length}")
+ string(SUBSTRING "${path_full}" ${base_length} ${get} ver)
+ if(NOT DEFINED best_ver)
+ set(best_ver ${ver})
+ set(best_path "${path_full}")
+ elseif(best_ver VERSION_LESS ver)
+ set(best_ver ${ver})
+ set(best_path "${path_full}")
+ endif()
+ endforeach()
+ if(DEFINED best_ver)
+ set(${output} "${best_path}" PARENT_SCOPE)
+ else()
+ set(${output} "NOTFOUND" PARENT_SCOPE)
+ endif()
endfunction()
# Find Ice installation for a specific major/minor version
function(find_ICE version)
- set(ice "$ENV{ICE_HOME}")
- if(NOT ice)
- if(WIN32)
- find_best_version(ice "C:/Ice-${version}")
- elseif(UNIX)
- find_best_version(ice "/opt/Ice-${version}")
- endif()
- endif()
-
- if(NOT ice)
- message(FATAL_ERROR "Could not find an installation of Ice with version ${version}")
- endif()
- find_path(ICE_SLICE_DIR Ice/Current.ice PATHS "${ice}/../slice" "${ice}/slice" NO_DEFAULT_PATH)
- if(ICE_SLICE_DIR)
- message(STATUS "Found Ice Slice definitions in ${ICE_SLICE_DIR}")
- else()
- message(FATAL_ERROR "Ice installation located at ${ice} is incomplete or broken (missing 'slice' directory)")
- endif()
- file(TO_CMAKE_PATH "${ice}" ice_cmake_path)
- set_cache_var(ICE_DIR "${ice_cmake_path}")
-
- # find icebox executable
- # XXX Need to look for iceboxd.exe for debug windows builds
- find_program(ICEBOX icebox PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
-
- if(ICEBOX)
- message(STATUS "Found icebox at ${ICEBOX}")
- else()
- message(WARNING "Failed to find icebox ${ICE_DIR}")
- endif()
-endfunction()
-
-# Find Ice headers and libraries for CXX components
-function(find_ICE_CXX)
- find_path(ICE_CXX_INCLUDE_DIR Ice/Ice.h PATHS "${ICE_DIR}/include" NO_DEFAULT_PATH)
- if(ICE_CXX_INCLUDE_DIR)
- message(STATUS "Found Ice headers for CXX in ${ICE_CXX_INCLUDE_DIR}")
- else()
- message(FATAL_ERROR "Failed to find Ice headers for CXX")
- endif()
- # This block essentially tricks the GNU compiler into treating the Ice header files as system headers. This has
- # the benefit of having warnings emitted by the headers NOT treated as errors, even if the compiler has been told
- # to do so. This is currently being utilized by the C++0x support in this file so that Ice itself does not have to
- # be updated to be C++0x safe.
- if(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${ICE_CXX_INCLUDE_DIR}"
- CACHE STRING "Flags used by the compiler during release builds." FORCE)
- endif()
-endfunction()
-
-# Find an Ice library for CXX components
-function(find_ICE_CXX_library LIBRARY)
- if(NOT ICE_CXX_LIB_${LIBRARY})
- if(WIN32)
- string(TOLOWER ${LIBRARY} lib)
- find_library(ICE_CXX_LIB_RELEASE_${LIBRARY} ${lib} PATHS "${ICE_DIR}/lib" NO_DEFAULT_PATH)
- if(ICE_CXX_LIB_RELEASE_${LIBRARY})
- message(STATUS "Found Ice ${LIBRARY} library for CXX (release build) at ${ICE_CXX_LIB_RELEASE_${LIBRARY}}")
- list(APPEND ficxxl_libs optimized "${ICE_CXX_LIB_RELEASE_${LIBRARY}}")
- endif()
- find_library(ICE_CXX_LIB_DEBUG_${LIBRARY} ${lib}d PATHS "${ICE_DIR}/lib" NO_DEFAULT_PATH)
- if(ICE_CXX_LIB_DEBUG_${LIBRARY})
- message(STATUS "Found Ice ${LIBRARY} library for CXX (debug build) at ${ICE_CXX_LIB_DEBUG_${LIBRARY}}")
- list(APPEND ficxxl_libs debug "${ICE_CXX_LIB_DEBUG_${LIBRARY}}")
- endif()
- if(ficxxl_libs)
- set_cache_var(ICE_CXX_LIB_${LIBRARY} ${ficxxl_libs})
- else()
- message(FATAL_ERROR "Failed to find Ice ${LIBRARY} library for CXX")
- endif()
- elseif(UNIX)
- find_library(ICE_CXX_LIB_${LIBRARY} ${LIBRARY} PATHS "${ICE_DIR}/lib" "${ICE_DIR}/lib32" "${ICE_DIR}/lib64" NO_DEFAULT_PATH)
- if(ICE_CXX_LIB_${LIBRARY})
- message(STATUS "Found Ice ${LIBRARY} library for CXX at ${ICE_CXX_LIB_${LIBRARY}}")
- else()
- message(FATAL_ERROR "Failed to find Ice ${LIBRARY} library for CXX")
- endif()
- endif()
- endif()
-
- if(UNIX)
- get_filename_component(library_path ${ICE_CXX_LIB_${LIBRARY}} PATH)
- link_directories(${library_path})
- endif()
-endfunction()
-
-# Find an Ice assembly for CSharp components
-function(find_ICE_CSharp_library LIBRARY)
- if(NOT ICE_CSharp_LIB_${LIBRARY})
- find_file(ICE_CSharp_LIB_${LIBRARY} ${LIBRARY}.dll PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
- if(ICE_CSharp_LIB_${LIBRARY})
- message(STATUS "Found Ice ${LIBRARY} assembly for CSharp at ${ICE_CSharp_LIB_${LIBRARY}}")
- else()
- message(FATAL_ERROR "Failed to find Ice ${LIBRARY} assembly for CSharp")
- endif()
- endif()
+ set(ice "$ENV{ICE_HOME}")
+ if(NOT ice)
+ if(WIN32)
+ find_best_version(ice "C:/Ice-${version}")
+ elseif(UNIX)
+ find_best_version(ice "/opt/Ice-${version}")
+ endif()
+ endif()
+
+ if(NOT ice)
+ message(FATAL_ERROR "Could not find an installation of Ice with version ${version}")
+ endif()
+ find_path(ICE_SLICE_DIR Ice/Current.ice PATHS "${ice}/../slice" "${ice}/slice" NO_DEFAULT_PATH)
+ if(ICE_SLICE_DIR)
+ message(STATUS "Found Ice Slice definitions in ${ICE_SLICE_DIR}")
+ else()
+ message(FATAL_ERROR "Ice installation located at ${ice} is incomplete or broken (missing 'slice' directory)")
+ endif()
+ file(TO_CMAKE_PATH "${ice}" ice_cmake_path)
+ set_cache_var(ICE_DIR "${ice_cmake_path}")
+
+ # find icebox executable
+ # XXX Need to look for iceboxd.exe for debug windows builds
+ find_program(ICEBOX icebox PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
+
+ if(ICEBOX)
+ message(STATUS "Found icebox at ${ICEBOX}")
+ else()
+ message(WARNING "Failed to find icebox ${ICE_DIR}")
+ endif()
+ find_path(ICE_INCLUDE_DIR Ice/Ice.h PATHS "${ICE_DIR}/include" NO_DEFAULT_PATH)
+ if(ICE_INCLUDE_DIR)
+ message(STATUS "Found Ice headers in ${ICE_INCLUDE_DIR}")
+ else()
+ message(FATAL_ERROR "Failed to find Ice headers")
+ endif()
+ # This block essentially tricks the GNU compiler into treating the Ice header files as system headers. This has
+ # the benefit of having warnings emitted by the headers NOT treated as errors, even if the compiler has been told
+ # to do so. This is currently being utilized by the C++0x support in this file so that Ice itself does not have to
+ # be updated to be C++0x safe.
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${ICE_INCLUDE_DIR}"
+ CACHE STRING "Flags used by the compiler during release builds." FORCE)
+ endif()
endfunction()
-# Find an Ice module for Java components
-function(find_ICE_Java_library LIBRARY)
- if(NOT ICE_Java_LIB_${LIBRARY})
- find_file(ICE_Java_LIB_${LIBRARY} ${LIBRARY}.jar PATHS "${ICE_DIR}/lib" NO_DEFAULT_PATH)
- if(ICE_Java_LIB_${LIBRARY})
- message(STATUS "Found Ice ${LIBRARY} module for Java at ${ICE_Java_LIB_${LIBRARY}}")
- else()
- message(FATAL_ERROR "Failed to find Ice ${LIBRARY} module for Java")
- endif()
- endif()
+# Find an Ice library.
+function(find_ICE_library LIBRARY)
+ if(NOT ICE_LIB_${LIBRARY})
+ if(WIN32)
+ string(TOLOWER ${LIBRARY} lib)
+ find_library(ICE_LIB_RELEASE_${LIBRARY} ${lib} PATHS "${ICE_DIR}/lib" NO_DEFAULT_PATH)
+ if(ICE_LIB_RELEASE_${LIBRARY})
+ message(STATUS "Found Ice '${LIBRARY}' library (release build) at ${ICE_LIB_RELEASE_${LIBRARY}}")
+ list(APPEND ficxxl_libs optimized "${ICE_LIB_RELEASE_${LIBRARY}}")
+ endif()
+ find_library(ICE_LIB_DEBUG_${LIBRARY} ${lib}d PATHS "${ICE_DIR}/lib" NO_DEFAULT_PATH)
+ if(ICE_LIB_DEBUG_${LIBRARY})
+ message(STATUS "Found Ice '${LIBRARY}' library (debug build) at ${ICE_LIB_DEBUG_${LIBRARY}}")
+ list(APPEND ficxxl_libs debug "${ICE_LIB_DEBUG_${LIBRARY}}")
+ endif()
+ if(ficxxl_libs)
+ set_cache_var(ICE_LIB_${LIBRARY} ${ficxxl_libs})
+ else()
+ message(FATAL_ERROR "Failed to find Ice '${LIBRARY}' library")
+ endif()
+ elseif(UNIX)
+ find_library(ICE_LIB_${LIBRARY} ${LIBRARY} PATHS "${ICE_DIR}/lib" "${ICE_DIR}/lib32" "${ICE_DIR}/lib64" NO_DEFAULT_PATH)
+ if(ICE_LIB_${LIBRARY})
+ message(STATUS "Found Ice '${LIBRARY}' library at ${ICE_LIB_${LIBRARY}}")
+ else()
+ message(FATAL_ERROR "Failed to find Ice '${LIBRARY}' library")
+ endif()
+ endif()
+ endif()
+
+ if(UNIX)
+ get_filename_component(library_path ${ICE_LIB_${LIBRARY}} PATH)
+ link_directories(${library_path})
+ endif()
endfunction()
-# Find a Boost library for CXX components
+# Find a Boost library.
function(find_Boost_library LIBRARY)
+ if(NOT Boost_FOUND)
+ set(Boost_ADDITIONAL_VERSIONS "1.39" "1.39.0" "1.40" "1.40.0" "1.41" "1.41.0" "1.42" "1.42.0" "1.44" "1.44.0")
+ find_package(Boost)
if(NOT Boost_FOUND)
- set(Boost_ADDITIONAL_VERSIONS "1.39" "1.39.0" "1.40" "1.40.0" "1.41" "1.41.0" "1.42" "1.42.0" "1.44" "1.44.0")
- find_package(Boost)
- if(NOT Boost_FOUND)
- message(FATAL_ERROR "Boost libraries not found")
- endif()
- set(Boost_CORE_FOUND "bazinga" PARENT_SCOPE)
- set(Boost_CORE_FOUND "bazinga")
- endif()
- string(TOUPPER ${LIBRARY} libtag)
+ message(FATAL_ERROR "Boost libraries not found")
+ endif()
+ set(Boost_CORE_FOUND "bazinga" PARENT_SCOPE)
+ set(Boost_CORE_FOUND "bazinga")
+ endif()
+ string(TOUPPER ${LIBRARY} libtag)
+ if(NOT Boost_${libtag}_FOUND)
+ find_package(Boost COMPONENTS ${LIBRARY})
if(NOT Boost_${libtag}_FOUND)
- find_package(Boost COMPONENTS ${LIBRARY})
- if(NOT Boost_${libtag}_FOUND)
- message(FATAL_ERROR "Failed to find Boost library ${LIBRARY}")
- endif()
+ message(FATAL_ERROR "Failed to find Boost library ${LIBRARY}")
endif()
+ endif()
endfunction()
# Function which initializes project specific things
function(asterisk_scf_project NAME ICE_VERSION)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one language to this function")
- endif()
- message(STATUS "Setting up project ${NAME} for languages ${ARGN}")
- set(ASTERISK_SCF_PROJECT_LANGUAGES ${ARGN} PARENT_SCOPE)
- set(ASTERISK_SCF_ICE_VERSION ${ICE_VERSION} PARENT_SCOPE)
- project(${NAME} ${ARGN})
- # On Windows, IceBox C++ services must be compiled with some symbols exported;
- # the source code should use ASTERISK_SCF_ICEBOX_EXPORT to accomplish this, and this
-
- if(WIN32)
- message(STATUS "Setting ASTERISK_SCF_ICEBOX_EXPORT definition for Windows IceBox services")
- add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=__declspec\(dllexport\))
- else()
- add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=)
- endif()
- # On Windows, 'debug' libraries should have a "d" suffix to indicate that they
- # are debug libraries
- if(WIN32)
- set(CMAKE_DEBUG_POSTFIX "d" PARENT_SCOPE)
- endif()
- find_ICE(${ICE_VERSION})
- foreach(l ${ARGN})
- set(ASTERISK_SCF_ICE_LIBRARIES_${l} Ice PARENT_SCOPE)
- # Perform requirement checking for each language to be used in the project
- if(l STREQUAL "Java")
- message(STATUS "Performing requirement checks for Java components")
- find_ICE_Java_library(Ice)
- message(STATUS "Passed requirement checks for Java components")
- elseif(l STREQUAL "CSharp")
- message(STATUS "Performing requirement checks for CSharp components")
- find_ICE_CSharp_library(Ice)
- message(STATUS "Passed requirement checks for CSharp components")
- elseif(l STREQUAL "CXX")
- message(STATUS "Performing requirement checks for CXX components")
- find_ICE_CXX()
- find_ICE_CXX_library(Ice)
- find_ICE_CXX_library(IceUtil)
- if(WIN32)
- # On Windows, the IceUtil library must be explicitly linked
- set(ASTERISK_SCF_ICE_LIBRARIES_${l} Ice IceUtil PARENT_SCOPE)
- endif()
- message(STATUS "Include directories ${ICE_CXX_INCLUDE_DIR}")
- include_directories("${ICE_CXX_INCLUDE_DIR}")
- message(STATUS "Passed requirement checks for CXX components")
- else()
- message(FATAL_ERROR "Unsupported component language ${l}")
- endif()
- endforeach()
+ message(STATUS "Setting up project ${NAME} for Ice version ${ICE_VERSION}")
+ set(ASTERISK_SCF_ICE_VERSION ${ICE_VERSION} PARENT_SCOPE)
+ project(${NAME} CXX)
+ # On Windows, IceBox C++ services must be compiled with some symbols exported;
+ # the source code should use ASTERISK_SCF_ICEBOX_EXPORT to accomplish this, and this
+ if(WIN32)
+ message(STATUS "Setting ASTERISK_SCF_ICEBOX_EXPORT definition for Windows IceBox services")
+ add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=__declspec\(dllexport\))
+ else()
+ add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=)
+ endif()
+ # On Windows, 'debug' libraries should have a "d" suffix to indicate that they
+ # are debug libraries
+ if(WIN32)
+ set(CMAKE_DEBUG_POSTFIX "d" PARENT_SCOPE)
+ endif()
+ find_ICE(${ICE_VERSION})
+ message(STATUS "Performing requirement checks for components")
+ find_ICE_library(Ice)
+ find_ICE_library(IceUtil)
+ if(WIN32)
+ # On Windows, the IceUtil library must be explicitly linked
+ set(ASTERISK_SCF_ICE_LIBRARIES Ice IceUtil PARENT_SCOPE)
+ else()
+ set(ASTERISK_SCF_ICE_LIBRARIES Ice PARENT_SCOPE)
+ endif()
+ message(STATUS "Include directories ${ICE_INCLUDE_DIR}")
+ include_directories("${ICE_INCLUDE_DIR}")
+ message(STATUS "Passed requirement checks for CXX components")
endfunction()
# Function which adds Ice libraries to all components in the current
# directory and below
function(asterisk_scf_add_ice_libraries)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one library to this function")
- endif()
- foreach(lang ${ASTERISK_SCF_PROJECT_LANGUAGES})
- set(libs ${ASTERISK_SCF_ICE_LIBRARIES_${lang}})
- foreach(lib ${ARGN})
- if(lang STREQUAL "Java")
- find_ICE_Java_library(${lib})
- elseif(lang STREQUAL "CSharp")
- find_ICE_CSharp_library(${lib})
- elseif(lang STREQUAL "CXX")
- find_ICE_CXX_library(${lib})
- endif()
- list(APPEND libs ${lib})
- endforeach()
- list(REMOVE_DUPLICATES libs)
- set(ASTERISK_SCF_ICE_LIBRARIES_${lang} ${libs} PARENT_SCOPE)
- endforeach()
+ if(NOT ARGN)
+ message(FATAL_ERROR "You must pass at least one library to this function")
+ endif()
+ set(libs ${ASTERISK_SCF_ICE_LIBRARIES})
+ foreach(lib ${ARGN})
+ find_ICE_library(${lib})
+ list(APPEND libs ${lib})
+ endforeach()
+ list(REMOVE_DUPLICATES libs)
+ set(ASTERISK_SCF_ICE_LIBRARIES ${libs} PARENT_SCOPE)
endfunction()
# Function which adds Boost libraries to all components in the current
# directory and below
function(asterisk_scf_add_boost_libraries)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one library to this function")
- endif()
- set(libs ${ASTERISK_SCF_BOOST_LIBRARIES})
- # By default we are disabling boost auto-linking and specifying dynamic linking.
- add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK)
- foreach(lib ${ARGN})
- find_Boost_library(${lib})
- list(APPEND libs ${lib})
- endforeach()
- list(REMOVE_DUPLICATES libs)
- set(ASTERISK_SCF_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
- include_directories(${Boost_INCLUDE_DIR})
- link_directories(${Boost_LIBRARY_DIRS})
+ if(NOT ARGN)
+ message(FATAL_ERROR "You must pass at least one library to this function")
+ endif()
+ set(libs ${ASTERISK_SCF_BOOST_LIBRARIES})
+ # By default we are disabling boost auto-linking and specifying dynamic linking.
+ add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK)
+ foreach(lib ${ARGN})
+ find_Boost_library(${lib})
+ list(APPEND libs ${lib})
+ endforeach()
+ list(REMOVE_DUPLICATES libs)
+ set(ASTERISK_SCF_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
+ include_directories(${Boost_INCLUDE_DIR})
+ link_directories(${Boost_LIBRARY_DIRS})
endfunction()
# Ensures that a list of paths are all absolute paths.
macro(ensure_abs_paths pathlist)
- unset(eap_temp)
- foreach(p ${${pathlist}})
- get_filename_component(newpath "${p}" ABSOLUTE)
- list(APPEND eap_temp "${newpath}")
- endforeach()
- list(REMOVE_DUPLICATES eap_temp)
- set(${pathlist} ${eap_temp})
+ unset(eap_temp)
+ foreach(p ${${pathlist}})
+ get_filename_component(newpath "${p}" ABSOLUTE)
+ list(APPEND eap_temp "${newpath}")
+ endforeach()
+ list(REMOVE_DUPLICATES eap_temp)
+ set(${pathlist} ${eap_temp})
endmacro()
# Function which remembers include directories needed for a particular Slice target
function(asterisk_scf_slice_include_directories)
- set(paths ${ARGN})
- ensure_abs_paths(paths)
- if(SLICE_INCLUDE_DIRECTORIES)
- list(INSERT paths 0 ${SLICE_INCLUDE_DIRECTORIES})
- endif()
- list(REMOVE_DUPLICATES paths)
- set(SLICE_INCLUDE_DIRECTORIES ${paths} PARENT_SCOPE)
+ set(paths ${ARGN})
+ ensure_abs_paths(paths)
+ if(SLICE_INCLUDE_DIRECTORIES)
+ list(INSERT paths 0 ${SLICE_INCLUDE_DIRECTORIES})
+ endif()
+ list(REMOVE_DUPLICATES paths)
+ set(SLICE_INCLUDE_DIRECTORIES ${paths} PARENT_SCOPE)
endfunction()
# Function which remembers definitions needed for a particular Slice target
function(asterisk_scf_slice_compile_definitions SLICE_FILE)
- get_filename_component(SLICE ${SLICE_FILE} NAME_WE)
- set(SLICE_COMPILE_DEFINITIONS_${SLICE} ${ARGN} PARENT_SCOPE)
+ get_filename_component(SLICE ${SLICE_FILE} NAME_WE)
+ set(SLICE_COMPILE_DEFINITIONS_${SLICE} ${ARGN} PARENT_SCOPE)
endfunction()
# Function which remembers Ice libraries needed by a Slice target
function(asterisk_scf_slice_add_ice_libraries TARGET)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one library to this function")
- endif()
- set(libs ${${TARGET}_ICE_LIBRARIES})
- foreach(lib ${ARGN})
- foreach(lang ${ASTERISK_SCF_PROJECT_LANGUAGES})
- if(lang STREQUAL "Java")
- find_ICE_Java_library(${lib})
- elseif(lang STREQUAL "CSharp")
- find_ICE_CSharp_library(${lib})
- elseif(lang STREQUAL "CXX")
- find_ICE_CXX_library(${lib})
- endif()
- endforeach()
- list(APPEND libs ${lib})
- endforeach()
- list(REMOVE_DUPLICATES libs)
- set(${TARGET}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
+ if(NOT ARGN)
+ message(FATAL_ERROR "You must pass at least one library to this function")
+ endif()
+ set(libs ${${TARGET}_ICE_LIBRARIES})
+ foreach(lib ${ARGN})
+ find_ICE_library(${lib})
+ list(APPEND libs ${lib})
+ endforeach()
+ list(REMOVE_DUPLICATES libs)
+ set(${TARGET}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
endfunction()
# Function which adds a dependency for a Slice definition
function(asterisk_scf_slice_add_dependencies TARGET)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one dependency to this function")
- endif()
- foreach(l ${ASTERISK_SCF_PROJECT_LANGUAGES})
- foreach(d ${ARGN})
- message(STATUS "Adding dependency on slice definition ${d} to ${TARGET} for ${l} language")
- add_dependencies(${TARGET}_${l} ${d}_${l})
- endforeach()
- endforeach()
+ if(NOT ARGN)
+ message(FATAL_ERROR "You must pass at least one dependency to this function")
+ endif()
+ foreach(d ${ARGN})
+ message(STATUS "Adding dependency on slice definition ${d} to ${TARGET}")
+ add_dependencies(${TARGET}_${l} ${d}_${l})
+ endforeach()
endfunction()
-# Function which compiles one or more Slice definition files;
-# the file(s) are compiled for all languages in use in the project
+# Function which compiles one or more Slice definition files
#
# Syntax:
# asterisk_scf_compile_slice(<target> [SOURCES source1 ... sourceN])
@@ -481,519 +414,443 @@ endfunction()
# source files. The '.ice' extension must be included. Source file
# names can be glob patterns.
#
-# sets these variables (where SLICE is the target name computed
-# as above and LANG is each language used in the project):
+# sets these variables (where SLICE is the target name computed):
#
-# ASTERISK_SCF_SLICE_${SLICE}_${LANG}
-# marker indicating this Slice has been built for the language
-# ASTERISK_SCF_SLICE_${SLICE}_CXX_INCLUDE_DIRS
+# ASTERISK_SCF_SLICE_${SLICE}
+# marker indicating this Slice has been built
+# ASTERISK_SCF_SLICE_${SLICE}_INCLUDE_DIRS
# directories where generated header files needed for this target live
-# (only for C++)
function(asterisk_scf_compile_slice TARGET_IN DIR_IN DESC_IN GROUP_IN)
- if(ARGN)
- foreach(arg ${ARGN})
- if(NOT source_mode)
- if(arg STREQUAL "SOURCES")
- set(source_mode true)
- else()
- message(FATAL_ERROR "Unsupported argument '${arg}' passed to asterisk_scf_compile_slice")
- endif()
- else()
- list(APPEND inputs "${arg}")
- endif()
- endforeach()
- set(TARGET "${TARGET_IN}")
- else()
- set(slice_files "${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_IN}")
- get_filename_component(file "${TARGET_IN}" NAME_WE)
- set(TARGET "${file}")
- endif()
-
- # Now that we have the list of inputs, convert any of them
- # that are glob-patterns into the list of files that match
- if(source_mode)
- foreach(input ${inputs})
- if(IS_ABSOLUTE "${input}")
- file(GLOB globbed "${input}")
- else()
- file(GLOB globbed "${CMAKE_CURRENT_SOURCE_DIR}/${input}")
- endif()
- if(globbed)
- foreach (glob ${globbed})
- file(TO_CMAKE_PATH "${glob}" cmake_path)
- if(glob MATCHES "\\.ice$")
- list(APPEND slice_files "${cmake_path}")
- endif()
- if(glob MATCHES "\\.h$")
- list(APPEND cpp_header_files "${cmake_path}")
- endif()
- if(glob MATCHES "\\.cpp$")
- list(APPEND cpp_source_files "${cmake_path}")
- endif()
- endforeach()
- else()
- if(input MATCHES "\\.ice$")
- list(APPEND slice_files "${input}")
- endif()
- endif()
- endforeach()
- endif()
-
- # This makes the Slice definitions display in their own folder in the IDE,
- # specifically Visual Studio
- source_group("Slice Definitions" REGULAR_EXPRESSION "\\.ice$")
-
- # Append the needed include directories for Slice definitions
- # (global and the ones stored for this target)
- if(ICE_SLICE_DIR)
- list(APPEND slice_compiler_arguments "-I${ICE_SLICE_DIR}")
- endif()
- foreach(include ${SLICE_INCLUDE_DIRECTORIES})
- # Each directory in this list will be in the source tree,
- # which is what the Slice compiler will need
- list(APPEND slice_compiler_arguments "-I${include}")
- # If there are any CXX targets that depend on this target,
- # they'll need a path to the *parallel* directory in the build
- # tree where the Slice compiler will have generated the
- # header file(s) for the Slice definitions in the source tree
- # but only if the Slice include path is actually part of the
- # source tree... if it's not, it is assumed that the relevant
- # header files live in the same directory as the Slice files
- file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${include}")
- if(relpath MATCHES "^../")
- # The directory is not located in the source tree, so use the
- # original path
- list(APPEND target_CXX_includes "${include}")
- else()
- # The directory is located in the source tree, so use the
- # parallel path in the build tree
- list(APPEND target_CXX_includes "${CMAKE_BINARY_DIR}/${relpath}")
- endif()
+ if(ARGN)
+ foreach(arg ${ARGN})
+ if(NOT source_mode)
+ if(arg STREQUAL "SOURCES")
+ set(source_mode true)
+ else()
+ message(FATAL_ERROR "Unsupported argument '${arg}' passed to asterisk_scf_compile_slice")
+ endif()
+ else()
+ list(APPEND inputs "${arg}")
+ endif()
endforeach()
-
- # Append any definitions stored for this target
- foreach(SLICEDEF ${SLICE_COMPILE_DEFINITIONS_${TARGET}})
- list(APPEND slice_compiler_arguments "-D${SLICEDEF}")
+ set(TARGET "${TARGET_IN}")
+ else()
+ set(slice_files "${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_IN}")
+ get_filename_component(file "${TARGET_IN}" NAME_WE)
+ set(TARGET "${file}")
+ endif()
+
+ # Now that we have the list of inputs, convert any of them
+ # that are glob-patterns into the list of files that match
+ if(source_mode)
+ foreach(input ${inputs})
+ if(IS_ABSOLUTE "${input}")
+ file(GLOB globbed "${input}")
+ else()
+ file(GLOB globbed "${CMAKE_CURRENT_SOURCE_DIR}/${input}")
+ endif()
+ if(globbed)
+ foreach (glob ${globbed})
+ file(TO_CMAKE_PATH "${glob}" cmake_path)
+ if(glob MATCHES "\\.ice$")
+ list(APPEND slice_files "${cmake_path}")
+ endif()
+ if(glob MATCHES "\\.h$")
+ list(APPEND cpp_header_files "${cmake_path}")
+ endif()
+ if(glob MATCHES "\\.cpp$")
+ list(APPEND cpp_source_files "${cmake_path}")
+ endif()
+ endforeach()
+ else()
+ if(input MATCHES "\\.ice$")
+ list(APPEND slice_files "${input}")
+ endif()
+ endif()
endforeach()
- list(REMOVE_DUPLICATES slice_compiler_arguments)
-
- foreach(file ${slice_files})
- file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${file}")
- string(REPLACE "/" "_" file_variable ${relpath})
- set_cache_var(TARGET_${file_variable} ${TARGET})
+ endif()
+
+ # This makes the Slice definitions display in their own folder in the IDE,
+ # specifically Visual Studio
+ source_group("Slice Definitions" REGULAR_EXPRESSION "\\.ice$")
+
+ # Append the needed include directories for Slice definitions
+ # (global and the ones stored for this target)
+ if(ICE_SLICE_DIR)
+ list(APPEND slice_compiler_arguments "-I${ICE_SLICE_DIR}")
+ endif()
+ foreach(include ${SLICE_INCLUDE_DIRECTORIES})
+ # Each directory in this list will be in the source tree,
+ # which is what the Slice compiler will need
+ list(APPEND slice_compiler_arguments "-I${include}")
+ # If there are any CXX targets that depend on this target,
+ # they'll need a path to the *parallel* directory in the build
+ # tree where the Slice compiler will have generated the
+ # header file(s) for the Slice definitions in the source tree
+ # but only if the Slice include path is actually part of the
+ # source tree... if it's not, it is assumed that the relevant
+ # header files live in the same directory as the Slice files
+ file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${include}")
+ if(relpath MATCHES "^../")
+ # The directory is not located in the source tree, so use the
+ # original path
+ list(APPEND target_includes "${include}")
+ else()
+ # The directory is located in the source tree, so use the
+ # parallel path in the build tree
+ list(APPEND target_includes "${CMAKE_BINARY_DIR}/${relpath}")
+ endif()
+ endforeach()
+
+ # Append any definitions stored for this target
+ foreach(SLICEDEF ${SLICE_COMPILE_DEFINITIONS_${TARGET}})
+ list(APPEND slice_compiler_arguments "-D${SLICEDEF}")
+ endforeach()
+ list(REMOVE_DUPLICATES slice_compiler_arguments)
+
+ foreach(file ${slice_files})
+ file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${file}")
+ string(REPLACE "/" "_" file_variable ${relpath})
+ set_cache_var(TARGET_${file_variable} ${TARGET})
+ endforeach()
+
+ message(STATUS "Building Slice target ${TARGET} as a library")
+ set(suffixes cpp h)
+ include_directories("${CMAKE_CURRENT_BINARY_DIR}")
+
+ if(NOT SLICE_COMPILER)
+ # Find the actual Slice compiler
+ find_program(SLICE_COMPILER slice2cpp PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
+
+ # If we fail to find it we have to abort here, we can go no further
+ if(SLICE_COMPILER)
+ message(STATUS "Found Slice compiler at ${SLICE_COMPILER}")
+ else()
+ message(FATAL_ERROR "Failed to find Slice compiler")
+ endif()
+ endif()
+
+ # Look for the dependencies for this slice definition, we have to do it now since the target was just added
+ message(STATUS "Determining dependencies for Slice target ${TARGET}")
+ execute_process(COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments}
+ --depend ${slice_files} OUTPUT_VARIABLE raw_dependencies
+ ERROR_VARIABLE slice_errors)
+ if(slice_errors)
+ message(FATAL_ERROR "Slice compiler produced errors:\n ${slice_errors}")
+ endif()
+
+ if(raw_dependencies)
+ # The next block of stuff sanitizes the output we got from the slice compiler into a non-Makefile specific foo
+ # Get rid of all the \ characters
+ string(REPLACE "\\" "" raw_dependencies "${raw_dependencies}")
+ # Turn the newlines into CMake list item separators, since the compiler spits out one dependency per line
+ string(REPLACE "\n" ";" raw_dependencies "${raw_dependencies}")
+ string(REPLACE " ;" ";" raw_dependencies "${raw_dependencies}")
+ string(REPLACE "; " ";" raw_dependencies "${raw_dependencies}")
+
+ foreach(dep ${raw_dependencies})
+ # If the name ends with a colon, it's actually a Makefile target name and should be
+ # skipped
+ if(NOT dep MATCHES ":$")
+ # Convert the path into a cmake one so we can absolutely get the filename
+ file(TO_CMAKE_PATH ${dep} dep)
+ file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${dep}")
+ string(REPLACE "/" "_" file_variable "${relpath}")
+ set(dep_target ${TARGET_${file_variable}})
+ if(dep_target)
+ # If this is not already us add it as a dependency
+ if(NOT dep_target STREQUAL ${TARGET})
+ message(STATUS "Auto-adding dependency on Slice target ${dep_target} to ${TARGET}")
+ list(APPEND source_dependencies ${dep})
+ list(APPEND target_dependencies ${dep_target})
+ list(APPEND target_includes ${ASTERISK_SCF_SLICE_${dep_target}_INCLUDE_DIRS})
+ endif()
+ else()
+ # Remember sources that are not associated with targets too
+ message(STATUS "Auto-adding dependency on Slice source ${dep} to ${TARGET}")
+ list(APPEND source_dependencies ${dep})
+ endif()
+ endif()
endforeach()
+ endif()
- foreach(lang ${ASTERISK_SCF_PROJECT_LANGUAGES})
- unset(generated_files)
- unset(target_dependencies)
- unset(source_dependencies)
- unset(raw_dependencies)
- unset(target_libs)
- unset(slice_export_arguments)
- if(lang STREQUAL "Java")
- message(STATUS "Building Slice target ${TARGET} as Java classes")
- elseif(lang STREQUAL "CSharp")
- message(STATUS "Building Slice target ${TARGET} as a CSharp assembly")
- set(compiler slice2cs)
- set(suffixes cs)
- elseif(lang STREQUAL "CXX")
- message(STATUS "Building Slice target ${TARGET} as a CXX library")
- set(compiler slice2cpp)
- set(suffixes cpp h)
- include_directories("${CMAKE_CURRENT_BINARY_DIR}")
- else()
- message(FATAL_ERROR "Unsupported Slice compiled language ${lang}")
- endif()
-
- if(NOT SLICE_COMPILER_${lang})
- # Find the actual Slice compiler
- find_program(SLICE_COMPILER_${lang} ${compiler} PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
-
- # If we fail to find it we have to abort here, we can go no further
- if(SLICE_COMPILER_${lang})
- message(STATUS "Found Slice compiler for ${lang} at ${SLICE_COMPILER_${lang}}")
- else()
- message(FATAL_ERROR "Failed to find Slice compiler ${compiler}")
- endif()
- endif()
-
- # Look for the dependencies for this slice definition, we have to do it now since the target was just added
- message(STATUS "Determining dependencies for Slice target ${TARGET}")
- execute_process(COMMAND ${SLICE_COMPILER_${lang}} ${slice_compiler_arguments}
- --depend ${slice_files} OUTPUT_VARIABLE raw_dependencies
- ERROR_VARIABLE slice_errors)
- if(slice_errors)
- message(FATAL_ERROR "Slice compiler produced errors:\n ${slice_errors}")
- endif()
-
- if(raw_dependencies)
- # The next block of stuff sanitizes the output we got from the slice compiler into a non-Makefile specific foo
- # Get rid of all the \ characters
- string(REPLACE "\\" "" raw_dependencies "${raw_dependencies}")
- # Turn the newlines into CMake list item separators, since the compiler spits out one dependency per line
- string(REPLACE "\n" ";" raw_dependencies "${raw_dependencies}")
- string(REPLACE " ;" ";" raw_dependencies "${raw_dependencies}")
- string(REPLACE "; " ";" raw_dependencies "${raw_dependencies}")
-
- foreach(dep ${raw_dependencies})
- # If the name ends with a colon, it's actually a Makefile target name and should be
- # skipped
- if(NOT dep MATCHES ":$")
- # Convert the path into a cmake one so we can absolutely get the filename
- file(TO_CMAKE_PATH ${dep} dep)
- file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${dep}")
- string(REPLACE "/" "_" file_variable "${relpath}")
- set(dep_target ${TARGET_${file_variable}})
- if(dep_target)
- # If this is not already us add it as a dependency
- if(NOT dep_target STREQUAL ${TARGET})
- message(STATUS "Auto-adding dependency on Slice target ${dep_target} to ${TARGET} for ${lang} language")
- list(APPEND source_dependencies ${dep})
- list(APPEND target_dependencies ${dep_target}_${lang})
- list(APPEND target_CXX_includes ${ASTERISK_SCF_SLICE_${dep_target}_CXX_INCLUDE_DIRS})
- endif()
- else()
- # Remember sources that are not associated with targets too
- message(STATUS "Auto-adding dependency on Slice source ${dep} to ${TARGET} for ${lang} language")
- list(APPEND source_dependencies ${dep})
- endif()
- endif()
- endforeach()
- endif()
-
- foreach(file ${slice_files})
- foreach(suffix ${suffixes})
- get_filename_component(source "${file}" NAME_WE)
- list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${source}.${suffix}")
- endforeach()
- endforeach()
-
- set_source_files_properties(${generated_files} PROPERTIES GENERATED 1)
-
- # create a preprocessor definition in the generated CXX files that enables
- # the generated classes to be exported from the library (only necessary on Windows)
- # the definition for a target named 'FOO' will be 'FOO_CXX_EXPORTS', and if this
- # preprocessor macro is defined, then the Slice-generated classes will be marked
- # with 'dllexport'. add_library() (used below) automatically generates a definition
- # for the appropriately-named macro when the library is built in SHARED mode.
- if(WIN32 AND lang STREQUAL "CXX")
- list(APPEND slice_export_arguments "--dll-export" "${TARGET}_${lang}")
- endif()
-
- add_custom_command(
- OUTPUT ${generated_files}
- COMMAND ${SLICE_COMPILER_${lang}} ${slice_compiler_arguments} ${slice_export_arguments} ${slice_files}
- COMMENT "Building ${TARGET} from ${slice_files} using ${compiler}"
- DEPENDS ${slice_files} ${source_dependencies}
- )
-
- if(target_CXX_includes)
- list(REMOVE_DUPLICATES target_CXX_includes)
- endif()
-
- if(lang STREQUAL "Java")
- elseif(lang STREQUAL "CSharp")
- # Note that slice_files are included as sources here even though they won't be compiled
- # by the actual compiler; this is to get them to show up as sources in the project
- # created for this target
- foreach(lib ${${TARGET}_ICE_LIBRARIES} ${ASTERISK_SCF_ICE_LIBRARIES_${lang}})
- if(UNIX)
- list(APPEND target_libs "${lib}")
- else()
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- endif()
- endforeach()
- csharp_add_library(${TARGET}_${lang} ${generated_files} ${slice_files}
- REFERENCES "${ICE_CSharp_LIB_Ice}" ${target_libs} ${target_dependencies})
- elseif(lang STREQUAL "CXX")
- # Note that slice_files are included as sources here even though they won't be compiled
- # by the actual compiler; this is to get them to show up as sources in the project
- # created for this target
- include_directories(${target_CXX_includes})
- # If there are any non-generated header files required for this Slice target, copy
- # them to the binary directory where they will be needed later. The destination
- # path to file() defaults to the binary directory, so there is no need to
- # re-specify it here.
- if(cpp_header_files)
- file(COPY ${cpp_header_files} DESTINATION .)
- endif()
- add_library(${TARGET}_${lang} ${generated_files} ${slice_files} ${cpp_source_files})
- install(TARGETS ${TARGET}_${lang} DESTINATION ${DIR_IN} COMPONENT ${TARGET}_${lang})
- if(ASTERISKSCF_CPACK)
- # Adds a component to the packager. The first arg must have been previously defined
- # as a COMPONENT arg to install.
- cpack_add_component(${TARGET}_${lang} DESCRIPTION ${DESC_IN} GROUP ${GROUP_IN})
- endif()
- foreach(lib ${${TARGET}_ICE_LIBRARIES} ${ASTERISK_SCF_ICE_LIBRARIES_${lang}})
- if(UNIX)
- list(APPEND target_libs "${lib}")
- else()
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- endif()
- endforeach()
- if(target_libs)
- target_link_libraries(${TARGET}_${lang} ${target_libs})
- endif()
- if(APPLE)
- target_link_libraries(${TARGET}_${lang} ${ICE_CXX_LIB_IceUtil})
- target_link_libraries(${TARGET}_${lang} ${ICE_CXX_LIB_ZeroCIce})
- endif()
- if(target_dependencies)
- message(STATUS "Linking ${TARGET}_${lang} to ${target_dependencies}")
- target_link_libraries(${TARGET}_${lang} ${target_dependencies})
- add_dependencies(${TARGET}_${lang} ${target_dependencies})
- endif()
- if(UNIX)
- set_target_properties(${TARGET}_${lang} PROPERTIES COMPILE_FLAGS "-fPIC")
- endif()
- set_cache_var(ASTERISK_SCF_SLICE_${TARGET}_CXX_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${target_CXX_includes})
- endif()
- set_cache_var(ASTERISK_SCF_SLICE_${TARGET}_${lang} Bob)
+ foreach(file ${slice_files})
+ foreach(suffix ${suffixes})
+ get_filename_component(source "${file}" NAME_WE)
+ list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${source}.${suffix}")
endforeach()
+ endforeach()
+
+ set_source_files_properties(${generated_files} PROPERTIES GENERATED 1)
+
+ # create a preprocessor definition in the generated CXX files that enables
+ # the generated classes to be exported from the library (only necessary on Windows)
+ # the definition for a target named 'FOO' will be 'FOO_EXPORTS', and if this
+ # preprocessor macro is defined, then the Slice-generated classes will be marked
+ # with 'dllexport'. add_library() (used below) automatically generates a definition
+ # for the appropriately-named macro when the library is built in SHARED mode.
+ if(WIN32)
+ list(APPEND slice_export_arguments "--dll-export" "${TARGET}")
+ endif()
+
+ add_custom_command(
+ OUTPUT ${generated_files}
+ COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments} ${slice_export_arguments} ${slice_files}
+ COMMENT "Building ${TARGET} from ${slice_files} using slice2cpp"
+ DEPENDS ${slice_files} ${source_dependencies}
+ )
+
+ if(target_includes)
+ list(REMOVE_DUPLICATES target_includes)
+ endif()
+
+ # Note that slice_files are included as sources here even though they won't be compiled
+ # by the actual compiler; this is to get them to show up as sources in the project
+ # created for this target
+ include_directories(${target_includes})
+ # If there are any non-generated header files required for this Slice target, copy
+ # them to the binary directory where they will be needed later. The destination
+ # path to file() defaults to the binary directory, so there is no need to
+ # re-specify it here.
+ if(cpp_header_files)
+ file(COPY ${cpp_header_files} DESTINATION .)
+ endif()
+ add_library(${TARGET} ${generated_files} ${slice_files} ${cpp_source_files})
+ install(TARGETS ${TARGET} DESTINATION ${DIR_IN} COMPONENT ${TARGET})
+ if(ASTERISKSCF_CPACK)
+ # Adds a component to the packager. The first arg must have been previously defined
+ # as a COMPONENT arg to install.
+ cpack_add_component(${TARGET} DESCRIPTION ${DESC_IN} GROUP ${GROUP_IN})
+ endif()
+ foreach(lib ${${TARGET}_ICE_LIBRARIES} ${ASTERISK_SCF_ICE_LIBRARIES})
+ if(UNIX)
+ list(APPEND target_libs "${lib}")
+ else()
+ list(APPEND target_libs "${ICE_LIB_${lib}}")
+ endif()
+ endforeach()
+ if(target_libs)
+ target_link_libraries(${TARGET} ${target_libs})
+ endif()
+ if(APPLE)
+ target_link_libraries(${TARGET} ${ICE_LIB_IceUtil})
+ target_link_libraries(${TARGET} ${ICE_LIB_ZeroCIce})
+ endif()
+ if(target_dependencies)
+ message(STATUS "Linking ${TARGET} to ${target_dependencies}")
+ target_link_libraries(${TARGET} ${target_dependencies})
+ add_dependencies(${TARGET} ${target_dependencies})
+ endif()
+ if(UNIX)
+ set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "-fPIC")
+ endif()
+ set_cache_var(ASTERISK_SCF_SLICE_${TARGET}_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${target_includes})
+ set_cache_var(ASTERISK_SCF_SLICE_${TARGET} Bob)
endfunction()
# Function which initializes a component for building
-function(asterisk_scf_component_init COMPONENT LANG)
- message(STATUS "Setting up to build component ${COMPONENT}")
- set(ASTERISK_SCF_${COMPONENT}_LANG ${LANG} PARENT_SCOPE)
+function(asterisk_scf_component_init COMPONENT)
+ message(STATUS "Setting up to build component ${COMPONENT}")
+ set(ASTERISK_SCF_${COMPONENT} Bob PARENT_SCOPE)
endfunction()
# Function which adds the compiled Slice targets to a component to be built
function(asterisk_scf_component_add_slice COMPONENT)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one Slice target to this function")
- endif()
- if(NOT ASTERISK_SCF_${COMPONENT}_LANG)
- message(FATAL_ERROR "Must call asterisk_scf_component_init for component ${COMPONENT} before asterisk_scf_component_add_slice")
- endif()
- set(slice_list ${${COMPONENT}_SLICES})
- foreach(slice ${ARGN})
- get_filename_component(f ${slice} NAME_WE)
- if(NOT ASTERISK_SCF_SLICE_${f}_${ASTERISK_SCF_${COMPONENT}_LANG})
- message(FATAL_ERROR "Must call asterisk_scf_compile_slice for ${f} before asterisk_scf_component_add_slice")
- endif()
- message(STATUS "Adding Slice ${f} to component ${COMPONENT}")
- list(APPEND slice_list ${f}_${ASTERISK_SCF_${COMPONENT}_LANG})
- if(ASTERISK_SCF_${COMPONENT}_LANG STREQUAL "CXX")
- list(APPEND include_dirs ${ASTERISK_SCF_SLICE_${slice}_CXX_INCLUDE_DIRS})
- endif()
- endforeach()
- list(REMOVE_DUPLICATES slice_list)
- set(${COMPONENT}_SLICES ${slice_list} PARENT_SCOPE)
- if(include_dirs)
- list(REMOVE_DUPLICATES include_dirs)
- include_directories(${include_dirs})
- endif()
+ if(NOT ARGN)
+ message(FATAL_ERROR "You must pass at least one Slice target to this function")
+ endif()
+ if(NOT ASTERISK_SCF_${COMPONENT})
+ message(FATAL_ERROR "Must call asterisk_scf_component_init for component ${COMPONENT} before asterisk_scf_component_add_slice")
+ endif()
+ set(slice_list ${${COMPONENT}_SLICES})
+ foreach(slice ${ARGN})
+ get_filename_component(f ${slice} NAME_WE)
+ if(NOT ASTERISK_SCF_SLICE_${f})
+ message(FATAL_ERROR "Must call asterisk_scf_compile_slice for ${f} before asterisk_scf_component_add_slice")
+ endif()
+ message(STATUS "Adding Slice ${f} to component ${COMPONENT}")
+ list(APPEND slice_list ${f})
+ list(APPEND include_dirs ${ASTERISK_SCF_SLICE_${slice}_INCLUDE_DIRS})
+ endforeach()
+ list(REMOVE_DUPLICATES slice_list)
+ set(${COMPONENT}_SLICES ${slice_list} PARENT_SCOPE)
+ if(include_dirs)
+ list(REMOVE_DUPLICATES include_dirs)
+ include_directories(${include_dirs})
+ endif()
endfunction()
# Function which adds source or header files to a component to be built
function(asterisk_scf_component_add_file COMPONENT)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one source file to this function")
- endif()
- message(STATUS "Adding ${ARGN} to component ${COMPONENT}")
- set(file_list ${${COMPONENT}_SOURCES})
- foreach(file ${ARGN})
- list(APPEND file_list ${CMAKE_CURRENT_SOURCE_DIR}/${file})
- endforeach()
- list(REMOVE_DUPLICATES file_list)
- set(${COMPONENT}_SOURCES ${file_list} PARENT_SCOPE)
+ if(NOT ARGN)
+ message(FATAL_ERROR "You must pass at least one source file to this function")
+ endif()
+ message(STATUS "Adding ${ARGN} to component ${COMPONENT}")
+ set(file_list ${${COMPONENT}_SOURCES})
+ foreach(file ${ARGN})
+ list(APPEND file_list ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+ endforeach()
+ list(REMOVE_DUPLICATES file_list)
+ set(${COMPONENT}_SOURCES ${file_list} PARENT_SCOPE)
endfunction()
# Function which adds Ice libraries needed by a component
function(asterisk_scf_component_add_ice_libraries COMPONENT)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one library to this function")
- endif()
- set(libs ${${COMPONENT}_ICE_LIBRARIES})
- foreach(lib ${ARGN})
- set(lang ${ASTERISK_SCF_${COMPONENT}_LANG})
- if(lang STREQUAL "Java")
- find_ICE_Java_library(${lib})
- elseif(lang STREQUAL "CSharp")
- find_ICE_CSharp_library(${lib})
- elseif(lang STREQUAL "CXX")
- find_ICE_CXX_library(${lib})
- endif()
- list(APPEND libs ${lib})
- endforeach()
- list(REMOVE_DUPLICATES libs)
- set(${COMPONENT}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
+ if(NOT ARGN)
+ message(FATAL_ERROR "You must pass at least one library to this function")
+ endif()
+ set(libs ${${COMPONENT}_ICE_LIBRARIES})
+ foreach(lib ${ARGN})
+ find_ICE_library(${lib})
+ list(APPEND libs ${lib})
+ endforeach()
+ list(REMOVE_DUPLICATES libs)
+ set(${COMPONENT}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
endfunction()
# Function which adds Boost libraries needed by a component
function(asterisk_scf_component_add_boost_libraries COMPONENT)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one library to this function")
- endif()
- set(libs ${${COMPONENT}_BOOST_LIBRARIES})
- # By default we are disabling boost auto-linking and specifying dynamic linking.
- add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK)
- foreach(lib ${ARGN})
- set(lang ${ASTERISK_SCF_${COMPONENT}_LANG})
- if(lang STREQUAL "CXX")
- else()
- message(FATAL_ERROR "Boost libraries cannot be used with components in the ${lang} language")
- endif()
- find_Boost_library(${lib})
- list(APPEND libs ${lib})
- endforeach()
- list(REMOVE_DUPLICATES libs)
- set(${COMPONENT}_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
- include_directories(${Boost_INCLUDE_DIR})
- link_directories(${Boost_LIBRARY_DIRS})
+ if(NOT ARGN)
+ message(FATAL_ERROR "You must pass at least one library to this function")
+ endif()
+ set(libs ${${COMPONENT}_BOOST_LIBRARIES})
+ # By default we are disabling boost auto-linking and specifying dynamic linking.
+ add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK)
+ foreach(lib ${ARGN})
+ find_Boost_library(${lib})
+ list(APPEND libs ${lib})
+ endforeach()
+ list(REMOVE_DUPLICATES libs)
+ set(${COMPONENT}_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
+ include_directories(${Boost_INCLUDE_DIR})
+ link_directories(${Boost_LIBRARY_DIRS})
endfunction()
# Function which builds a component as an IceBox service
function(asterisk_scf_component_build_icebox COMPONENT)
- set(lang ${ASTERISK_SCF_${COMPONENT}_LANG})
- message(STATUS "Building component ${COMPONENT} (${lang}) as IceBox service")
- if(lang STREQUAL "CXX")
- find_ICE_CXX_library(IceBox)
- elseif(lang STREQUAL "CSharp")
- find_ICE_CSharp_library(IceBox)
- elseif(lang STREQUAL "Java")
- find_ICE_Java_library(IceBox)
+ message(STATUS "Building component ${COMPONENT} as an IceBox service")
+ find_ICE_library(IceBox)
+ list(APPEND icelibs IceBox ${ASTERISK_SCF_ICE_LIBRARIES} ${${COMPONENT}_ICE_LIBRARIES})
+ list(REMOVE_DUPLICATES icelibs)
+ foreach(lib ${icelibs})
+ if(UNIX)
+ list(APPEND target_libs "${lib}")
else()
- message(FATAL_ERROR "IceBox services are not supported in the ${lang} language")
- endif()
- list(APPEND icelibs IceBox ${ASTERISK_SCF_ICE_LIBRARIES_${lang}} ${${COMPONENT}_ICE_LIBRARIES})
- list(REMOVE_DUPLICATES icelibs)
- foreach(lib ${icelibs})
- if(UNIX)
- list(APPEND target_libs "${lib}")
- else()
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- endif()
+ list(APPEND target_libs "${ICE_LIB_${lib}}")
+ endif()
+ endforeach()
+
+ # Now we actually create the library
+ # while one would think that MODULE would be the right setting, it
+ # has to be shared due to how icebox finds these libraries on a Mac
+ # (it loads .dylib instead of loading .so)
+ add_library(${COMPONENT} SHARED ${${COMPONENT}_SOURCES})
+ # Link required libraries and Slice libraries
+ list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
+ if(boostlibs)
+ list(REMOVE_DUPLICATES boostlibs)
+ foreach(lib ${boostlibs})
+ string(TOUPPER ${lib} libtag)
+ list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
endforeach()
-
- if(lang STREQUAL "CXX")
- # Now we actually create the library
- # while one would think that MODULE would be the right setting, it
- # has to be shared due to how icebox finds these libraries on a Mac
- # (it loads .dylib instead of loading .so)
- add_library(${COMPONENT} SHARED ${${COMPONENT}_SOURCES})
- # Link required libraries and Slice libraries
- list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
- if(boostlibs)
- list(REMOVE_DUPLICATES boostlibs)
- foreach(lib ${boostlibs})
- string(TOUPPER ${lib} libtag)
- list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
- endforeach()
- endif()
- if(UNIX)
- list(FIND target_libs Ice _Ice_FOUND)
- if(_Ice_FOUND GREATER -1)
- list(APPEND target_libs "IceUtil")
- list(APPEND target_libs "pthread")
- endif()
- endif()
- target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
- elseif(lang STREQUAL "CSharp")
- csharp_add_library(${COMPONENT} ${${COMPONENT}_SOURCES} REFERENCES ${${COMPONENT}_SLICES} ${target_libs})
- endif()
+ endif()
+ if(UNIX)
+ list(FIND target_libs Ice _Ice_FOUND)
+ if(_Ice_FOUND GREATER -1)
+ list(APPEND target_libs "IceUtil")
+ list(APPEND target_libs "pthread")
+ endif()
+ endif()
+ target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
endfunction()
# Function which builds a component standalone
function(asterisk_scf_component_build_standalone COMPONENT)
- set(lang ${ASTERISK_SCF_${COMPONENT}_LANG})
- message(STATUS "Building component ${COMPONENT} (${lang}) as standalone executable")
- list(APPEND icelibs ${ASTERISK_SCF_ICE_LIBRARIES_${lang}} ${${COMPONENT}_ICE_LIBRARIES})
- list(REMOVE_DUPLICATES icelibs)
- foreach(lib ${icelibs})
- if(UNIX)
- list(APPEND target_libs "${lib}")
- else()
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- endif()
+ message(STATUS "Building component ${COMPONENT} as a standalone executable")
+ list(APPEND icelibs ${ASTERISK_SCF_ICE_LIBRARIES} ${${COMPONENT}_ICE_LIBRARIES})
+ list(REMOVE_DUPLICATES icelibs)
+ foreach(lib ${icelibs})
+ if(UNIX)
+ list(APPEND target_libs "${lib}")
+ else()
+ list(APPEND target_libs "${ICE_LIB_${lib}}")
+ endif()
+ endforeach()
+
+ # Now we actually create the component
+ add_executable(${COMPONENT} ${${COMPONENT}_SOURCES})
+ # Link required libraries and Slice libraries
+ list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
+ if(boostlibs)
+ list(REMOVE_DUPLICATES boostlibs)
+ foreach(lib ${boostlibs})
+ string(TOUPPER ${lib} libtag)
+ list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
endforeach()
-
- if(lang STREQUAL "CXX")
- # Now we actually create the component
- add_executable(${COMPONENT} ${${COMPONENT}_SOURCES})
- # Link required libraries and Slice libraries
- list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
- if(boostlibs)
- list(REMOVE_DUPLICATES boostlibs)
- foreach(lib ${boostlibs})
- string(TOUPPER ${lib} libtag)
- list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
- endforeach()
- endif()
- if(UNIX)
- list(FIND target_libs Ice _Ice_FOUND)
- if(_Ice_FOUND GREATER -1)
- list(APPEND target_libs "IceUtil")
- list(APPEND target_libs "pthread")
- endif()
- endif()
- target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
- elseif(lang STREQUAL "CSharp")
- csharp_add_executable(${COMPONENT} ${${COMPONENT}_SOURCES} REFERENCES ${${COMPONENT}_SLICES} ${target_libs})
- endif()
+ endif()
+ if(UNIX)
+ list(FIND target_libs Ice _Ice_FOUND)
+ if(_Ice_FOUND GREATER -1)
+ list(APPEND target_libs "IceUtil")
+ list(APPEND target_libs "pthread")
+ endif()
+ endif()
+ target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
endfunction()
function(asterisk_scf_component_build_library COMPONENT)
- set(lang ${ASTERISK_SCF_${COMPONENT}_LANG})
- message(STATUS "Building component ${COMPONENT} (${lang}) as standalone executable")
- list(APPEND icelibs ${ASTERISK_SCF_ICE_LIBRARIES_${lang}} ${${COMPONENT}_ICE_LIBRARIES})
-
- list(LENGTH icelibs numicelibs)
- if(numicelibs GREATER 0)
- list(REMOVE_DUPLICATES icelibs)
- endif()
-
- foreach(lib ${icelibs})
- if(UNIX)
- list(APPEND target_libs "${lib}")
- else()
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- endif()
+ message(STATUS "Building component ${COMPONENT} as a library")
+ list(APPEND icelibs ${ASTERISK_SCF_ICE_LIBRARIES} ${${COMPONENT}_ICE_LIBRARIES})
+ list(LENGTH icelibs numicelibs)
+ if(numicelibs GREATER 0)
+ list(REMOVE_DUPLICATES icelibs)
+ endif()
+ foreach(lib ${icelibs})
+ if(UNIX)
+ list(APPEND target_libs "${lib}")
+ else()
+ list(APPEND target_libs "${ICE_LIB_${lib}}")
+ endif()
+ endforeach()
+
+ # Now we actually create the component
+ add_library(${COMPONENT} ${${COMPONENT}_SOURCES})
+ # Link required libraries and Slice libraries
+ list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
+ if(boostlibs)
+ list(REMOVE_DUPLICATES boostlibs)
+ foreach(lib ${boostlibs})
+ string(TOUPPER ${lib} libtag)
+ list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
endforeach()
-
- if(lang STREQUAL "CXX")
- # Now we actually create the component
- add_library(${COMPONENT} ${${COMPONENT}_SOURCES})
- # Link required libraries and Slice libraries
- list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
- if(boostlibs)
- list(REMOVE_DUPLICATES boostlibs)
- foreach(lib ${boostlibs})
- string(TOUPPER ${lib} libtag)
- list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
- endforeach()
- endif()
- target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
- elseif(lang STREQUAL "CSharp")
- csharp_add_library(${COMPONENT} ${${COMPONENT}_SOURCES} REFERENCES ${${COMPONENT}_SLICES} ${target_libs})
- endif()
+ endif()
+ target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
endfunction()
# Function which adds information for installing a component
function(asterisk_scf_component_install COMPONENTNAME TYPE DIR DESC GROUP)
- install(TARGETS ${COMPONENTNAME} ${TYPE} DESTINATION ${DIR} COMPONENT ${COMPONENTNAME} ${ARGN})
+ install(TARGETS ${COMPONENTNAME} ${TYPE} DESTINATION ${DIR} COMPONENT ${COMPONENTNAME} ${ARGN})
- if(ASTERISKSCF_CPACK)
- asterisk_scf_component_package(${COMPONENTNAME} ${DESC} ${GROUP})
- endif()
+ if(ASTERISKSCF_CPACK)
+ asterisk_scf_component_package(${COMPONENTNAME} ${DESC} ${GROUP})
+ endif()
endfunction()
# Adds a component to the packager. COMPONENTNAME must have been previously defined
# via the install command.
function(asterisk_scf_component_package COMPONENTNAME DESC GROUPNAME)
- cpack_add_component(${COMPONENTNAME} DESCRIPTION ${DESC} GROUP ${GROUP})
+ cpack_add_component(${COMPONENTNAME} DESCRIPTION ${DESC} GROUP ${GROUP})
endfunction()
# Adds a boost test executable to CTest. These executable will be run
# with 'make test' @param EXE - boost test executable. Probably built
# using asterisk_scf_component_build_standalone.
function(boost_add_test EXE)
- add_test(NAME ${EXE} COMMAND ${EXE}
- --report_sink=${CMAKE_BINARY_DIR}/${EXE}-result.xml
- --report_format=XML --report_level=detailed)
+ add_test(NAME ${EXE} COMMAND ${EXE}
+ --report_sink=${CMAKE_BINARY_DIR}/${EXE}-result.xml
+ --report_format=XML --report_level=detailed)
endfunction()
function(icebox_add_test NAME CONFIG)
- add_test(NAME ${NAME} COMMAND ${ICEBOX} --Ice.Config=${CONFIG})
+ add_test(NAME ${NAME} COMMAND ${ICEBOX} --Ice.Config=${CONFIG})
endfunction()
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 61943e5..63feb16 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -20,14 +20,11 @@ include(CPackConfig.txt)
#
include(../AsteriskSCF_v4.cmake)
-# Note that the only valid languages for the following functions are: CXX (for C++) and CSharp (for C#)
-
# This function takes a project name as an argument and sets the project up in CMake. In addition it does
-# dependency checking and compiler configuration for all languages used in the project, so they must be included
-# as arguments as well. Finally, the major/minor version of ICE used by the project must be included for
-# proper dependency checking.
+# dependency checking and compiler configuration. The major/minor version of ICE used by the project must
+# be included for proper dependency checking.
#
-asterisk_scf_project(example 3.4 CXX)
+asterisk_scf_project(example 3.4)
# The next function calls setup components to be built. The first one (examplebox) is built as an Icebox
# service while the second (example) is built as a standalone executable.
@@ -36,11 +33,10 @@ asterisk_scf_project(example 3.4 CXX)
# and source files in other) as long as the *must* statements are followed. Failure to do so may result in
# a partially broken built environment.
-# This function takes a component name and language. It initializes core data used for keeping
+# This function takes a component name. It initializes core data used for keeping
# track of component Slice definitions, sources, and other things for a component. It *must* be
-# called before executing any other Asterisk SCF component function. This function also does dependency
-# checking unique to the language specified.
-asterisk_scf_component_init(examplebox CXX)
+# called before executing any other Asterisk SCF component function.
+asterisk_scf_component_init(examplebox)
# If you have additional third party dependencies for your component the CMake logic to find them can be
# inserted here.
@@ -61,14 +57,17 @@ asterisk_scf_slice_compile_definitions(fluxcapacitor SERVER JOSH=LEET2)
# If a Slice definition uses any Ice-provided definitions (for example, IceBox or IceStorm), then for
# some languages it is necessary to reference the Ice-provided libraries containing those definitions
# when building the target. The names of the needed libraries can be provided using this function.
+# It is not necessary to specify that IceBox is required for IceBox services, as the
+# asterisk_scf_component_build_icebox() function will handle that automatically.
+# TODO: still needed?
asterisk_scf_slice_add_ice_libraries(fluxcapacitor IceStorm)
-# This function compiles a Slice definition (or more than one) into one or more libraries, one for each
-# language used in the project. It produces a target named the same as the Slice file without the extension,
-# which can be used in calls to asterisk_scf_slice_include_directories(), asterisk_scf_slice_compile_definitions(),
+# This function compiles a Slice definition (or more than one) into a library.
+# It produces a target named the same as the Slice file without the extension, which can be used in calls to
+# asterisk_scf_slice_include_directories(), asterisk_scf_slice_compile_definitions(),
# asterisk_scf_component_add_slice(), and asterisk_scf_slice_add_ice_libraries().
# Parameters to asterisk_scf_compile_slice:
-# - The target slice definition filename.
+# - The target Slice definition filename.
# - The subdirectory in which to install the output of the build. "lib" is good for most cases, but some
# optional components may choose to install elsewhere.
# - Description for use by the packager. This text typically appears when the user hovers over the component's name
@@ -85,13 +84,6 @@ asterisk_scf_component_add_slice(examplebox fluxcapacitor)
# compiled into the component. This *must* be called from the same directory that the source file exists in.
asterisk_scf_component_add_file(examplebox example.cpp)
-# If a component uses any Ice-provided definitions (for example, IceBox or IceStorm), then for
-# some languages it is necessary to reference the Ice-provided libraries containing those definitions
-# when building the component. The names of the needed libraries can be provided using this function.
-# It is not necessary to specify that IceBox is required for IceBox services, as the
-# asterisk_scf_component_build_icebox() function will handle that automatically.
-asterisk_scf_slice_add_ice_libraries(fluxcapacitor IceStorm)
-
# This function takes a component name as the parameter. It builds an IceBox service that IceBox can load.
asterisk_scf_component_build_icebox(examplebox)
@@ -108,7 +100,7 @@ asterisk_scf_component_build_icebox(examplebox)
asterisk_scf_component_install(examplebox LIBRARY lib "Icebox example component." Core)
# Now we move on to the next component, a standalone executable.
-asterisk_scf_component_init(example CXX)
+asterisk_scf_component_init(example)
asterisk_scf_component_add_slice(example fluxcapacitor)
asterisk_scf_component_add_file(example example.cpp)
diff --git a/modules/CMakeCSharpCompiler.cmake.in b/modules/CMakeCSharpCompiler.cmake.in
deleted file mode 100644
index 7d17148..0000000
--- a/modules/CMakeCSharpCompiler.cmake.in
+++ /dev/null
@@ -1,7 +0,0 @@
-set(CMAKE_CSharp_COMPILER "@CMAKE_CSharp_COMPILER@")
-set(CMAKE_CSharp_COMPILER_LOADED @CMAKE_CSharp_COMPILER_LOADED@)
-set(GAC_DIR @GAC_DIR@)
-
-set(_csc_default_lib_path @_csc_default_lib_path@ CACHE INTERNAL "")
-
-set(CMAKE_CSharp_COMPILER_ENV_VAR "CSC")
diff --git a/modules/CMakeCSharpInformation.cmake b/modules/CMakeCSharpInformation.cmake
deleted file mode 100644
index 7ef0e44..0000000
--- a/modules/CMakeCSharpInformation.cmake
+++ /dev/null
@@ -1,375 +0,0 @@
-# copyright (c) 2007, 2009 Arno Rehn arno at arnorehn.de
-# copyright (c) 2008 Helio castro helio at kde.org
-#
-# Redistribution and use is allowed according to the terms of the GPL license.
-
-# This file adds support for the C# language to cmake.
-#
-# It adds the following functions:
-#
-# csharp_add_executable (<name> <source files> [UNSAFE] [WINEXE] [REFERENCES <references>]
-# [COMPILE_FLAGS <flags to be passed to the compiler>]
-# [COMPILE_DEFINITIONS <additional definitions>] )
-#
-# csharp_add_library (<name> <source files> [UNSAFE] [REFERENCES <references>]
-# [COMPILE_FLAGS <flags to be passed to the compiler>]
-# [COMPILE_DEFINITIONS <additional definitions>] )
-#
-# install_assembly (<target name> DESTINATION <assembly destination directory>
-# [PACKAGE <package name>] )
-# The assembly destination directory is only used if we compile with Visual C# and thus can't use gacutil.
-# If a package is specified and a file called <target>.pc.cmake exists in the current source directory,
-# this function will configure the template file. All occurences of @assembly@ will be replaced with
-# the path to the assembly. The resulting <target>.pc file will be installed to
-# <CMAKE_INSTALL_PREFIX>/lib/pkgconfig/ . If you want to have a different basename for the template file,
-# set the 'pkg-config_template_basename' property of the target with set_property.
-#
-# Example:
-# ------------------------------
-# cmake code:
-# ------------------------------
-# csharp_add_library(foo foo.cs)
-# install_assembly(foo DESTINATION lib)
-#
-# ------------------------------
-# contents of foo.pc.cmake file:
-# ------------------------------
-# Name: Foo
-# Description: Foo library
-# Version: 1.0
-# Libs: -r:@assembly@
-
-# ----- support macros -----
-macro(GET_LIBRARY_OUTPUT_DIR var)
- if (NOT LIBRARY_OUTPUT_PATH)
- set(${var} ${CMAKE_CURRENT_BINARY_DIR})
- else (NOT LIBRARY_OUTPUT_PATH)
- set(${var} ${LIBRARY_OUTPUT_PATH})
- endif (NOT LIBRARY_OUTPUT_PATH)
-endmacro(GET_LIBRARY_OUTPUT_DIR)
-
-macro(GET_EXECUTABLE_OUTPUT_DIR var)
- if (NOT EXECUTABLE_OUTPUT_PATH)
- set(${var} ${CMAKE_CURRENT_BINARY_DIR})
- else (NOT EXECUTABLE_OUTPUT_PATH)
- set(${var} ${EXECUTABLE_OUTPUT_PATH})
- endif (NOT EXECUTABLE_OUTPUT_PATH)
-endmacro(GET_EXECUTABLE_OUTPUT_DIR)
-
-# This does just not always work... why?!
-# macro(MAKE_PROPER_FILE_LIST var)
-# foreach(file ${ARGN})
-# if (IS_ABSOLUTE "${file}")
-# file(GLOB globbed "${file}")
-# else (IS_ABSOLUTE "${file}")
-# file(GLOB globbed "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
-# endif (IS_ABSOLUTE "${file}")
-#
-# foreach (glob ${globbed})
-# file(TO_NATIVE_PATH "${glob}" native)
-# list(APPEND proper_file_list "${native}")
-# endforeach (glob ${globbed})
-# endforeach(file ${ARGN})
-# endmacro(MAKE_PROPER_FILE_LIST)
-
-# ----- actual functions -----
-
-function(csharp_add_target_reference target ref)
- get_property(prop TARGET ${ref} PROPERTY _assembly)
- if(NOT prop)
- message(FATAL_ERROR "Cannot use ${ref} as a reference for ${target}, it is not a CSharp library")
- endif()
- set(work ${references})
- list(APPEND work "/r:${prop}")
- set(references ${work} PARENT_SCOPE)
- set(work ${deps})
- list(APPEND work ${ref})
- set(deps ${work} PARENT_SCOPE)
- set(work ${deptargets})
- list(APPEND work ${ref})
- set(deptargets ${work} PARENT_SCOPE)
-endfunction()
-
-function(csharp_add_path_reference target path)
- file(TO_NATIVE_PATH ${path} native_path)
- set(work ${references})
- list(APPEND work "/r:${native_path}")
- set(references ${work} PARENT_SCOPE)
- set(work ${deppaths})
- list(APPEND work "${path}")
- set(deppaths ${work} PARENT_SCOPE)
-endfunction()
-
-# ----- add a reference for an executable or library -----
-macro(csharp_add_reference target ref)
- if(TARGET ${ref})
- csharp_add_target_reference(${target} ${ref})
- # handle transitive references to targets
- get_property(dt TARGET ${ref} PROPERTY _deptargets)
- if(dt)
- foreach(dep ${dt})
- csharp_add_target_reference(${target} ${dep})
- endforeach()
- endif()
- # handle transitive references to native paths
- get_property(dp TARGET ${ref} PROPERTY _deppaths)
- if(dp)
- foreach(dep ${dp})
- csharp_add_path_reference(${target} "${dep}")
- endforeach()
- endif()
- else()
- file(TO_CMAKE_PATH ${arg} cmake_path)
- csharp_add_path_reference(${target} "${cmake_path}")
- endif()
-endmacro()
-
-# ----- add an executable -----
-function(csharp_add_executable target)
- set(current "s")
- set(dotnet_target "exe")
-
- foreach (arg ${ARGN})
- if (arg STREQUAL "UNSAFE")
- set (unsafe "/unsafe")
- elseif (arg STREQUAL "WINEXE")
- set (dotnet_target "winexe")
- elseif (arg STREQUAL "REFERENCES")
- set (current "r")
- elseif (arg STREQUAL "COMPILE_FLAGS")
- set (current "flags")
- elseif (arg STREQUAL "COMPILE_DEFINITIONS")
- set (current "defs")
- else ()
- if (current STREQUAL "s")
- # source file
- file(TO_NATIVE_PATH ${arg} native_path)
- list(APPEND sources "${native_path}")
- elseif (current STREQUAL "r")
- # reference
- csharp_add_reference(${target} ${arg})
- elseif (current STREQUAL "flags")
- list(APPEND _csc_opts "${arg}")
- elseif (current STREQUAL "defs")
- list(APPEND _csc_opts "/define:${arg}")
- endif (current STREQUAL "s")
- endif (arg STREQUAL "UNSAFE")
- endforeach (arg ${ARGN})
-
- if (CMAKE_BUILD_TYPE STREQUAL "Debug")
- list(APPEND _csc_opts "/define:DEBUG")
- list(APPEND _csc_opts "/debug")
- endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
-
- get_executable_output_dir(outdir)
- if (NOT IS_ABSOLUTE "${outdir}")
- message(FATAL_ERROR "Directory \"${outdir}\" is not an absolute path!")
- endif (NOT IS_ABSOLUTE "${outdir}")
-
- file(RELATIVE_PATH relative_path "${CMAKE_BINARY_DIR}" "${outdir}/${target}.exe")
- file(TO_NATIVE_PATH "${outdir}/${target}" native_target)
-
- # inlined - this doesn't work as a macro :(
- foreach(file ${sources})
- file(TO_CMAKE_PATH "${file}" cmake_file)
-
- if (IS_ABSOLUTE "${cmake_file}")
- file(GLOB globbed "${cmake_file}")
- else (IS_ABSOLUTE "${cmake_file}")
- file(GLOB globbed "${CMAKE_CURRENT_SOURCE_DIR}/${cmake_file}")
- endif (IS_ABSOLUTE "${cmake_file}")
-
- if(globbed)
- foreach (glob ${globbed})
- file(TO_CMAKE_PATH "${glob}" cmake_path)
- if(glob MATCHES "\\.cs$")
- list(APPEND cmake_file_list "${cmake_path}")
- list(APPEND compiler_file_list "${glob}")
- endif(glob MATCHES "\\.cs$")
- list(APPEND source_list "${cmake_path}")
- endforeach (glob ${globbed})
- else(globbed)
- if(cmake_file MATCHES "\\.cs$")
- list(APPEND cmake_file_list "${cmake_file}")
- list(APPEND compiler_file_list "${file}")
- endif(cmake_file MATCHES "\\.cs$")
- list(APPEND source_list "${cmake_file}")
- endif(globbed)
- endforeach(file ${sources})
-
- get_directory_property(compile_definitions COMPILE_DEFINITIONS)
- foreach (def ${compile_definitions})
- # macros with values aren't supported by C#
- if (NOT def MATCHES ".*=.*")
- list(APPEND _csc_opts "/define:${def}")
- endif (NOT def MATCHES ".*=.*")
- endforeach (def ${compile_definitions})
-
- get_directory_property(link_dirs LINK_DIRECTORIES)
- foreach (dir ${link_dirs})
- list(APPEND _csc_opts "/lib:${dir}")
- endforeach (dir ${link_dirs})
-
- add_custom_command(OUTPUT "${outdir}/${target}.stubexe"
- COMMAND "${CMAKE_COMMAND}" -E make_directory "${outdir}" # create the output dir
- COMMAND "${CMAKE_CSharp_COMPILER}" /nologo /target:${dotnet_target} "/out:${native_target}.exe" # build the executable
- ${_csc_opts} ${unsafe} ${references} ${compiler_file_list}
- COMMAND "${CMAKE_COMMAND}" -E touch "${outdir}/${target}.stubexe" # create the stub so that DEPENDS will work
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" # working directory is the source directory, so we don't have to care about relative paths
- DEPENDS ${cmake_file_list}
- COMMENT "Building ${relative_path}" VERBATIM) # nice comment
- add_custom_target(${target} ALL DEPENDS "${outdir}/${target}.stubexe" SOURCES ${source_list}) # create the actual target
- if (deps)
- add_dependencies(${target} ${deps})
- endif(deps)
-endfunction(csharp_add_executable)
-
-# ----- add a library -----
-function(csharp_add_library target)
- set(current "s")
-
- foreach (arg ${ARGN})
- if (arg STREQUAL "UNSAFE")
- set (unsafe "/unsafe")
- elseif (arg STREQUAL "REFERENCES")
- set (current "r")
- elseif (arg STREQUAL "COMPILE_FLAGS")
- set (current "flags")
- elseif (arg STREQUAL "COMPILE_DEFINITIONS")
- set (current "defs")
- else ()
- if (current STREQUAL "s")
- # source file
- file(TO_NATIVE_PATH ${arg} native_path)
- list(APPEND sources "${native_path}")
- elseif (current STREQUAL "r")
- # reference
- csharp_add_reference(${target} ${arg})
- elseif (current STREQUAL "flags")
- list(APPEND _csc_opts "${arg}")
- elseif (current STREQUAL "defs")
- list(APPEND _csc_opts "/define:${arg}")
- endif ()
- endif (arg STREQUAL "UNSAFE")
- endforeach (arg ${ARGN})
-
- if (CMAKE_BUILD_TYPE STREQUAL "Debug")
- list(APPEND _csc_opts "/define:DEBUG")
- list(APPEND _csc_opts "/debug")
- endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
-
- get_library_output_dir(outdir)
- if (NOT IS_ABSOLUTE "${outdir}")
- message(FATAL_ERROR "Directory \"${outdir}\" is not an absolute path!")
- endif (NOT IS_ABSOLUTE "${outdir}")
-
- file(RELATIVE_PATH relative_path "${CMAKE_BINARY_DIR}" "${outdir}/${target}.dll")
- file(TO_NATIVE_PATH "${outdir}/${target}" native_target)
-
- # inlined - this doesn't work as a macro :(
- foreach(file ${sources})
- file(TO_CMAKE_PATH "${file}" cmake_file)
-
- if (IS_ABSOLUTE "${cmake_file}")
- file(GLOB globbed "${cmake_file}")
- else (IS_ABSOLUTE "${cmake_file}")
- file(GLOB globbed "${CMAKE_CURRENT_SOURCE_DIR}/${cmake_file}")
- endif (IS_ABSOLUTE "${cmake_file}")
-
- if(globbed)
- foreach (glob ${globbed})
... 237 lines suppressed ...
--
asterisk-scf/release/cmake.git
More information about the asterisk-scf-commits
mailing list