[asterisk-scf-commits] asterisk-scf/release/cmake.git branch "v.next" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Sep 14 16:26:25 CDT 2010
branch "v.next" has been created
at 364040aa2e2252eb07d896dc98eee1d2362f56e9 (commit)
- Log -----------------------------------------------------------------
commit 364040aa2e2252eb07d896dc98eee1d2362f56e9
Author: David M. Lee <dlee at digium.com>
Date: Tue Sep 14 15:03:12 2010 -0500
Major clean-up. Removed unused revisions of files. Got Hydra out of
file name.
diff --git a/Hydra_v4.cmake b/AsteriskSCF.cmake
old mode 100755
new mode 100644
similarity index 100%
rename from Hydra_v4.cmake
rename to AsteriskSCF.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100755
index 6cee85c..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2010 -- Digium, Inc.
-#
-# All rights reserved.
-#
-
-cmake_minimum_required(VERSION 2.6)
-
-include(CPackConfig.cmake)
-include(cmake/Hydra_v3.cmake)
-
-hydra_project(techdemo 3.4 CXX CSharp)
-
-message(">>> CMake Generator:" ${CMAKE_GENERATOR})
-
-add_subdirectory(slice)
-add_subdirectory(eventview)
-add_subdirectory(channelsvc)
-add_subdirectory(routingsvc)
-add_subdirectory(bridgesvc)
-add_subdirectory(mediasvc)
-add_subdirectory(configtool)
-add_subdirectory(statustool)
-add_subdirectory(mockphone)
-add_subdirectory(channelsvc-csharp)
-add_subdirectory(bridgesvc-csharp)
diff --git a/Hydra.cmake b/Hydra.cmake
deleted file mode 100644
index 7677437..0000000
--- a/Hydra.cmake
+++ /dev/null
@@ -1,330 +0,0 @@
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
-
-# Common Hydra Component build infrastructure
-
-# If a build type has not been explicitly specified then use release
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release CACHE STRING
- "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
- FORCE)
-endif()
-
-# Function which initializes project specific things
-function(hydra_project NAME)
- message(STATUS "Setting up project ${NAME}")
- project(${NAME})
-endfunction()
-
-# Function which initializes a component for building
-function(hydra_component_init COMPONENT LANGUAGE)
- message(STATUS "Setting up to build component ${COMPONENT}")
-
- enable_language(${LANGUAGE})
-
- set(HYDRA_${COMPONENT}_SOURCES "" CACHE INTERNAL Bob FORCE)
- set(HYDRA_${COMPONENT}_SLICES "" CACHE INTERNAL Bob FORCE)
- set(HYDRA_${COMPONENT}_COMPILED_SLICES "" CACHE INTERNAL Bob FORCE)
- set(HYDRA_${COMPONENT}_SLICE_TARGETS "" CACHE INTERNAL Bob FORCE)
- set(HYDRA_${COMPONENT}_INCLUDE_DIRECTORIES "" CACHE INTERNAL Bob FORCE)
- set(HYDRA_${COMPONENT}_LANGUAGE ${LANGUAGE} CACHE INTERNAL Bob FORCE)
-
- # Perform dependency checking based on the language the component is written in
- if(LANGUAGE STREQUAL "java")
- message(STATUS "Performing dependency check for Java language")
- elseif(LANGUAGE STREQUAL "CSharp")
- message(STATUS "Performing dependency check for C# language")
- elseif(LANGUAGE STREQUAL "CXX")
- message(STATUS "Performing dependency check for C++ language")
-
- # First thing required is Boost, we use it for additional Hydra core functions
- set(BOOST_ROOT $ENV{BOOST_HOME})
- find_package(Boost REQUIRED)
- message(STATUS "Found Boost version ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
-
- # Next we look for the header files for ICE
- find_path(HYDRA_ICE_INCLUDE_DIR Ice/Ice.h
- # The following line is for the latest
- ${HYDRA_ICE_HOME}/include
- c:/Ice-3.3.1-VC90/include
- $ENV{ICE_HOME}/include
- )
-
- if(HYDRA_ICE_INCLUDE_DIR)
- message(STATUS "Found ICE header files in ${HYDRA_ICE_INCLUDE_DIR}")
- else()
- message(FATAL_ERROR "Failed to find ICE header files")
- endif()
-
- # Next we look for the location of the ICE libraries themselves
- find_library(ICE_LIB ICE
- ${HYDRA_ICE_HOME}/lib
- c:/ICe-3.3.1-VC90/lib
- $ENV{ICE_HOME}/lib
- )
- get_filename_component(HYDRA_ICE_LIB_DIR ${ICE_LIB} PATH)
-
- if(HYDRA_ICE_LIB_DIR)
- message(STATUS "Found ICE library files in ${HYDRA_ICE_LIB_DIR}")
- else(HYDRA_ICE_LIB_DIR)
- message(FATAL_ERROR "Failed to find ICE libraries")
- endif(HYDRA_ICE_LIB_DIR)
-
- link_directories(${HYDRA_ICE_LIB_DIR})
- message(STATUS "Passed dependency check for C++ language")
- else()
- message(FATAL_ERROR "Unsupported component language ${LANGUAGE}")
- endif()
-endfunction()
-
-# Insures that a list of paths are all absolute paths.
-# Assumes relative paths are relative to Current Source Dir.
-# Replaces the list passed in with one where all paths converted to abs paths.
-macro(insure_abs_paths pathlist)
- set(temp "")
- foreach (p ${${pathlist}})
- set(newpath ${p})
- if (NOT IS_ABSOLUTE ${p})
- # Lazy conversion for now...
- set (newpath "${CMAKE_CURRENT_SOURCE_DIR}/${p}")
- endif()
- set (temp ${temp} ${newpath})
- endforeach(p)
- set(${pathlist} ${temp})
-endmacro()
-
-# Function which remembers include directories needed for a particular slice definition
-function(hydra_slice_add_include_dirs SLICE_DEFINITION)
- set(DEFAULT_ARGS 1)
- set(SLICE_PATHS "")
- if (ARGC GREATER ${DEFAULT_ARGS})
- set(i ${DEFAULT_ARGS})
- while (i LESS ${ARGC}+1)
- set(ARGNAME "ARGV${i}")
- set(SLICE_PATHS ${SLICE_PATHS} ${${ARGNAME}})
- math(EXPR i ${i}+1)
- endwhile ()
- endif ()
- insure_abs_paths(SLICE_PATHS)
- set(HYDRA_INCLUDE_DIRS_${SLICE_DEFINITION} ${SLICE_PATHS} CACHE INTERNAL Bob)
- message(STATUS "Remembering include directories for ${SLICE_DEFINITION}")
-endfunction()
-
-# Function which remembers definitions needed for a particular slice definition
-function(hydra_slice_add_definitions SLICE_DEFINITION)
- set(DEFAULT_ARGS 1)
- set(SLICE_DEFS "")
- if (ARGC GREATER ${DEFAULT_ARGS})
- set(i ${DEFAULT_ARGS})
- while (i LESS ${ARGC}+1)
- set(ARGNAME "ARGV${i}")
- set(SLICE_DEFS ${SLICE_DEFS} ${${ARGNAME}})
- math(EXPR i ${i}+1)
- endwhile ()
- endif ()
- set(HYDRA_DEFINITIONS_${SLICE_DEFINITION} ${SLICE_DEFS} CACHE INTERNAL Bob)
- message(STATUS "Remembering definitions for ${SLICE_DEFINITION}")
-endfunction()
-
-# Function which creates a custom command to compile a slice definition
-function(hydra_compile_slice LANGUAGE SLICE_DEFINITION)
- # If we've already processed this file for this language, exit now
- if(DEFINED HYDRA_${SLICE_DEFINITION}_${LANGUAGE})
- return()
- endif()
- # Depending on the language we need to find the right compiler and use the right suffixes
- if(LANGUAGE STREQUAL "java")
- message(STATUS "Going to compile slice definition ${SLICE_DEFINITION} into Java")
- elseif(LANGUAGE STREQUAL "CSharp")
- message(STATUS "Going to compile slice definition ${SLICE_DEFINITION} into C#")
- set(SLICE_COMPILER_BINARY slice2cs)
- set(SLICE_SUFFIXES cs)
- elseif(LANGUAGE STREQUAL "CXX")
- message(STATUS "Going to compile slice definition ${SLICE_DEFINITION} into C++")
- set(SLICE_COMPILER_BINARY slice2cpp)
- set(SLICE_SUFFIXES h cpp)
- else()
- message(FATAL_ERROR "Unsupported slice compiled language ${LANGUAGE}")
- endif()
-
- # Any additional arguments to this function (beyond the named args), if any,
- # are assumed to be additional slice source paths
- # Next we find the actual Slice compiler
- find_program(SLICE_COMPILER_${LANGUAGE} ${SLICE_COMPILER_BINARY}
- ${HYDRA_ICE_HOME}/bin
- c:/Ice-3.3.1-VC90/bin
- $ENV{ICE_HOME}/bin
- )
-
- # If we fail to find it we have to abort here, we can go no further
- if(SLICE_COMPILER_${LANGUAGE})
- message(STATUS "Found Slice compiler at ${SLICE_COMPILER_${LANGUAGE}}")
- else()
- message(FATAL_ERROR "Failed to find location for Slice compiler ${SLICE_COMPILER_BINARY}")
- endif()
-
- # Look for ICE provided slice definitions
- find_path(HYDRA_ICE_SLICE_DIR Ice/Current.ice
- /usr/share/slice
- /usr/local/share/slice
- ${HYDRA_ICE_HOME}/slice
- c:/ICe-3.3.1-VC90/slice
- $ENV{ICE_HOME}/slice
- )
-
- if(HYDRA_ICE_SLICE_DIR)
- message(STATUS "Found ICE provided slice definitions in ${HYDRA_ICE_SLICE_DIR}")
- set(SLICE_COMPILER_ARGUMENTS ${SLICE_COMPILER_ARGUMENTS} -I${HYDRA_ICE_SLICE_DIR})
- else()
- message(STATUS "Failed to find ICE provided slice definitions, this may or may not end up being fatal")
- endif()
-
- # Append any additional include directories stored for this Slice definition
- foreach(SLICEPATH ${HYDRA_INCLUDE_DIRS_${SLICE_DEFINITION}})
- set(SLICE_COMPILER_ARGUMENTS ${SLICE_COMPILER_ARGUMENTS} -I${SLICEPATH})
- endforeach(SLICEPATH)
-
- # Append any definitions stored for this Slice definition
- foreach(SLICEDEF ${HYDRA_DEFINITIONS_${SLICE_DEFINITION}})
- set(SLICE_COMPILER_ARGUMENTS ${SLICE_COMPILER_ARGUMENTS} -D${SLICEDEF})
- endforeach(SLICEDEF)
-
- # Add a custom command which runs the slice compiler when the slice definition needs to be compiled
- foreach(SLICE_SUFFIX ${SLICE_SUFFIXES})
- # Replace the .ice extension with the suffix we are currently doing
- string(REGEX REPLACE "\\.ice" ".${SLICE_SUFFIX}" SLICE_GENERATED_FILE "${SLICE_DEFINITION}")
- # Add a custom command to use the slice compiler for the file
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SLICE_GENERATED_FILE}
- COMMAND ${SLICE_COMPILER_${LANGUAGE}} ${SLICE_COMPILER_ARGUMENTS} ${CMAKE_CURRENT_SOURCE_DIR}/${SLICE_DEFINITION}
- COMMENT "Compiling ${SLICE_DEFINITION} using ${SLICE_COMPILER_BINARY}"
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${SLICE_DEFINITION}
- )
- set(SLICE_GENERATED_TARGET ${SLICE_GENERATED_FILE}_)
- add_custom_target(${SLICE_GENERATED_TARGET} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SLICE_GENERATED_FILE})
- endforeach(SLICE_SUFFIX ${HYDRA_SLICE_SUFFIXES})
- # remember that this file has been processed for this language
- set(HYDRA_${SLICE_DEFINITION}_${LANGUAGE} Bob CACHE INTERNAL Bob)
-endfunction()
-
-# Function which adds the compiled slice definitions to a component to be built
-function(hydra_component_add_slice COMPONENT SLICE_DEFINITION)
- # Depending on the language we need to use the right suffixes
- if(${HYDRA_${COMPONENT}_LANGUAGE} STREQUAL "java")
- set(SLICE_SUFFIXES class)
- elseif(${HYDRA_${COMPONENT}_LANGUAGE} STREQUAL "CSharp")
- set(SLICE_SUFFIXES cs)
- elseif(${HYDRA_${COMPONENT}_LANGUAGE} STREQUAL "CXX")
- set(SLICE_SUFFIXES h cpp)
- else()
- message(FATAL_ERROR "Unsupported slice compiled language ${HYDRA_${COMPONENT}_LANGUAGE}")
- endif()
-
- message(STATUS "Adding slice definition ${SLICE_DEFINITION} to component ${COMPONENT}")
-
- hydra_compile_slice(${HYDRA_${COMPONENT}_LANGUAGE} ${SLICE_DEFINITION})
-
- # Go through each suffix and add it to the sources for the component
- foreach(SLICE_SUFFIX ${SLICE_SUFFIXES})
- string(REGEX REPLACE "\\.ice" ".${SLICE_SUFFIX}" SLICE_GENERATED_FILE "${SLICE_DEFINITION}")
- set(HYDRA_${COMPONENT}_SOURCES ${HYDRA_${COMPONENT}_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${SLICE_GENERATED_FILE} CACHE INTERNAL Bob)
- set(HYDRA_${COMPONENT}_COMPILED_SLICES ${HYDRA_${COMPONENT}_COMPILED_SLICES} ${CMAKE_CURRENT_BINARY_DIR}/${SLICE_GENERATED_FILE} CACHE INTERNAL Bob)
- set(SLICE_GENERATED_TARGET ${SLICE_GENERATED_FILE}_)
- set(HYDRA_${COMPONENT}_SLICE_TARGETS ${HYDRA_${COMPONENT}_SLICE_TARGETS} ${SLICE_GENERATED_TARGET} CACHE INTERNAL Bob)
- endforeach()
-
- # Add the current binary directory so we can get to the headers
- set(HYDRA_${COMPONENT}_INCLUDE_DIRECTORIES ${HYDRA_${COMPONENT}_INCLUDE_DIRECTORIES} ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL Bob)
- set(HYDRA_${COMPONENT}_SOURCES ${HYDRA_${COMPONENT}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/${SLICE_DEFINITION} CACHE INTERNAL Bob)
- set(HYDRA_${COMPONENT}_SLICES ${HYDRA_${COMPONENT}_SLICES} ${CMAKE_CURRENT_SOURCE_DIR}/${SLICE_DEFINITION} CACHE INTERNAL Bob)
-endfunction()
-
-# Function which adds a source or header file to a component to be built
-function(hydra_component_add_file COMPONENT FILE)
- message(STATUS "Adding file ${FILE} to component ${COMPONENT}")
- set(HYDRA_${COMPONENT}_SOURCES ${HYDRA_${COMPONENT}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} CACHE INTERNAL Bob)
-endfunction()
-
-# Function which prepares a component for building
-function(hydra_component_build_prep COMPONENT)
- # Tell cmake that the compiled slice files will be generated
- foreach(COMPILED_SLICE ${HYDRA_${COMPONENT}_COMPILED_SLICES})
- set_source_files_properties(${COMPILED_SLICE} PROPERTIES GENERATED 1)
- endforeach()
-
- # This makes the slice definitions display in their own folder in the IDE, specifically MSVC
- source_group("Slice Definitions" FILES ${HYDRA_${COMPONENT}_SLICES})
-
- # Now we have to set where header files may be
- set(BOOST_ROOT $ENV{BOOST_HOME})
- include_directories(${HYDRA_${COMPONENT}_INCLUDE_DIRECTORIES} ${HYDRA_ICE_INCLUDE_DIR} ${BOOST_ROOT})
-endfunction()
-
-macro(windows_lib_adjust LIBLIST)
- set(libtemp "")
- foreach(libname ${${LIBLIST}})
- set(libtemp ${libtemp} debug ${libname}d optimized ${libname})
- endforeach()
- set(${LIBLIST} ${libtemp})
-endmacro()
-
-# Function which builds a component as an Icebox service
-function(hydra_component_build_icebox COMPONENT)
- # Give some console output that this is being built as an Icebox service
- message(STATUS "Building component ${COMPONENT} as Icebox service")
-
- if(WIN32)
- set_target_properties(${COMPONENT} PROPERTIES OUTPUT_NAME_DEBUG ${COMPONENT}d OUTPUT_NAME_RELEASE ${COMPONENT})
- endif()
-
- # Add the slice target dependencies so they get correctly built
- add_dependencies(${COMPONENT} ${HYDRA_${COMPONENT}_SLICE_TARGETS})
-
- # Finally link it against the dependencies that are needed (such as ICE)
- set(liblist Ice IceBox IceUtil)
-
- if (WIN32)
- windows_lib_adjust(liblist)
- endif()
-
- if(${HYDRA_${COMPONENT}_LANGUAGE} STREQUAL "CXX")
- # If this is being done on Windows we need to set HYDRA_ICEBOX_EXPORT to the right thing
- if(WIN32)
- message(STATUS "Setting HYDRA_ICEBOX_EXPORT definition since building on Windows")
- add_definitions(-DHYDRA_ICEBOX_EXPORT=__declspec\(dllexport\))
- else()
- add_definitions(-DHYDRA_ICEBOX_EXPORT=)
- endif()
-
- # Now we actually create the library
- add_library(${COMPONENT} MODULE ${HYDRA_${COMPONENT}_SOURCES})
-
- message(STATUS "Linking component ${COMPONENT} against ${liblist}")
- target_link_libraries(${COMPONENT} ${liblist})
- endif()
-endfunction()
-
-# Function which builds a component standalone
-function(hydra_component_build_standalone COMPONENT)
- message(STATUS "Building component ${COMPONENT} as standalone executable")
-
- # Create an executable with the source files provided
- add_executable(${COMPONENT} ${HYDRA_${COMPONENT}_SOURCES})
-
- # Add any target dependencies (for slice definitions) that may be needed
- add_dependencies(${COMPONENT} ${HYDRA_${COMPONENT}_SLICE_TARGETS})
-
- # And link it against what we need
- set(liblist Ice IceUtil)
-
- if (WIN32)
- windows_lib_adjust(liblist)
- endif()
-
- message(STATUS "Linking component ${COMPONENT} against ${liblist}")
- target_link_libraries(${COMPONENT} ${liblist})
-endfunction()
-
-# Function which adds information for installing
-function(hydra_component_install COMPONENT)
- install(TARGETS ${COMPONENT} DESTINATION Hydra/)
-endfunction()
diff --git a/Hydra_v2.cmake b/Hydra_v2.cmake
deleted file mode 100644
index 6acda41..0000000
--- a/Hydra_v2.cmake
+++ /dev/null
@@ -1,478 +0,0 @@
-# Common Hydra Component build infrastructure
-
-if(CMAKE_BINARY_DIR STREQUAL ${CMAKE_SOURCE_DIR})
- message(FATAL_ERROR "This project must not be built in the source directory")
-endif()
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
-
-# If a build type has not been explicitly specified then use release
-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)
-endif()
-
-find_package(PkgConfig)
-
-if(UNIX AND EXISTS "${CMAKE_SOURCE_DIR}/.svn")
- add_custom_target(update COMMAND svn update WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMENT "Updating checkout")
-endif()
-
-macro(windows_lib_adjust LIBLIST)
- set(libtemp "")
- foreach(libname ${${LIBLIST}})
- set(libtemp ${libtemp} debug ${libname}d optimized ${libname})
- endforeach()
- set(${LIBLIST} ${libtemp})
-endmacro()
-
-macro(set_cache_var)
- set(${ARGV} CACHE INTERNAL Bob FORCE)
-endmacro()
-
-# 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 ${HYDRA_ICE_HOME}/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()
-endfunction()
-
-function(find_ICE_CSharp)
- if(NOT PKG_CONFIG_FOUND)
- message(FATAL_ERROR "pkg-config was not found, so CSharp components cannot be built")
- endif()
- pkg_check_modules(ICE_CSharp Ice-${HYDRA_ICE_VERSION})
- if(NOT ICE_CSharp_FOUND)
- message(FATAL_ERROR "ICE for CSharp was not found, so CSharp components cannot be built")
- endif()
- set_cache_var(CSharp_ICE_LIB ${ICE_CSharp_LDFLAGS})
- message(STATUS "Found ICE for CSharp at ${CSharp_ICE_LIB}")
-endfunction()
-
-function(find_ICEBox_CSharp)
- if(NOT PKG_CONFIG_FOUND)
- message(FATAL_ERROR "pkg-config was not found, so CSharp components cannot be built")
- endif()
- pkg_check_modules(ICEBox_CSharp IceBox-${HYDRA_ICE_VERSION})
- if(NOT ICEBox_CSharp_FOUND)
- message(FATAL_ERROR "ICEBox for CSharp was not found, so CSharp services cannot be built")
- endif()
- set_cache_var(CSharp_ICEBox_LIB ${ICEBox_CSharp_LDFLAGS})
- message(STATUS "Found ICEBox for CSharp at ${CSharp_ICEBox_LIB}")
-endfunction()
-
-# Find ICE headers and libraries for CXX components
-function(find_ICE_CXX)
- # Look for the header files for ICE
- find_path(CXX_ICE_INCLUDE_DIR Ice/Ice.h
- # The following line is for the latest
- ${HYDRA_ICE_HOME}/include
- c:/Ice-3.3.1-VC90/include
- $ENV{ICE_HOME}/include
- /opt/Ice-3.3.1/include
- /opt/Ice-3.4b/include
- )
-
- if(CXX_ICE_INCLUDE_DIR)
- message(STATUS "Found ICE for C++ in ${CXX_ICE_INCLUDE_DIR}")
- else()
- message(FATAL_ERROR "Failed to find ICE header files")
- endif()
-
- # Next we look for the location of the ICE libraries themselves
- find_library(ICE_LIB Ice
- ${HYDRA_ICE_HOME}/lib
- c:/Ice-3.3.1-VC90/lib
- $ENV{ICE_HOME}/lib
- /opt/Ice-3.3.1/lib
- /opt/Ice-3.4b/lib
- /opt/Ice-3.3.1/lib64
- /opt/Ice-3.4b/lib64
- )
- get_filename_component(ICE_LIB_DIR ${ICE_LIB} PATH)
-
- if(ICE_LIB_DIR)
- message(STATUS "Found ICE for C++ in ${ICE_LIB_DIR}")
- set_cache_var(CXX_ICE_LIB_DIR ${ICE_LIB_DIR})
- else()
- message(FATAL_ERROR "Failed to find ICE libraries")
- endif()
-endfunction()
-
-# Function which initializes project specific things
-function(hydra_project NAME ICE_VERSION LANG1)
- message(STATUS "Setting up project ${NAME}")
- set_cache_var(HYDRA_PROJECT_LANGUAGES ${LANG1} ${ARGN})
- set_cache_var(HYDRA_ICE_VERSION ${ICE_VERSION})
- project(${NAME} ${HYDRA_PROJECT_LANGUAGES})
- if(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall")
- endif()
- # On Windows, IceBox C++ services must be compiled with some symbols exported;
- # the source code should use HYDRA_ICEBOX_EXPORT to accomplish this, and this
- # block will ensure it contains the correct value.
- if(WIN32)
- message(STATUS "Setting HYDRA_ICEBOX_EXPORT definition since building on Windows")
- add_definitions(-DHYDRA_ICEBOX_EXPORT=__declspec\(dllexport\))
- else()
- add_definitions(-DHYDRA_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()
- foreach(l ${HYDRA_PROJECT_LANGUAGES})
- # Perform dependency checking based on the language the component is written in
- if(l STREQUAL "Java")
- message(STATUS "Performing dependency checks for Java components")
- find_ICE_Java_library(Ice)
- message(STATUS "Passed requirement checks for Java components"`)
- elseif(l STREQUAL "CSharp")
- message(STATUS "Performing dependency checks for CSharp components")
- find_ICE_CSharp()
- message(STATUS "Passed dependency checks for CSharp components")
- elseif(l STREQUAL "CXX")
- message(STATUS "Performing dependency checks for C++ components")
- # Find Boost libraries
- set(BOOST_ROOT $ENV{BOOST_HOME})
- find_package(Boost REQUIRED)
- find_ICE_CXX()
- include_directories(${Boost_INCLUDE_DIR})
- include_directories(${CXX_ICE_INCLUDE_DIR})
- link_directories(${CXX_ICE_LIB_DIR})
- link_directories(${Boost_LIBRARY_DIRS})
- message(STATUS "Passed dependency checks for C++ components")
- else()
- message(FATAL_ERROR "Unsupported component language ${LANG}")
- endif()
- endforeach()
-endfunction()
-
-# Function which initializes a component for building
-function(hydra_component_init COMPONENT LANG)
- message(STATUS "Setting up to build component ${COMPONENT}")
- set_cache_var(HYDRA_${COMPONENT}_SOURCES "")
- set_cache_var(HYDRA_${COMPONENT}_SLICES "")
- set_cache_var(HYDRA_${COMPONENT}_COMPILED_SLICES "")
- set_cache_var(HYDRA_${COMPONENT}_SLICE_TARGETS "")
- set_cache_var(HYDRA_${COMPONENT}_LANG ${LANG})
-endfunction()
-
-# Ensures that a list of paths are all absolute paths.
-macro(ensure_abs_paths pathlist)
- foreach(p ${${pathlist}})
- get_filename_component(newpath ${p} ABSOLUTE)
- set(temp ${temp} ${newpath})
- endforeach()
- set(${pathlist} ${temp})
-endmacro()
-
-# Function which remembers include directories needed for a particular slice definition
-function(hydra_slice_include_directories SLICE_FILE)
- get_filename_component(SLICE ${SLICE_FILE} NAME_WE)
- set(pathlist ${ARGN})
- ensure_abs_paths(pathlist)
- set_cache_var(SLICE_INCLUDE_DIRECTORIES_${SLICE} ${pathlist})
- message(STATUS "Remembering include directories for ${SLICE} as ${pathlist}")
-endfunction()
-
-# Function which remembers definitions needed for a particular slice definition
-function(hydra_slice_compile_definitions SLICE_FILE)
- get_filename_component(SLICE ${SLICE_FILE} NAME_WE)
- set_cache_var(SLICE_COMPILE_DEFINITIONS_${SLICE} ${ARGN})
- message(STATUS "Remembering definitions for ${SLICE}")
-endfunction()
-
-# Function which compiles one or more Slice definition files;
-# the file(s) are compiled for all languages in use in the project
-#
-# Syntax:
-# hydra_compile_slice(<target> [SOURCES source1 ... sourceN])
-#
-# Notes:
-# If only a target name is provided, the function produces
-# targets named using that name compiled from a Slice file
-# with that name and the '.ice' extension.
-#
-# If SOURCES are provided, the function produces targets named
-# using the provided garget name, but builds them from the listed
-# source files. It is not necessary to include the '.ice' extension
-# in the source file names, although it is accepted if provided.
-#
-# sets these variables (where SLICE is the target name computed
-# as above and LANG is each language used in the project):
-#
-# HYDRA_SLICE_${SLICE}_${LANG}
-# marker indicating this Slice has been built for the language
-# HYDRA_SLICE_${SLICE}_CXX_INCLUDE_DIR
-# directory where generated header file for this Slice lives
-# (only for C++)
-function(hydra_compile_slice TARGET_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 hydra_compile_slice")
- endif()
- else()
- get_filename_component(file ${arg} NAME_WE)
- set(SLICE_FILES ${SLICE_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/${file}.ice)
- endif()
- endforeach()
- set(TARGET ${TARGET_IN})
- else()
- get_filename_component(file ${TARGET_IN} NAME_WE)
- set(SLICE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file}.ice)
- set(TARGET ${file})
- endif()
- foreach(LANG ${HYDRA_PROJECT_LANGUAGES})
- unset(GENERATED_FILES)
- unset(SLICE_COMPILER_ARGUMENTS)
- unset(SLICE_TARGET_DEPENDENCIES)
- unset(SLICE_DEPENDENCIES_INCLUDE_DIRS)
- if(LANG STREQUAL "Java")
- message(STATUS "Compiling Slice definition ${TARGET} into Java classes")
- set(SLICE_COMPILER_BINARY slice2java)
- set(SLICE_SUFFIXES java)
- elseif(LANG STREQUAL "CSharp")
- message(STATUS "Compiling Slice definition ${TARGET} into a CSharp assembly")
- set(SLICE_COMPILER_BINARY slice2cs)
- set(SLICE_SUFFIXES cs)
- elseif(LANG STREQUAL "CXX")
- message(STATUS "Compiling Slice definition ${TARGET} into a C++ library")
- set(SLICE_COMPILER_BINARY slice2cpp)
- set(SLICE_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} ${SLICE_COMPILER_BINARY}
- ${HYDRA_ICE_HOME}/bin
- c:/Ice-3.3.1-VC90/bin
- $ENV{ICE_HOME}/bin
- /opt/Ice-3.3.1/bin
- /opt/Ice-3.4b/bin
- )
-
- # 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 at ${SLICE_COMPILER_${LANG}}")
- else()
- message(FATAL_ERROR "Failed to find Slice compiler ${SLICE_COMPILER_BINARY}")
- endif()
- endif()
-
- if(NOT ICE_SLICE_DIR)
- # Look for ICE provided slice definitions
- find_path(ICE_SLICE_DIR Ice/Current.ice
- /usr/share/slice
- /usr/local/share/slice
- ${HYDRA_ICE_HOME}/slice
- c:/ICe-3.3.1-VC90/slice
- $ENV{ICE_HOME}/slice
- /opt/Ice-3.3.1/slice
- /opt/Ice-3.4b/slice
- )
-
- if(ICE_SLICE_DIR)
- message(STATUS "Found ICE provided Slice definitions in ${ICE_SLICE_DIR}")
- else()
- message(STATUS "ICE provided Slice definitions not found")
- endif()
- endif()
-
- include_directories(${ICE_SLICE_DIR})
- set(SLICE_COMPILER_ARGUMENTS ${SLICE_COMPILER_ARGUMENTS} -I${ICE_SLICE_DIR})
-
- # Append any additional include directories stored for this target
- foreach(SLICEPATH ${SLICE_INCLUDE_DIRECTORIES_${TARGET}})
- set(SLICE_COMPILER_ARGUMENTS ${SLICE_COMPILER_ARGUMENTS} -I${SLICEPATH})
- endforeach()
-
- # Append any definitions stored for this target
- foreach(SLICEDEF ${SLICE_COMPILE_DEFINITIONS_${TARGET}})
- set(SLICE_COMPILER_ARGUMENTS ${SLICE_COMPILER_ARGUMENTS} -D${SLICEDEF})
- endforeach()
-
- foreach(file ${SLICE_FILES})
- foreach(suffix ${SLICE_SUFFIXES})
- get_filename_component(source ${file} NAME_WE)
- set(GENERATED_FILES ${GENERATED_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${source}.${suffix})
- endforeach()
- endforeach()
-
- # This makes the slice definitions display in their own folder in the IDE, specifically MSVC
- source_group("Slice Definitions" REGULAR_EXPRESSION "\\.ice$")
-
- # 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 definition ${TARGET}")
- execute_process(ERROR_QUIET COMMAND ${SLICE_COMPILER_${LANG}} ${SLICE_COMPILER_ARGUMENTS} --depend ${SLICE_FILES} OUTPUT_VARIABLE SLICE_DEPENDENCIES)
-
- if(SLICE_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 new lines
- string(REPLACE "\n" "" SLICE_DEPENDENCIES ${SLICE_DEPENDENCIES})
- # Get rid of all the \ characters
- string(REPLACE "\\" "" SLICE_DEPENDENCIES ${SLICE_DEPENDENCIES})
- # Make all of the double spaces ';' so that we can call foreach on it
- string(REPLACE " " ";" SLICE_DEPENDENCIES ${SLICE_DEPENDENCIES})
-
- foreach(SLICE_DEPENDENCY ${SLICE_DEPENDENCIES})
- # Convert the path into a cmake one so we can absolutely get the filename
- file(TO_CMAKE_PATH ${SLICE_DEPENDENCY} SLICE_DEPENDENCY)
- # Get the filename (without extension) as this will be our target
- get_filename_component(SLICE_DEPENDENCY ${SLICE_DEPENDENCY} NAME_WE)
- # If this is not already us add it as a dependency
- if (NOT ${SLICE_DEPENDENCY} STREQUAL ${TARGET})
- message(STATUS "Adding dependency on slice definition ${SLICE_DEPENDENCY} to ${TARGET} for ${LANG} language")
- set(SLICE_TARGET_DEPENDENCIES ${SLICE_TARGET_DEPENDENCIES} ${SLICE_DEPENDENCY}_${LANG})
- if(LANG STREQUAL "CXX")
- set(SLICE_DEPENDENCIES_INCLUDE_DIRS ${SLICE_DEPENDENCIES_INCLUDE_DIRS} ${HYDRA_SLICE_${SLICE_DEPENDENCY}_CXX_INCLUDE_DIR})
- endif()
- endif()
- endforeach()
- endif()
-
- add_custom_command(
- OUTPUT ${GENERATED_FILES}
- COMMAND ${SLICE_COMPILER_${LANG}} ${SLICE_COMPILER_ARGUMENTS} ${SLICE_FILES}
- COMMENT "Compiling ${TARGET} using ${SLICE_COMPILER_BINARY}"
- DEPENDS ${SLICE_FILES} ${SLICE_TARGET_DEPENDENCIES}
- )
-
- set_source_files_properties(${GENERATED_FILES} PROPERTIES GENERATED 1)
-
- 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
- csharp_add_library(${TARGET}_${LANG} ${GENERATED_FILES} ${SLICE_FILES} COMPILE_FLAGS ${CSharp_ICE_LIB})
- 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
- add_library(${TARGET}_${LANG} STATIC ${GENERATED_FILES} ${SLICE_FILES})
- set_target_properties(${TARGET}_${LANG} PROPERTIES OUTPUT_NAME ${TARGET})
- target_link_libraries(${TARGET}_${LANG} ${SLICE_TARGET_DEPENDENCIES})
- if(UNIX)
- set_target_properties(${TARGET}_${LANG} PROPERTIES COMPILE_FLAGS "-fPIC")
- endif()
- set_cache_var(HYDRA_SLICE_${TARGET}_CXX_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR} ${SLICE_DEPENDENCIES_INCLUDE_DIRS})
- endif()
- set_cache_var(HYDRA_SLICE_${TARGET}_${LANG} Bob)
-
- endforeach()
-endfunction()
-
-# Function which adds the compiled slice definitions to a component to be built
-function(hydra_component_add_slice COMPONENT SLICE)
- if(NOT HYDRA_${COMPONENT}_LANG)
- message(FATAL_ERROR "Must call hydra_component_init for component ${COMPONENT} before hydra_component_add_slice")
- endif()
- if(NOT HYDRA_SLICE_${SLICE}_${HYDRA_${COMPONENT}_LANG})
- message(FATAL_ERROR "Must call hydra_compile_slice for ${SLICE} before hydra_component_add_slice")
- endif()
- get_filename_component(f ${SLICE} NAME_WE)
- message(STATUS "Adding Slice ${f} to component ${COMPONENT}")
- set_cache_var(HYDRA_${COMPONENT}_SLICES ${HYDRA_${COMPONENT}_SLICES} ${f}_${HYDRA_${COMPONENT}_LANG})
- if(HYDRA_${COMPONENT}_LANG STREQUAL "CXX")
- include_directories(${HYDRA_SLICE_${SLICE}_CXX_INCLUDE_DIR})
- endif()
-endfunction()
-
-# Function which adds a dependency for a slice definition
-function(hydra_slice_add_dependencies TARGET)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one dependency to this function")
- endif()
- foreach(LANG ${HYDRA_PROJECT_LANGUAGES})
- foreach(DEPEND ${ARGN})
- message(STATUS "Adding dependency on slice definition ${DEPEND} to ${TARGET} for ${LANG} language")
- add_dependencies(${TARGET}_${LANG} ${DEPEND}_${LANG})
- endforeach()
- endforeach()
-endfunction()
-
-# Function which adds a source or header file to a component to be built
-function(hydra_component_add_file COMPONENT FILE)
- message(STATUS "Adding file ${FILE} to component ${COMPONENT}")
- set_cache_var(HYDRA_${COMPONENT}_SOURCES ${HYDRA_${COMPONENT}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
- if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL Debug)
- set_source_files_properties(${FILE} COMPILE_FLAGS "-Wall -Werror")
- endif()
-endfunction()
-
-# Function which prepares a component for building
-function(hydra_component_build_prep COMPONENT)
- #TODO: why is this needed?
- #foreach(COMPILED_SLICE ${HYDRA_${COMPONENT}_COMPILED_SLICES})
- # set_source_files_properties(${COMPILED_SLICE} PROPERTIES GENERATED 1)
- #endforeach()
-endfunction()
-
-# Function which builds a component as an Icebox service
-function(hydra_component_build_icebox COMPONENT)
- # Give some console output that this is being built as an Icebox service
- message(STATUS "Building component ${COMPONENT} as Icebox service")
-
- if(HYDRA_${COMPONENT}_LANG STREQUAL "CXX")
- # Link it against the dependencies that are needed
- set(liblist Ice IceBox IceUtil IceStorm)
-
- if(WIN32)
- windows_lib_adjust(liblist)
- endif()
-
- # Now we actually create the library
- add_library(${COMPONENT} MODULE ${HYDRA_${COMPONENT}_SOURCES})
-
- # Link required libraries and Slice libraries
- target_link_libraries(${COMPONENT} ${liblist} ${HYDRA_${COMPONENT}_SLICES})
- elseif(HYDRA_${COMPONENT}_LANG STREQUAL "CSharp")
- if(NOT CSharp_ICEBox_LIB)
- find_ICEBox_CSharp()
- endif()
- csharp_add_library(${COMPONENT} ${HYDRA_${COMPONENT}_SOURCES} REFERENCES ${HYDRA_${COMPONENT}_SLICES} COMPILE_FLAGS ${CSharp_ICEBox_LIB})
- endif()
-endfunction()
-
-# Function which builds a component standalone
-function(hydra_component_build_standalone COMPONENT)
- message(STATUS "Building component ${COMPONENT} as standalone executable")
-
- if(HYDRA_${COMPONENT}_LANG STREQUAL "CXX")
- # Link it against the dependencies that are needed
- set(liblist Ice IceUtil IceStorm IceGrid Glacier2)
-
- if(WIN32)
- windows_lib_adjust(liblist)
- endif()
-
- # Now we actually create the library
- add_executable(${COMPONENT} ${HYDRA_${COMPONENT}_SOURCES})
-
- # Link required libraries and Slice libraries
- target_link_libraries(${COMPONENT} ${liblist} ${HYDRA_${COMPONENT}_SLICES})
- elseif(HYDRA_${COMPONENT}_LANG STREQUAL "CSharp")
- csharp_add_executable(${COMPONENT} ${HYDRA_${COMPONENT}_SOURCES} REFERENCES ${HYDRA_${COMPONENT}_SLICES} COMPILE_FLAGS ${CSharp_ICE_LIB})
- endif()
-endfunction()
-
-# Function which adds information for installing
-function(hydra_component_install COMPONENT)
- install(TARGETS ${COMPONENT} DESTINATION Hydra/)
-endfunction()
diff --git a/Hydra_v3.cmake b/Hydra_v3.cmake
deleted file mode 100644
index 4b545f6..0000000
--- a/Hydra_v3.cmake
+++ /dev/null
@@ -1,748 +0,0 @@
-# Hydra component build infrastructures
-
-#
-# Copyright (C) 2010 - Digium, Inc.
-#
-# Coding/style guidelines:
-#
-# * Variables local to a function should be named using lowercase.
-# * Non-local variables (cached or not) should be named using uppercase.
-# * Cached variables should be kept to a bare minimum; using the cache
-# is only necessary when a variable value must be visible in
-# subdirectories that are not children of the directory the value
-# was set in. In functions, use the PARENT_SCOPE modifier of set()
-# to set the variable value in the directory the function was called
-# from (and it will be inherited by child directories automatically).
-# * Use the list() function for manipulating lists.
-#
-
-if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
- 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)
-endif()
-
-if(UNIX AND EXISTS "${CMAKE_SOURCE_DIR}/.svn")
- add_custom_target(update COMMAND svn update WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating checkout")
-endif()
-
-macro(set_cache_var)
- set(${ARGV} CACHE INTERNAL Bob FORCE)
-endmacro()
-
-# Function which scans a path for matching files or directories,
-# whose names end with a standard version number string, and
-# returns the one with the 'highest' version found, or NOTFOUND
-# 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()
-endfunction()
-
-# Find Ice installation for a specific major/minor version
-function(find_ICE version)
- if(WIN32)
- find_best_version(ice "C:/Ice-${version}")
- elseif(UNIX)
- find_best_version(ice "/opt/Ice-${version}")
- 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" 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()
- set_cache_var(ICE_DIR "${ice}")
-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()
-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()
-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()
-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()
-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")
- 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})
- if(NOT Boost_${libtag}_FOUND)
- message(FATAL_ERROR "Failed to find Boost library ${LIBRARY}")
- endif()
- endif()
-endfunction()
-
-# Function which initializes project specific things
-function(hydra_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(HYDRA_PROJECT_LANGUAGES ${ARGN} PARENT_SCOPE)
- set(HYDRA_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 HYDRA_ICEBOX_EXPORT to accomplish this, and this
- # block will ensure it contains the correct value.
- if(WIN32)
- message(STATUS "Setting HYDRA_ICEBOX_EXPORT definition for Windows IceBox services")
- add_definitions(-DHYDRA_ICEBOX_EXPORT=__declspec\(dllexport\))
- else()
- add_definitions(-DHYDRA_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(HYDRA_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(HYDRA_ICE_LIBRARIES_${l} Ice IceUtil PARENT_SCOPE)
- endif()
- include_directories("${ICE_CXX_INCLUDE_DIR}")
- link_directories("${ICE_CXX_LIB_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(hydra_add_ice_libraries)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one library to this function")
- endif()
- foreach(lang ${HYDRA_PROJECT_LANGUAGES})
- set(libs ${HYDRA_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(HYDRA_ICE_LIBRARIES_${lang} ${libs} PARENT_SCOPE)
- endforeach()
-endfunction()
-
-# Function which adds Boost libraries to all components in the current
-# directory and below
-function(hydra_add_boost_libraries)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one library to this function")
- endif()
- set(libs ${HYDRA_BOOST_LIBRARIES})
- foreach(lib ${ARGN})
- find_Boost_library(${lib})
- list(APPEND libs ${lib})
- endforeach()
- list(REMOVE_DUPLICATES libs)
- set(HYDRA_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})
-endmacro()
-
-# Function which remembers include directories needed for a particular Slice target
-function(hydra_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)
-endfunction()
-
-# Function which remembers definitions needed for a particular Slice target
-function(hydra_slice_compile_definitions SLICE_FILE)
- 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(hydra_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 ${HYDRA_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)
-endfunction()
-
-# Function which adds a dependency for a Slice definition
-function(hydra_slice_add_dependencies TARGET)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one dependency to this function")
- endif()
- foreach(l ${HYDRA_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()
-endfunction()
-
-# Function which compiles one or more Slice definition files;
-# the file(s) are compiled for all languages in use in the project
-#
-# Syntax:
-# hydra_compile_slice(<target> [SOURCES source1 ... sourceN])
-#
-# Notes:
-# If only a target name is provided, it must include the '.ice'
-# extension; the target name will be the filename with the extension
-# removed.
-#
-# If SOURCES are provided, the function produces targets named
-# using the provided target name, but builds them from the listed
-# 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):
-#
-# HYDRA_SLICE_${SLICE}_${LANG}
-# marker indicating this Slice has been built for the language
-# HYDRA_SLICE_${SLICE}_CXX_INCLUDE_DIRS
-# directories where generated header files needed for this target live
-# (only for C++)
-function(hydra_compile_slice TARGET_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 hydra_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}")
- 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 ${HYDRA_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 ${HYDRA_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} ${HYDRA_ICE_LIBRARIES_${lang}})
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- 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} SHARED ${generated_files} ${slice_files})
- install(TARGETS ${TARGET}_${lang} DESTINATION Hydra/)
- foreach(lib ${${TARGET}_ICE_LIBRARIES} ${HYDRA_ICE_LIBRARIES_${lang}})
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- endforeach()
- if(target_libs)
- target_link_libraries(${TARGET}_${lang} ${target_libs})
- 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(HYDRA_SLICE_${TARGET}_CXX_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${target_CXX_includes})
- endif()
- set_cache_var(HYDRA_SLICE_${TARGET}_${lang} Bob)
- endforeach()
-endfunction()
-
-# Function which initializes a component for building
-function(hydra_component_init COMPONENT LANG)
- message(STATUS "Setting up to build component ${COMPONENT}")
- set(HYDRA_${COMPONENT}_LANG ${LANG} PARENT_SCOPE)
-endfunction()
-
-# Function which adds the compiled Slice targets to a component to be built
-function(hydra_component_add_slice COMPONENT)
- if(NOT ARGN)
- message(FATAL_ERROR "You must pass at least one Slice target to this function")
- endif()
- if(NOT HYDRA_${COMPONENT}_LANG)
- message(FATAL_ERROR "Must call hydra_component_init for component ${COMPONENT} before hydra_component_add_slice")
- endif()
- set(slice_list ${${COMPONENT}_SLICES})
- foreach(slice ${ARGN})
- get_filename_component(f ${slice} NAME_WE)
- if(NOT HYDRA_SLICE_${f}_${HYDRA_${COMPONENT}_LANG})
- message(FATAL_ERROR "Must call hydra_compile_slice for ${f} before hydra_component_add_slice")
- endif()
- message(STATUS "Adding Slice ${f} to component ${COMPONENT}")
- list(APPEND slice_list ${f}_${HYDRA_${COMPONENT}_LANG})
- if(HYDRA_${COMPONENT}_LANG STREQUAL "CXX")
- list(APPEND include_dirs ${HYDRA_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(hydra_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(HYDRA_${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(hydra_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 ${HYDRA_${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(hydra_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 ${HYDRA_${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(hydra_component_build_icebox COMPONENT)
- set(lang ${HYDRA_${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 ${HYDRA_ICE_LIBRARIES_${lang}} ${${COMPONENT}_ICE_LIBRARIES})
- list(REMOVE_DUPLICATES icelibs)
- foreach(lib ${icelibs})
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- endforeach()
-
- if(lang STREQUAL "CXX")
- # Now we actually create the library
- add_library(${COMPONENT} MODULE ${${COMPONENT}_SOURCES})
- # Link required libraries and Slice libraries
- list(APPEND boostlibs ${HYDRA_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()
-endfunction()
-
-# Function which builds a component standalone
-function(hydra_component_build_standalone COMPONENT)
- set(lang ${HYDRA_${COMPONENT}_LANG})
- message(STATUS "Building component ${COMPONENT} (${lang}) as standalone executable")
- list(APPEND icelibs ${HYDRA_ICE_LIBRARIES_${lang}} ${${COMPONENT}_ICE_LIBRARIES})
- list(REMOVE_DUPLICATES icelibs)
- foreach(lib ${icelibs})
- list(APPEND target_libs "${ICE_${lang}_LIB_${lib}}")
- 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 ${HYDRA_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_executable(${COMPONENT} ${${COMPONENT}_SOURCES} REFERENCES ${${COMPONENT}_SLICES} ${target_libs})
- endif()
-endfunction()
-
-# Function which adds information for installing a component
-function(hydra_component_install COMPONENT)
- install(TARGETS ${COMPONENT} DESTINATION Hydra/)
-endfunction()
diff --git a/README b/README.txt
similarity index 100%
rename from README
rename to README.txt
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 6df9aab..12f20dd 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -4,78 +4,125 @@
# require a higher version OR the Hydra.cmake file requires a higher version this can be left at 2.6
cmake_minimum_required(VERSION 2.6)
+# This allows you to use the CPack package builder. You must install some package building generator,
+# such as NullSoft Installer (NSI) on Windows.
+# This step is optional. While Hydra_v4.cmake has CPack-specific calls, they are only executed when
+# HYDRA_CPACK is set TRUE. This project-specific include sets this variable and sets other
+# project-specific values.
+include(CPackConfig.txt)
+
# In order to use the Hydra component common build system it has to be included into this CMakeLists.txt
# so that the functions become available. If you are using svn:externals to get the build system this will
# need to be changed to include the directory it exists in. For example if you have it being pulled into
# the cmake directory you would use:
#
-# include(cmake/Hydra.cmake)
+# include(cmake/Hydra_v4.cmake)
#
-include(../Hydra.cmake)
-
-# Note that the only valid languages for the following functions are: CXX (for C++)
+include(../Hydra_v4.cmake)
-# This function takes a project name as an argument and sets the project up in CMake.
-hydra_project(example)
+# Note that the only valid languages for the following functions are: CXX (for C++) and CSharp (for C#)
-# If you have installed ICE into an uncommon path OR the Hydra.cmake file has not yet been updated with
-# a new version (for Windows users) you can set the following variable to the path of the installation
-# so that the dependencies are found.
-set(HYDRA_ICE_HOME)
+# 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.
+#
+hydra_project(example 3.4 CXX)
# 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.
-# Note that it is possible for things to exist in separate directories (such as slice definitions in one
+# Note that it is possible for things to exist in separate directories (such as Slice definitions in one
# 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
-# track of component slice definitions, sources, and other things for a component. It *must* be
-# called before executing any other hydra component function. This function also does dependency
-# checking unique to the language specified. For C++ it will check for the presence of ICE and Boost.
+# track of component Slice definitions, sources, and other things for a component. It *must* be
+# called before executing any other Hydra component function. This function also does dependency
+# checking unique to the language specified.
hydra_component_init(examplebox CXX)
# If you have additional third party dependencies for your component the CMake logic to find them can be
# inserted here.
-# It is extremely important to put HYDRA_ICEBOX_EXPORT before the name of your derived icebox service
+# It is extremely important to put HYDRA_ICEBOX_EXPORT before the name of your derived IceBox service
# class. When compiling on Windows this will get defined so that the class is exported allowing the service
# to be loaded. If you do not put this in your component will not work on Windows.
-# If a slice definition requires additional definitions from a non-standard location, directories containing
-# those definitions can be specified with this function.
-hydra_slice_add_include_dirs(fluxcapacitor.ice /home/zaphod/slice)
-
-# If a slice definition requires macro definitions, they can be specified with this function.
-hydra_slice_add_definitions(fluxcapacitor.ice SERVER JOSH=LEET)
-
-# This function takes a component name and slice definition as parameters. It adds the slice definition
-# to the component so it is compiled in and so the headers are made available. This *must* be called from the
-# same directory that the slice definition exists in.
-hydra_component_add_slice(examplebox fluxcapacitor.ice)
+# If a Slice definition requires additional definitions from a non-standard location, directories containing
+# those definitions can be specified with this function; note that just like CMake's standard include_directories()
+# function, this applies to the entire directory it is included in, not just a single target, and all
+# its subdirectories
+hydra_slice_include_directories(/home/zaphod/slice)
+
+# If a Slice definition requires macro definitions, they can be specified with this function.
+hydra_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.
+hydra_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 hydra_slice_include_directories(), hydra_slice_compile_definitions(),
+# hydra_component_add_slice(), and hydra_slice_add_ice_libraries().
+# Parameters to hydra_compile_slice:
+# - 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
+# in the installer.
+# - Group for use by the packager. The group should be previously configured in the CPackConfig.cmake file. The user
+# is typically allowed to select specific groups during a custom install process.
+hydra_compile_slice(fluxcapacitor.ice lib "Slice Defined API" Core)
+
+# This function takes a component name and Slice target as parameters. It adds the Slice target
+# to the component so it is compiled in and so the headers are made available.
+hydra_component_add_slice(examplebox fluxcapacitor)
# This function takes a component name and source file as parameters. The source file is added in so it gets
# compiled into the component. This *must* be called from the same directory that the source file exists in.
hydra_component_add_file(examplebox example.cpp)
-# This function takes a component name as the parameter. It prepares things for building.
-hydra_component_build_prep(examplebox)
+# 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
+# hydra_component_build_icebox() function will handle that automatically.
+hydra_slice_add_ice_libraries(fluxcapacitor IceStorm)
-# This function takes a component name as the parameter. It builds an Icebox service that Icebox can load.
+# This function takes a component name as the parameter. It builds an IceBox service that IceBox can load.
hydra_component_build_icebox(examplebox)
# This function takes a component name as the parameter. It sets up an install target on the build environment
# if possible.
-hydra_component_install(examplebox)
+# Parameters to hydra_compile_slice:
+# - The component's name, as previously defined in a call to hydra_component_init().
+# - The CMake install() command's type, as defined in CMake docs.
+# - The subdirectory in which to install the output of the build.
+# - Description for use by the packager. This text typically appears when the user hovers over the component's name
+# in the installer.
+# - Group name for use by the packager. The group should be previously configured in the CPackConfig.cmake file. The user
+# is typically allowed to select specific groups during a custom install process.
+hydra_component_install(examplebox LIBRARY lib "Icebox example component." Core)
# Now we move on to the next component, a standalone executable.
hydra_component_init(example CXX)
-hydra_component_add_slice(example fluxcapacitor.ice)
+hydra_component_add_slice(example fluxcapacitor)
hydra_component_add_file(example example.cpp)
-hydra_component_build_prep(example)
# This function takes a component name as the parameter. It builds a standalone executable.
hydra_component_build_standalone(example)
-hydra_component_install(example)
+# Specifies how to install the component.
+# Parameters to hydra_compile_slice:
+# - The component's name, as previously defined in a call to hydra_component_init().
+# - The CMake install() command's type, as defined in CMake docs.
+# - The subdirectory in which to install the output of the build.
+# - Description for use by the packager. This text typically appears when the user hovers over the component's name
+# in the installer.
+# - Group name for use by the packager. The group should be previously configured in the CPackConfig.cmake file. The user
+# is typically allowed to select specific groups during a custom install process.
+hydra_component_install(example RUNTIME bin "Example application." Core)
+
diff --git a/example_v4/CPackConfig.txt b/example/CPackConfig.txt
similarity index 100%
rename from example_v4/CPackConfig.txt
rename to example/CPackConfig.txt
diff --git a/example_v3/build/runcmake.bat b/example/build/runcmake.bat
similarity index 100%
rename from example_v3/build/runcmake.bat
rename to example/build/runcmake.bat
diff --git a/example/example.cpp b/example/example.cpp
index 8488f4e..d46f92e 100644
--- a/example/example.cpp
+++ b/example/example.cpp
@@ -1,4 +1,51 @@
-int main(void)
+#include <Ice/Ice.h>
+#include "fluxcapacitor.h"
+
+using namespace TimeMachine::DeLorean;
+using namespace std;
+
+namespace TimeMachine
{
- return 0;
+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)
+ {
+ return true;
+ }
+ 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;
+ }
+
}
+
+
diff --git a/example/fluxcapacitor.ice b/example/fluxcapacitor.ice
index e69de29..583496c 100644
--- a/example/fluxcapacitor.ice
+++ b/example/fluxcapacitor.ice
@@ -0,0 +1,16 @@
+#pragma once
+
+module TimeMachine
+{
+ module DeLorean
+ {
+ const string THRESHOLD="88 MPH";
+
+ interface BackInTime
+ {
+ bool Jump(int day, int month, int year, float speed);
+ };
+
+ };
+
+};
\ No newline at end of file
diff --git a/example_v4/packagefiles/Description.txt b/example/packagefiles/Description.txt
similarity index 100%
rename from example_v4/packagefiles/Description.txt
rename to example/packagefiles/Description.txt
diff --git a/example_v4/packagefiles/License.txt b/example/packagefiles/License.txt
similarity index 100%
rename from example_v4/packagefiles/License.txt
rename to example/packagefiles/License.txt
diff --git a/example_v4/packagefiles/ReadMe.txt b/example/packagefiles/ReadMe.txt
similarity index 100%
rename from example_v4/packagefiles/ReadMe.txt
rename to example/packagefiles/ReadMe.txt
diff --git a/example_v4/packagefiles/Welcome.txt b/example/packagefiles/Welcome.txt
similarity index 100%
rename from example_v4/packagefiles/Welcome.txt
rename to example/packagefiles/Welcome.txt
diff --git a/example_v2/CMakeLists.txt b/example_v2/CMakeLists.txt
deleted file mode 100644
index a44676e..0000000
--- a/example_v2/CMakeLists.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-# This is an example CMakeLists.txt file for use with the Hydra component common build system
-
-# You should specify the minimum version of cmake that is allowed. Unless you are using things that
-# require a higher version OR the Hydra.cmake file requires a higher version this can be left at 2.6
-cmake_minimum_required(VERSION 2.6)
-
-# In order to use the Hydra component common build system it has to be included into this CMakeLists.txt
-# so that the functions become available. If you are using svn:externals to get the build system this will
-# need to be changed to include the directory it exists in. For example if you have it being pulled into
-# the cmake directory you would use:
-#
-# include(cmake/Hydra_v2.cmake)
-#
-include(../Hydra_v2.cmake)
-
-# Note that the only valid languages for the following functions are: CXX (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.
-#
-hydra_project(example 3.3 CXX)
-
-# If you have installed ICE into an uncommon path OR the Hydra.cmake file has not yet been updated with
-# a new version (for Windows users) you can set the following variable to the path of the installation
-# so that the dependencies are found.
-set(HYDRA_ICE_HOME)
-
-# 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.
-
-# Note that it is possible for things to exist in separate directories (such as slice definitions in one
-# 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
-# track of component slice definitions, sources, and other things for a component. It *must* be
-# called before executing any other hydra component function. This function also does dependency
-# checking unique to the language specified. For C++ it will check for the presence of ICE and Boost.
-hydra_component_init(examplebox CXX)
-
-# If you have additional third party dependencies for your component the CMake logic to find them can be
-# inserted here.
-
-# It is extremely important to put HYDRA_ICEBOX_EXPORT before the name of your derived icebox service
-# class. When compiling on Windows this will get defined so that the class is exported allowing the service
-# to be loaded. If you do not put this in your component will not work on Windows.
-
-# If a slice definition requires additional definitions from a non-standard location, directories containing
-# those definitions can be specified with this function; note that just like CMake's standard include_directories()
-# function, this applies to the entire directory it is included in, not just a single target
-hydra_slice_include_directories(/home/zaphod/slice)
-
-# If a slice definition requires macro definitions, they can be specified with this function.
-hydra_slice_compile_definitions(fluxcapacitor SERVER JOSH=LEET)
-
-# 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 hydra_slice_include_directories(), hydra_slice_compile_definitions() and
-# hydra_component_add_slice().
-hydra_compile_slice(fluxcapacitor)
-
-# This function takes a component name and slice definition as parameters. It adds the slice definition
-# to the component so it is compiled in and so the headers are made available. This *must* be called from the
-# same directory that the slice definition exists in.
-hydra_component_add_slice(examplebox fluxcapacitor)
-
-# This function takes a component name and source file as parameters. The source file is added in so it gets
-# compiled into the component. This *must* be called from the same directory that the source file exists in.
-hydra_component_add_file(examplebox example.cpp)
-
-# This function takes a component name as the parameter. It prepares things for building.
-hydra_component_build_prep(examplebox)
-
-# This function takes a component name as the parameter. It builds an Icebox service that Icebox can load.
-hydra_component_build_icebox(examplebox)
-
-# This function takes a component name as the parameter. It sets up an install target on the build environment
-# if possible.
-hydra_component_install(examplebox)
-
-# Now we move on to the next component, a standalone executable.
-hydra_component_init(example CXX)
-hydra_component_add_slice(example fluxcapacitor)
-hydra_component_add_file(example example.cpp)
-hydra_component_build_prep(example)
-
-# This function takes a component name as the parameter. It builds a standalone executable.
-hydra_component_build_standalone(example)
-
-hydra_component_install(example)
diff --git a/example_v2/example.cpp b/example_v2/example.cpp
deleted file mode 100644
index 8488f4e..0000000
--- a/example_v2/example.cpp
+++ /dev/null
@@ -1,4 +0,0 @@
-int main(void)
... 367 lines suppressed ...
--
asterisk-scf/release/cmake.git
More information about the asterisk-scf-commits
mailing list