[hydra-commits] hydra/cmake.git branch "master" updated.
Commits to the Hydra project code repositories
hydra-commits at lists.digium.com
Fri Jul 16 15:09:23 CDT 2010
branch "master" has been updated
via 8a9335238af711324d93ca91c799a37545647fa3 (commit)
from 5e768d0b68ad92dda5a9aeb2122faf1420a0a3a3 (commit)
Summary of changes:
CMakeLists.txt | 20 +++++++++++
CPackConfig.cmake | 21 ++++++++++++
Hydra_v3.cmake => Hydra_v4.cmake | 23 +++++++++++--
example_v3/build/runcmake.bat | 6 +++
example_v3/fluxcapacitor.ice | 16 +++++++++
{example_v3 => example_v4}/CMakeLists.txt | 44 ++++++++++++++++++++++---
example_v4/CPackConfig.txt | 23 +++++++++++++
example_v4/build/runcmake.bat | 6 +++
example_v4/example.cpp | 51 +++++++++++++++++++++++++++++
example_v4/fluxcapacitor.ice | 16 +++++++++
example_v4/packagefiles/Description.txt | 5 +++
example_v4/packagefiles/License.txt | 22 ++++++++++++
example_v4/packagefiles/ReadMe.txt | 7 ++++
example_v4/packagefiles/Welcome.txt | 2 +
14 files changed, 253 insertions(+), 9 deletions(-)
create mode 100644 CMakeLists.txt
create mode 100644 CPackConfig.cmake
copy Hydra_v3.cmake => Hydra_v4.cmake (96%)
create mode 100644 example_v3/build/runcmake.bat
copy {example_v3 => example_v4}/CMakeLists.txt (67%)
create mode 100644 example_v4/CPackConfig.txt
create mode 100644 example_v4/build/runcmake.bat
create mode 100644 example_v4/example.cpp
create mode 100644 example_v4/fluxcapacitor.ice
create mode 100644 example_v4/packagefiles/Description.txt
create mode 100644 example_v4/packagefiles/License.txt
create mode 100644 example_v4/packagefiles/ReadMe.txt
create mode 100644 example_v4/packagefiles/Welcome.txt
- Log -----------------------------------------------------------------
commit 8a9335238af711324d93ca91c799a37545647fa3
Author: Ken Hunt <ken.hunt at digium.com>
Date: Fri Jul 16 14:54:33 2010 -0500
Added Hydra_v4.cmake with updated example. This version incorporates CPack support.
Also modified the example for V3 so that there is a definition in the
slice file. On Windows, with an empty .ice file, there is nothing for
the Slice-related DLL to export and thus no .lib file will be generated.
The example doesn't build in this state on Windows.
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..f8f6c35
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,20 @@
+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/CPackConfig.cmake b/CPackConfig.cmake
new file mode 100644
index 0000000..f97c224
--- /dev/null
+++ b/CPackConfig.cmake
@@ -0,0 +1,21 @@
+
+# This flag must be set to enable CPack support in Hydra_v4.cmake.
+set (HYDRA_CPACK "TRUE")
+
+# CPack properties must be set prior to including CPack.
+set (CPACK_PACKAGE_NAME "Hydra Core")
+set (CPACK_PACKAGE_INSTALL_DIRECTORY "Hydra Core 1.0.alpha")
+set (CPACK_PACKAGE_DESCRIPTION_FILE "X:/techdemo/trunk/packagefiles/Description.txt")
+set (CPACK_RESOURCE_FILE_LICENSE "X:/techdemo/trunk/packagefiles/License.txt")
+set (CPACK_RESOURCE_FILE_README "X:/techdemo/trunk/packagefiles/ReadMe.txt")
+set (CPACK_RESOURCE_FILE_WELCOME "X:/techdemo/trunk/packagefiles/Welcome.txt")
+set (CPACK_PACKAGE_VERSION "1.0.alpha")
+set (CPACK_PACKAGE_VERSION_MAJOR "1")
+set (CPACK_PACKAGE_VERSION_MINOR "0")
+set (CPACK_PACKAGE_VERSION_PATCH "alpha")
+include(CPACK)
+
+# Define the Groups of components.
+cpack_add_component_group("Core" "Hydra Core" "Core runtime component required for operation")
+cpack_add_component_group("Utility" "Utiltity" "Optional utility application.")
+cpack_add_component_group("Test" "Test" "Test drivers.")
diff --git a/Hydra_v4.cmake b/Hydra_v4.cmake
new file mode 100644
index 0000000..a14dfc7
--- /dev/null
+++ b/Hydra_v4.cmake
@@ -0,0 +1,763 @@
+# 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 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 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 ${DIR_IN} COMPONENT ${TARGET}_${lang})
+ if (HYDRA_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} ${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 COMPONENTNAME TYPE DIR DESC GROUP)
+ install(TARGETS ${COMPONENTNAME} ${TYPE} DESTINATION ${DIR} COMPONENT ${COMPONENTNAME})
+
+ if (HYDRA_CPACK)
+ hydra_component_package(${COMPONENTNAME} ${DESC} ${GROUP})
+ endif()
+endfunction()
+
+# Adds a component to the packager. COMPONENTNAME must have been previously defined
+# via the install command.
+function(hydra_component_package COMPONENTNAME DESC GROUPNAME)
+ cpack_add_component(${COMPONENTNAME} DESCRIPTION ${DESC} GROUP ${GROUP})
+endfunction()
diff --git a/example_v3/build/runcmake.bat b/example_v3/build/runcmake.bat
new file mode 100644
index 0000000..f4da410
--- /dev/null
+++ b/example_v3/build/runcmake.bat
@@ -0,0 +1,6 @@
+ at ECHO OFF
+REM -Wdev: Enable developer warnings.
+REM --build <sourcedir> : for out-of-source building
+
+cmake -Wdev --build .. -G "Visual Studio 9 2008"
+
diff --git a/example_v3/fluxcapacitor.ice b/example_v3/fluxcapacitor.ice
index e69de29..583496c 100644
--- a/example_v3/fluxcapacitor.ice
+++ b/example_v3/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/CMakeLists.txt b/example_v4/CMakeLists.txt
new file mode 100644
index 0000000..12f20dd
--- /dev/null
+++ b/example_v4/CMakeLists.txt
@@ -0,0 +1,128 @@
+# 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)
+
+# 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_v4.cmake)
+#
+include(../Hydra_v4.cmake)
+
+# Note that the only valid languages for the following functions are: CXX (for C++) and CSharp (for C#)
+
+# This function takes a project name as an argument and sets the project up in CMake. In addition it does
+# dependency checking and compiler configuration for all languages used in the project, so they must be included
+# as arguments as well. Finally, the major/minor version of ICE used by the project must be included for
+# proper dependency checking.
+#
+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
+# 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.
+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, 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)
+
+# 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.
+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.
+# 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)
+hydra_component_add_file(example example.cpp)
+
+# This function takes a component name as the parameter. It builds a standalone executable.
+hydra_component_build_standalone(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_v4/CPackConfig.txt
new file mode 100644
index 0000000..aba1456
--- /dev/null
+++ b/example_v4/CPackConfig.txt
@@ -0,0 +1,23 @@
+
+# This flag must be set to enable CPack support in Hydra_v4.cmake.
+set (HYDRA_CPACK "TRUE")
+
+# CPack properties must be set prior to including CPack.
+set (CPACK_PACKAGE_NAME "Time Machine")
+set (CPACK_PACKAGE_INSTALL_DIRECTORY "TimeMachine 4.0.0")
+set (CPACK_PACKAGE_DESCRIPTION_FILE "X:/techdemo/trunk/packagefiles/Description.txt")
+set (CPACK_RESOURCE_FILE_LICENSE "X:/techdemo/trunk/packagefiles/License.txt")
+set (CPACK_RESOURCE_FILE_README "X:/techdemo/trunk/packagefiles/ReadMe.txt")
+set (CPACK_RESOURCE_FILE_WELCOME "X:/techdemo/trunk/packagefiles/Welcome.txt")
+set (CPACK_PACKAGE_VERSION "4.0.0")
+set (CPACK_PACKAGE_VERSION_MAJOR "4")
+set (CPACK_PACKAGE_VERSION_MINOR "0")
+set (CPACK_PACKAGE_VERSION_PATCH "0")
+# set (CPACK_NSIS_MODIFY_PATH ON) # Do NOT set this! It REPLACES the system PATH (instead of appends to it), which could be difficult for an end user to restore.
+
+include(CPACK)
+
+# Define the Groups of components.
+cpack_add_component_group("Core" "Time Machine core component." "Core runtime component required for operation")
+cpack_add_component_group("Utility" "Utiltity component." "Optional utility application.")
+cpack_add_component_group("Test" "Test" "Test drivers.")
diff --git a/example_v4/build/runcmake.bat b/example_v4/build/runcmake.bat
new file mode 100644
index 0000000..f4da410
--- /dev/null
+++ b/example_v4/build/runcmake.bat
@@ -0,0 +1,6 @@
+ at ECHO OFF
+REM -Wdev: Enable developer warnings.
+REM --build <sourcedir> : for out-of-source building
+
+cmake -Wdev --build .. -G "Visual Studio 9 2008"
+
diff --git a/example_v4/example.cpp b/example_v4/example.cpp
new file mode 100644
index 0000000..d46f92e
--- /dev/null
+++ b/example_v4/example.cpp
@@ -0,0 +1,51 @@
+#include <Ice/Ice.h>
+#include "fluxcapacitor.h"
+
+using namespace TimeMachine::DeLorean;
+using namespace std;
+
+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)
+ {
+ 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_v4/fluxcapacitor.ice b/example_v4/fluxcapacitor.ice
new file mode 100644
index 0000000..583496c
--- /dev/null
+++ b/example_v4/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_v4/packagefiles/Description.txt
new file mode 100644
index 0000000..71694b8
--- /dev/null
+++ b/example_v4/packagefiles/Description.txt
@@ -0,0 +1,5 @@
+Example
+==========
+
+This is the Example installation package.
+It will install all key services of the alpha release.
\ No newline at end of file
diff --git a/example_v4/packagefiles/License.txt b/example_v4/packagefiles/License.txt
new file mode 100644
index 0000000..539412f
--- /dev/null
+++ b/example_v4/packagefiles/License.txt
@@ -0,0 +1,22 @@
+ Example Mock License
+ ~~~~~
+ License for use and distribution
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Example Copyright (C) 2010 Yada Yada.
+
+
+ GNU V2 information
+ --------------------
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+
diff --git a/example_v4/packagefiles/ReadMe.txt b/example_v4/packagefiles/ReadMe.txt
new file mode 100644
index 0000000..443a65e
--- /dev/null
+++ b/example_v4/packagefiles/ReadMe.txt
@@ -0,0 +1,7 @@
+Example - README
+===================
+
+1.0.Alpha Release:
+ - SIP Channel Service
+ - IAX2 Channel Service
+ - Yada yada
\ No newline at end of file
diff --git a/example_v4/packagefiles/Welcome.txt b/example_v4/packagefiles/Welcome.txt
new file mode 100644
index 0000000..0632559
--- /dev/null
+++ b/example_v4/packagefiles/Welcome.txt
@@ -0,0 +1,2 @@
+Hola! Welcome to Example!
+============================
\ No newline at end of file
-----------------------------------------------------------------------
--
hydra/cmake.git
More information about the asterisk-scf-commits
mailing list