[asterisk-scf-commits] asterisk-scf/integration/cmake.git branch "c++0x" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Nov 29 16:56:03 CST 2010
branch "c++0x" has been created
at 83a93acc047457469342e1a6b63fa2fd69c903d2 (commit)
- Log -----------------------------------------------------------------
commit 83a93acc047457469342e1a6b63fa2fd69c903d2
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Nov 29 18:52:50 2010 -0400
Enable C++0x support on GCC versions where it is supported.
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 641ec29..0d3455c 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -55,6 +55,22 @@ 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.")
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/modules/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")
+ 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
@@ -304,7 +320,7 @@ function(asterisk_scf_project NAME ICE_VERSION)
elseif(l STREQUAL "CXX")
message(STATUS "Performing requirement checks for CXX components")
if(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall")
+ set(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall -std=c++0x -isystem ${ICE_DIR}/include")
endif()
find_ICE_CXX()
find_ICE_CXX_library(Ice)
@@ -740,8 +756,12 @@ function(asterisk_scf_component_add_file COMPONENT)
set(file_list ${${COMPONENT}_SOURCES})
foreach(file ${ARGN})
list(APPEND file_list ${CMAKE_CURRENT_SOURCE_DIR}/${file})
- if(ASTERISK_SCF_${COMPONENT}_LANG STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL Debug)
- set_source_files_properties(${file} COMPILE_FLAGS "-Wall -Werror")
+ if(ASTERISK_SCF_${COMPONENT}_LANG STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX)
+ if(CMAKE_BUILD_TYPE STREQUAL Debug)
+ set_source_files_properties(${file} COMPILE_FLAGS "-Wall -Werror -std=c++0x -isystem ${ICE_DIR}/include")
+ else()
+ set_source_files_properties(${file} COMPILE_FLAGS "-std=c++0x -isystem ${ICE_DIR}/include")
+ endif()
endif()
endforeach()
list(REMOVE_DUPLICATES file_list)
diff --git a/modules/SharedPtr.cpp b/modules/SharedPtr.cpp
new file mode 100644
index 0000000..eb7339f
--- /dev/null
+++ b/modules/SharedPtr.cpp
@@ -0,0 +1,7 @@
+#include <memory>
+
+int main()
+{
+ std::shared_ptr<void> bob;
+ return 0;
+}
commit 81af25d5567e8b542f7068ad9d94affba8a72fe7
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Thu Nov 18 11:54:00 2010 -0600
Update prproject support for pjproject-1.8.5.
The 1.8.5 release of pjproject includes some build system changes
that affect our usage of it; it is now necessary to specify the
'build' subdirectory when requesting that a specific component
be built via the DIRS variable. Since we are now building against
pjproject from our own repository, we can be sure it will be at
least version 1.8.5, so this commit changes pjproject.cmake to
work properly with the new version.
diff --git a/modules/pjproject.cmake b/modules/pjproject.cmake
index f2f5139..ee481d0 100644
--- a/modules/pjproject.cmake
+++ b/modules/pjproject.cmake
@@ -39,7 +39,7 @@ function(pjproject_build PJPROJECT_COMPONENT)
if(${PJPROJECT_COMPONENT} STREQUAL "third_party")
add_custom_target("pjproject-third_party" COMMAND "make" "TARGET_NAME=asteriskscf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject/third_party/build" COMMENT "Building pjproject third party components")
else()
- add_custom_target("pjproject-${PJPROJECT_COMPONENT}" COMMAND "make" "TARGET_NAME=asteriskscf" "DIRS=${PJPROJECT_COMPONENT}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Building pjproject-${PJPROJECT_COMPONENT}" DEPENDS "${CMAKE_SOURCE_DIR}/pjproject/pjlib/include/pj/config_site.h")
+ add_custom_target("pjproject-${PJPROJECT_COMPONENT}" COMMAND "make" "TARGET_NAME=asteriskscf" "DIRS=${PJPROJECT_COMPONENT}/build" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Building pjproject-${PJPROJECT_COMPONENT}" DEPENDS "${CMAKE_SOURCE_DIR}/pjproject/pjlib/include/pj/config_site.h")
add_dependencies("pjproject-${PJPROJECT_COMPONENT}" "pjproject-pjlib")
endif()
if(${PJPROJECT_COMPONENT} STREQUAL "pjsip")
commit c6c5985079c75e76a68d1d9b8626d11bcf087ae4
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Nov 18 09:44:11 2010 -0400
Disable support for non-integrated builds. The gitall script must be used.
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 8ebd878..641ec29 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -50,6 +50,11 @@ if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
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.")
+endif()
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
# If a build type has not been explicitly specified then use debug
commit 9f66775b5f7c8b37cc1862774a77c33049a7a74e
Author: David M. Lee <dlee at digium.com>
Date: Mon Nov 15 14:03:38 2010 -0600
Updated indentation to match the style guide.
diff --git a/example/example.cpp b/example/example.cpp
index d46f92e..557cc39 100644
--- a/example/example.cpp
+++ b/example/example.cpp
@@ -8,43 +8,43 @@ namespace TimeMachine
{
namespace DeLorean
{
- /**
- * Private class that implements the Singleton for model data.
- */
- class BackInTimeImpl : public BackInTime
- {
- virtual bool Jump(::Ice::Int day, ::Ice::Int month, ::Ice::Int year, ::Ice::Float speed, const Ice::Current &)
- {
- if (speed >= 88)
- {
+/**
+ * Private class that implements the Singleton for model data.
+ */
+class BackInTimeImpl : public BackInTime
+{
+ virtual bool Jump(::Ice::Int day, ::Ice::Int month, ::Ice::Int year, ::Ice::Float speed, const Ice::Current &)
+ {
+ if (speed >= 88)
+ {
return true;
- }
- return false;
- }
- };
+ }
+ return false;
+ }
+};
}
}
int main(int argc, char* argv[])
{
- BackInTimePtr ptr = new BackInTimeImpl();
-
- if (argc < 2)
- {
- cout << "Usage: example <speed>" << endl;
- exit(0);
- }
-
- float speed = (float)atof(argv[1]);
- if (ptr->Jump(10, 7, 1955, speed))
- {
- cout << "Congrats! You are BACK in time!" << endl;
- }
- else
- {
- cout << "Sorry. Speed must be at least 88 MPH." << endl;
- }
+ BackInTimePtr ptr = new BackInTimeImpl();
+
+ if (argc < 2)
+ {
+ cout << "Usage: example <speed>" << endl;
+ exit(0);
+ }
+
+ float speed = (float)atof(argv[1]);
+ if (ptr->Jump(10, 7, 1955, speed))
+ {
+ cout << "Congrats! You are BACK in time!" << endl;
+ }
+ else
+ {
+ cout << "Sorry. Speed must be at least 88 MPH." << endl;
+ }
}
commit 7395eabe3b4e9e99fa368617b173e0360e932b92
Author: David M. Lee <dlee at digium.com>
Date: Thu Nov 11 14:38:11 2010 -0600
Enabling proper threading support for Solaris.
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index ac459b7..8ebd878 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -59,6 +59,14 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()
+# threading support required
+find_package(Threads REQUIRED)
+
+if(CMAKE_SYSTEM MATCHES "SunOS.*")
+ set(CMAKE_CXX_FLAGS "-pthreads ")
+endif()
+
+
if(WIN32)
message(WARNING "Profile builds not supported")
else()
commit bbbe7ebd7d1916aeacd5db79c5e5f3af35c8377e
Author: David M. Lee <dlee at digium.com>
Date: Thu Nov 11 10:34:10 2010 -0600
In my prior 'fix', I actually broke how we linked to Boost.
I was wrong in assuming that specifying libs by full path was a bad
thing. It actually wasn't the cause of the linker errors we were
seeing on Solaris.
Revert "Fixed solaris build: specify boost libs using -l"
This reverts commit 5d28e94e0f3e7f7b1a73b8c4922083d4ece5d46d.
Conflicts:
AsteriskSCF.cmake
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 01c1baa..ac459b7 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -811,15 +811,8 @@ function(asterisk_scf_component_build_icebox COMPONENT)
if(boostlibs)
list(REMOVE_DUPLICATES boostlibs)
foreach(lib ${boostlibs})
- if(UNIX)
- if(NOT "core" STREQUAL "${lib}")
- list(APPEND target_libs "boost_${lib}")
- endif()
- link_directories(${Boost_LIBRARY_DIRS})
- else()
- string(TOUPPER ${lib} libtag)
- list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
- endif()
+ string(TOUPPER ${lib} libtag)
+ list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
endforeach()
endif()
if(UNIX)
@@ -857,15 +850,8 @@ function(asterisk_scf_component_build_standalone COMPONENT)
if(boostlibs)
list(REMOVE_DUPLICATES boostlibs)
foreach(lib ${boostlibs})
- if(UNIX)
- if(NOT "core" STREQUAL "${lib}")
- list(APPEND target_libs "boost_${lib}")
- endif()
- link_directories(${Boost_LIBRARY_DIRS})
- else()
- string(TOUPPER ${lib} libtag)
- list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
- endif()
+ string(TOUPPER ${lib} libtag)
+ list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
endforeach()
endif()
if(UNIX)
@@ -907,15 +893,8 @@ function(asterisk_scf_component_build_library COMPONENT)
if(boostlibs)
list(REMOVE_DUPLICATES boostlibs)
foreach(lib ${boostlibs})
- if(UNIX)
- if(NOT "core" STREQUAL "${lib}")
- list(APPEND target_libs "boost_${lib}")
- endif()
- link_directories(${Boost_LIBRARY_DIRS})
- else()
- string(TOUPPER ${lib} libtag)
- list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
- endif()
+ string(TOUPPER ${lib} libtag)
+ list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
endforeach()
endif()
target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
commit 6a530d70135a207183ad66df86e6ee058dc0b616
Author: David M. Lee <dlee at unknown.(none)>
Date: Thu Nov 11 16:24:31 2010 -0600
Fixed init-cmake.sh for older versions of Bash.
Solaris ships with bash 3.0, which doesn't support the += operator
for arrays.
diff --git a/init-cmake.sh b/init-cmake.sh
index f9b20e8..9cd72c9 100755
--- a/init-cmake.sh
+++ b/init-cmake.sh
@@ -40,7 +40,7 @@ srcdir=..
function add_cmake_args()
{
- cmake_args+=("$@")
+ cmake_args=("${cmake_args[@]}" "$@")
}
case $(uname -s)-$(uname -m) in
commit 38e99693843879defe62de7b922b60e940f02efa
Author: David M. Lee <dlee at digium.com>
Date: Tue Nov 9 08:56:37 2010 -0600
Documented the environment variables used to configure CMake.
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 0ca01b7..01c1baa 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -17,6 +17,22 @@
# Asterisk SCF component build infrastructure
#
+# Environment variables (in addition to the normal CMake variables):
+# * 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
+# module has problems finding the proper Boost
+# installation
+# * 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
+# this if the module has problems finding the proper Ice
+# installation
+#
+
+#
# Coding/style guidelines:
#
# * Variables local to a function should be named using lowercase.
commit 4eeb74a93bcdcef40603266719ae6d3645c5e3fd
Author: David M. Lee <dlee at digium.com>
Date: Fri Nov 5 13:26:38 2010 -0500
Fixed logic for adding Ice to lib search path.
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 2b277b4..0ca01b7 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -180,14 +180,17 @@ function(find_ICE_CXX_library LIBRARY)
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})
- get_filename_component(library_path ${ICE_CXX_LIB_${LIBRARY}} PATH)
- link_directories(${library_path})
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
commit 3b77216c1ef9de3e43feb92e65f9313f2602db30
Author: David M. Lee <dlee at digium.com>
Date: Fri Nov 5 13:16:01 2010 -0500
Removed redundant Copyright statement.
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 9d86659..2b277b4 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -17,8 +17,6 @@
# Asterisk SCF component build infrastructure
#
-# Copyright (C) 2010 - Digium, Inc.
-#
# Coding/style guidelines:
#
# * Variables local to a function should be named using lowercase.
commit efdcbf7711c72753a3cc90ad568760d163ffa097
Author: David M. Lee <dlee at digium.com>
Date: Wed Nov 3 15:17:35 2010 -0500
Changes spacing to 4 spaces, as per style guide.
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index b9df95a..9d86659 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -33,57 +33,57 @@
#
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()
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."
- FORCE)
+ set(CMAKE_BUILD_TYPE Debug CACHE STRING
+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
+ FORCE)
endif()
if(WIN32)
- message(WARNING "Profile builds not supported")
+ message(WARNING "Profile builds not supported")
else()
- 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,
@@ -92,307 +92,307 @@ 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()
+ 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()
+ 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()
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})
- get_filename_component(library_path ${ICE_CXX_LIB_${LIBRARY}} PATH)
- link_directories(${library_path})
- 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(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})
+ get_filename_component(library_path ${ICE_CXX_LIB_${LIBRARY}} PATH)
+ link_directories(${library_path})
+ 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()
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")
+ 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()
- 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")
+ 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()
- endif()
endfunction()
# Find a Boost library for CXX components
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)
- 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})
+ 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)
if(NOT Boost_${libtag}_FOUND)
- message(FATAL_ERROR "Failed to find Boost library ${LIBRARY}")
+ find_package(Boost COMPONENTS ${LIBRARY})
+ if(NOT Boost_${libtag}_FOUND)
+ message(FATAL_ERROR "Failed to find Boost library ${LIBRARY}")
+ endif()
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
- # block will ensure it contains the correct value.
- 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")
- if(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall")
- endif()
- 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")
+ 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
+ # block will ensure it contains the correct value.
+ if(WIN32)
+ message(STATUS "Setting ASTERISK_SCF_ICEBOX_EXPORT definition for Windows IceBox services")
+ add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=__declspec\(dllexport\))
else()
- message(FATAL_ERROR "Unsupported component language ${l}")
+ 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()
- endforeach()
+ 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")
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall")
+ endif()
+ 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()
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})
+ 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()
- list(REMOVE_DUPLICATES libs)
- set(ASTERISK_SCF_ICE_LIBRARIES_${lang} ${libs} PARENT_SCOPE)
- endforeach()
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})
- 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})
+ 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()
+ 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(APPEND libs ${lib})
- endforeach()
- list(REMOVE_DUPLICATES libs)
- set(${TARGET}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
+ 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})
+ 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()
- endforeach()
endfunction()
# Function which compiles one or more Slice definition files;
@@ -420,517 +420,517 @@ endfunction()
# 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()
- 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 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}")
+ 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()
- # 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()
- 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()
-
- 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}")
- # Remove the first item, since it is a Makefile target name, not a dependency
- list(REMOVE_AT raw_dependencies 0)
-
- foreach(dep ${raw_dependencies})
- # 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()
- endforeach()
+ set(slice_files "${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_IN}")
+ get_filename_component(file "${TARGET_IN}" NAME_WE)
+ set(TARGET "${file}")
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()
+ # 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()
+ endforeach()
+ else()
+ if(input MATCHES "\\.ice$")
+ list(APPEND slice_files "${input}")
+ endif()
+ endif()
+ endforeach()
+ endif()
- set_source_files_properties(${generated_files} PROPERTIES GENERATED 1)
+ # This makes the Slice definitions display in their own folder in the IDE,
+ # specifically Visual Studio
+ source_group("Slice Definitions" REGULAR_EXPRESSION "\\.ice$")
- # 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}")
+ # 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 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()
+ endforeach()
- 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}
- )
+ # 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)
- if(target_CXX_includes)
- list(REMOVE_DUPLICATES target_CXX_includes)
- endif()
+ 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()
- 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})
- add_library(${TARGET}_${lang} ${generated_files} ${slice_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)
- endforeach()
+ 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}")
+ # Remove the first item, since it is a Makefile target name, not a dependency
+ list(REMOVE_AT raw_dependencies 0)
+
+ foreach(dep ${raw_dependencies})
+ # 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()
+ 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})
+ add_library(${TARGET}_${lang} ${generated_files} ${slice_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)
+ endforeach()
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)
+ message(STATUS "Setting up to build component ${COMPONENT}")
+ set(ASTERISK_SCF_${COMPONENT}_LANG ${LANG} 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}_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()
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})
- if(ASTERISK_SCF_${COMPONENT}_LANG STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL Debug)
- set_source_files_properties(${file} COMPILE_FLAGS "-Wall -Werror")
- endif()
- 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})
+ if(ASTERISK_SCF_${COMPONENT}_LANG STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL Debug)
+ set_source_files_properties(${file} COMPILE_FLAGS "-Wall -Werror")
+ endif()
+ 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})
+ 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)
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})
- 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})
+ 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})
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)
- 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}")
+ 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)
else()
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- endif()
- 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})
- if(UNIX)
- if(NOT "core" STREQUAL "${lib}")
- list(APPEND target_libs "boost_${lib}")
- endif()
- link_directories(${Boost_LIBRARY_DIRS})
- else()
- string(TOUPPER ${lib} libtag)
- list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
- endif()
- 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()
+ 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()
+ 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})
+ if(UNIX)
+ if(NOT "core" STREQUAL "${lib}")
+ list(APPEND target_libs "boost_${lib}")
+ endif()
+ link_directories(${Boost_LIBRARY_DIRS})
+ else()
+ string(TOUPPER ${lib} libtag)
+ list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
+ endif()
+ 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()
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()
- 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})
- if(UNIX)
- if(NOT "core" STREQUAL "${lib}")
- list(APPEND target_libs "boost_${lib}")
- endif()
- link_directories(${Boost_LIBRARY_DIRS})
- else()
- string(TOUPPER ${lib} libtag)
- list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
- endif()
- 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()
+ 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()
+ 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})
+ if(UNIX)
+ if(NOT "core" STREQUAL "${lib}")
+ list(APPEND target_libs "boost_${lib}")
+ endif()
+ link_directories(${Boost_LIBRARY_DIRS})
+ else()
+ string(TOUPPER ${lib} libtag)
+ list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
+ endif()
+ 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()
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()
- 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})
- if(UNIX)
- if(NOT "core" STREQUAL "${lib}")
- list(APPEND target_libs "boost_${lib}")
- endif()
- link_directories(${Boost_LIBRARY_DIRS})
- else()
- string(TOUPPER ${lib} libtag)
- list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
- endif()
- 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()
+ 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()
+ 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})
+ if(UNIX)
+ if(NOT "core" STREQUAL "${lib}")
+ list(APPEND target_libs "boost_${lib}")
+ endif()
+ link_directories(${Boost_LIBRARY_DIRS})
+ else()
+ string(TOUPPER ${lib} libtag)
+ list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
+ endif()
+ 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()
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})
... 15340 lines suppressed ...
--
asterisk-scf/integration/cmake.git
More information about the asterisk-scf-commits
mailing list