Commit 6ef55bc7 authored by millerjv's avatar millerjv
Browse files

ENH: more changes to Slicer, GenerateCLP, ModuleDescriptionParser, and TCLAP...

ENH: more changes to Slicer, GenerateCLP, ModuleDescriptionParser, and TCLAP to support building command line modules against an installation.  This currently works with a CVSHEAD ITK. Remaining configuration changes are to install .lib's under <install>/lib/Slicer3 instead of under <install>/lib.  This will make all the packages consistent in how they navigate from where the <Pkg>Config.cmake lives in the installation to the directories for libs, includes, etc.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@5614 3bd1e089-480b-0410-8dfb-8563597acbee
parent 47471257
......@@ -299,6 +299,6 @@ INSTALL(FILES
# ${Slicer3_BINARY_DIR}/Slicer3BuildSettings.cmake
${Slicer3_BINARY_DIR}/UseSlicer3.cmake
${Slicer3_BINARY_DIR}/Utilities/Slicer3Config.cmake
DESTINATION lib
DESTINATION lib/Slicer3
COMPONENT Development
)
......@@ -3,6 +3,13 @@
# Slicer. This provides a mechanism for third party developers to build
# modules against a Slicer installation.
#
#
# The configuration process is very different for a build tree and an
# installation. The resulting directory structures are vastly
# different. So, the two configured files not only have different
# settings, they have a different structure.
# Settings that are the same for build trees and installation trees
#
......@@ -31,20 +38,11 @@ CONFIGURE_FILE(${Slicer3_SOURCE_DIR}/Slicer3Config.cmake.in
# Settings specific for installation trees
#
#
SET(Slicer3_USE_FILE_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/UseSlicer3.cmake)
SET(TCLAP_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/tclap)
SET(ModuleDescriptionParser_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/ModuleDescriptionParser)
SET(GenerateCLP_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/GenerateCLP)
SET(GenerateCLP_USE_FILE_CONFIG ${CMAKE_INSTALL_PREFIX}/Libs/GenerateCLP/UseGenerateCLP.cmake)
SET(Slicer3_INCLUDE_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/Slicer3/)
SET(Slicer3_LIBRARY_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/bin)
# (Note we configure from a different file than use for the build tree)
# Configure Slicer3Config.cmake for the install tree.
CONFIGURE_FILE(${Slicer3_SOURCE_DIR}/Slicer3Config.cmake.in
CONFIGURE_FILE(${Slicer3_SOURCE_DIR}/Slicer3InstallConfig.cmake.in
${Slicer3_BINARY_DIR}/Utilities/Slicer3Config.cmake @ONLY IMMEDIATE)
......
# GenerateCLP could be installed anywhere, so set all paths based on where
# this file was found (which should be the lib/GenerateCLP directory of the
# installation)
GET_FILENAME_COMPONENT(GenerateCLP_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
SET(GenerateCLP_INCLUDE_DIRS "${GenerateCLP_CONFIG_DIR}/../../include/GenerateCLP")
SET(GenerateCLP_LIBRARY_DIRS "${GenerateCLP_CONFIG_DIR}/..")
SET(GenerateCLP_USE_FILE "${GenerateCLP_CONFIG_DIR}/UseGenerateCLP.cmake")
SET(GENERATECLP_EXE "${GenerateCLP_CONFIG_DIR}/../../bin/GenerateCLP")
SET(TCLAP_DIR "${GenerateCLP_CONFIG_DIR}/../tclap")
SET(ModuleDescriptionParser_DIR "${GenerateCLP_CONFIG_DIR}/../ModuleDescriptionParser")
SET(ITK_DIR "${GenerateCLP_CONFIG_DIR}/../InsightToolkit")
......@@ -13,13 +13,11 @@ SET(GENERATECLP_EXE ${USE_CONFIG_FILE_INSTALL_DIR}/${CMAKE_CFG_INTDIR}/GenerateC
# Settings specific to build trees
#
#
SET(GenerateCLP_USE_FILE_CONFIG ${GenerateCLP_BINARY_DIR}/UseGenerateCLP.cmake)
SET(TCLAP_DIR_CONFIG ${TCLAP_DIR})
SET(ModuleDescriptionParser_DIR_CONFIG ${ModuleDescriptionParser_DIR})
CONFIGURE_FILE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake.in
${GenerateCLP_USE_FILE_CONFIG}
@ONLY IMMEDIATE)
SET(GenerateCLP_USE_FILE_CONFIG ${GenerateCLP_BINARY_DIR}/UseGenerateCLP.cmake)
SET(GenerateCLP_INCLUDE_DIRS_CONFIG ${GenerateCLP_BINARY_DIR} ${GenerateCLP_SOURCE_DIR})
SET(GenerateCLP_LIBRARY_DIRS_CONFIG ${GenerateCLP_BINARY_DIR})
SET(GENERATECLP_EXE_CONFIG ${GENERATECLP_EXE})
......@@ -31,16 +29,9 @@ CONFIGURE_FILE(${GenerateCLP_SOURCE_DIR}/GenerateCLPConfig.cmake.in
# Settings specific for installation trees
#
#
SET(GenerateCLP_USE_FILE_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/GenerateCLP/UseGenerateCLP.cmake)
SET(TCLAP_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/tclap)
SET(ModuleDescriptionParser_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/ModuleDescriptionParser)
CONFIGURE_FILE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake.in
${GenerateCLP_BINARY_DIR}/UseGenerateCLP.cmake_install
@ONLY IMMEDIATE)
SET(GenerateCLP_INCLUDE_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/include/GenerateCLP)
SET(GenerateCLP_LIBRARY_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/GenerateCLP)
SET(GENERATECLP_EXE_CONFIG ${CMAKE_INSTALL_PREFIX}/bin/GenerateCLP)
SET(ITK_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/InsightToolkit)
CONFIGURE_FILE(${GenerateCLP_SOURCE_DIR}/GenerateCLPConfig.cmake.in
CONFIGURE_FILE(${GenerateCLP_SOURCE_DIR}/GenerateCLPInstallConfig.cmake.in
${GenerateCLP_BINARY_DIR}/GenerateCLPConfig.cmake_install @ONLY IMMEDIATE)
......@@ -5,18 +5,11 @@ ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR "Cannot build without ITK. Please set ITK_DIR.")
ENDIF(ITK_FOUND)
#
# If being build as part of Slicer3, we know where to find tclap include files
# Propagate directories down to installed environment
SET(TCLAP_DIR @TCLAP_DIR_CONFIG@)
FIND_PACKAGE(TCLAP REQUIRED)
IF(TCLAP_FOUND)
INCLUDE(${TCLAP_USE_FILE})
ENDIF(TCLAP_FOUND)
# Propagate directories down to installed environment
SET(ModuleDescriptionParser_DIR @ModuleDescriptionParser_DIR_CONFIG@)
FIND_PACKAGE(ModuleDescriptionParser REQUIRED)
IF(ModuleDescriptionParser_FOUND)
INCLUDE(${ModuleDescriptionParser_USE_FILE})
......
......@@ -19,12 +19,7 @@ CONFIGURE_FILE(${ModuleDescriptionParser_SOURCE_DIR}/ModuleDescriptionParserConf
# Settings specific for installation trees
#
#
SET(ModuleDescriptionParser_INCLUDE_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/include/ModuleDescriptionParser)
SET(ModuleDescriptionParser_LIBRARY_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/ModuleDescriptionParser)
SET(ModuleDescriptionParser_USE_FILE_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/ModuleDescriptionParser/UseModuleDescriptionParser.cmake)
SET(ITK_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/InsightToolkit)
# Configure ModuleDescriptionParserConfig.cmake for the install tree.
CONFIGURE_FILE(${ModuleDescriptionParser_SOURCE_DIR}/ModuleDescriptionParserConfig.cmake.in
CONFIGURE_FILE(${ModuleDescriptionParser_SOURCE_DIR}/ModuleDescriptionParserInstallConfig.cmake.in
${ModuleDescriptionParser_BINARY_DIR}/install/ModuleDescriptionParserConfig.cmake @ONLY IMMEDIATE)
# ModuleDescriptionParser could be installed anywhere, so set all paths based
# on where this file was found (which should be the lib/ModuleDescriptionParser
# directory of the installation)
GET_FILENAME_COMPONENT(ModuleDescriptionParser_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
#
SET(ModuleDescriptionParser_INCLUDE_DIRS "${ModuleDescriptionParser_CONFIG_DIR}/../../include/ModuleDescriptionParser")
SET(ModuleDescriptionParser_LIBRARY_DIRS "${ModuleDescriptionParser_CONFIG_DIR}/..")
SET(ModuleDescriptionParser_USE_FILE "${ModuleDescriptionParser_CONFIG_DIR}/UseModuleDescriptionParser.cmake")
SET(ITK_DIR "${ModuleDescriptionParser_CONFIG_DIR}/../InsightToolkit")
......@@ -17,10 +17,8 @@ CONFIGURE_FILE(${TCLAP_SOURCE_DIR}/TCLAPConfig.cmake.in
# Settings specific for installation trees
#
# tclap include files referenced as "tclap/foo.h"
SET(TCLAP_INCLUDE_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/include)
SET(TCLAP_USE_FILE_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/tclap/UseTCLAP.cmake)
# Configure Slicer3Config.cmake for the install tree.
CONFIGURE_FILE(${TCLAP_SOURCE_DIR}/TCLAPConfig.cmake.in
CONFIGURE_FILE(${TCLAP_SOURCE_DIR}/TCLAPInstallConfig.cmake.in
${TCLAP_BINARY_DIR}/install/TCLAPConfig.cmake @ONLY IMMEDIATE)
# tclap could be installed anywhere, so set all paths based on where
# this file was found (which should be the lib/tclap directory of the
# installation)
GET_FILENAME_COMPONENT(tclap_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
# The TCLAP include directories.
# tclap include files referenced as "tclap/foo.h"
SET(TCLAP_INCLUDE_DIRS "${tclap_CONFIG_DIR}/../../include/")
# The TCLAP USE file
SET(TCLAP_USE_FILE "${tclap_CONFIG_DIR}/UseTCLAP.cmake")
#
# Slicer3Config.cmake - Slicer3 CMake configuration file for external projects
#
# This file is configured by Slicer3 and used by UseSlicer3.cmake module
# to load Slicer3's settings for an external project. External projects
# can use these setting to build new modules against a Slicer3 build tree
# or a Slicer3 installation.
#
# Slicer could be installed anywhere, so set all paths based on where
# this file was found (which should be the lib/Slicer3 directory of the
# installation)
GET_FILENAME_COMPONENT(Slicer3_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
# The Slicer3 include file directories.
SET(Slicer3_INCLUDE_DIRS "${Slicer3_CONFIG_DIR}/../../include/Slicer3")
# The Slicer3 library directories.
SET(Slicer3_LIBRARY_DIRS "${Slicer3_CONFIG_DIR}/..")
# The C and C++ flags added by Slicer3 to the cmake-configured flags.
SET(Slicer3_REQUIRED_C_FLAGS "@Slicer3_REQUIRED_C_FLAGS@")
SET(Slicer3_REQUIRED_CXX_FLAGS "@Slicer3_REQUIRED_CXX_FLAGS@")
SET(Slicer3_REQUIRED_LINK_FLAGS "@Slicer3_REQUIRED_LINK_FLAGS@")
# The Slicer3 version number
SET(Slicer3_VERSION_MAJOR "@Slicer3_VERSION_MAJOR@")
SET(Slicer3_VERSION_MINOR "@Slicer3_VERSION_MINOR@")
SET(Slicer3_VERSION_PATCH "@Slicer3_VERSION_PATCH@")
# The location of the UseSlicer3.cmake file.
SET(Slicer3_USE_FILE "${Slicer3_CONFIG_DIR}/UseSlicer3.cmake")
# The build settings file.
SET(Slicer3_BUILD_SETTINGS_FILE "${Slicer3_CONFIG_DIR}/Slicer3BuildSettings.cmake")
# Whether Slicer3 was built with shared libraries.
SET(Slicer3_BUILD_SHARED "@BUILD_SHARED_LIBS@")
# Components needed to build modules from outside a Slicer3 build tree or
# from outside a Slicer3 installation tree
SET(TCLAP_DIR "${Slicer3_CONFIG_DIR}/../tclap")
SET(ModuleDescriptionParser_DIR "${Slicer3_CONFIG_DIR}/../ModuleDescriptionParser")
SET(GenerateCLP_DIR "${Slicer3_CONFIG_DIR}/../GenerateCLP")
SET(GenerateCLP_USE_FILE "${GenerateCLP_DIR}/UseGenerateCLP.cmake")
SET(GENERATECLP_EXE "${Slicer3_CONFIG_DIR}/../../bin/GenerateCLP")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment