Commit 64c1318f authored by millerjv's avatar millerjv
Browse files

ENH: More changes to the configurations of GenerateCLP to streamline its use...

ENH: More changes to the configurations of GenerateCLP to streamline its use and installation. Thanks to Hans Johnson for working through many of these issues.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@5576 3bd1e089-480b-0410-8dfb-8563597acbee
parent 2d4850ba
......@@ -101,7 +101,9 @@ IF(BatchMake_DIR)
# Find GenerateCLP
FIND_PACKAGE(GenerateCLP REQUIRED)
INCLUDE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
IF(${Slicer3BatchModule_LOGO})
GENERATECLP(Slicer3BatchModule_SOURCE
......
......@@ -98,10 +98,12 @@ IF(BatchMake_DIR)
"${CMAKE_CURRENT_BINARY_DIR}/SlicerBatchMakeConfig.h")
ENDIF(Slicer3_BINARY_DIR)
# Find GenerateCLP
FIND_PACKAGE(GenerateCLP REQUIRED)
INCLUDE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
IF(${Slicer3BatchModule_LOGO})
GENERATECLP(Slicer3BatchModule_SOURCE
......
......@@ -95,10 +95,12 @@ IF(BatchMake_DIR)
"${CMAKE_CURRENT_BINARY_DIR}/${Slicer3BatchModule}Config.h")
ENDIF(Slicer3_BINARY_DIR)
# Find GenerateCLP
FIND_PACKAGE(GenerateCLP REQUIRED)
INCLUDE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
IF(${Slicer3BatchModule_LOGO})
GENERATECLP(Slicer3BatchModule_SOURCE
......
......@@ -3,9 +3,11 @@ PROJECT( CLI )
#
FIND_PACKAGE(GenerateCLP REQUIRED)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
FIND_PACKAGE(vtkITK REQUIRED)
FIND_PACKAGE(ModuleDescriptionParser REQUIRED)
LINK_DIRECTORIES(${ModuleDescriptionParser_BINARY_DIR})
FIND_PACKAGE(ITK REQUIRED)
......@@ -14,8 +16,6 @@ INCLUDE(${ITK_USE_FILE})
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
INCLUDE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
IF (Slicer3_SOURCE_DIR)
SET(LIBRARY_OUTPUT_PATH "${SLICER_LIBRARIES_DIR}/Plugins")
SET(EXECUTABLE_OUTPUT_PATH "${SLICER_LIBRARIES_DIR}/Plugins")
......
......@@ -11,8 +11,10 @@ SET(CMAKE_VERBOSE_MAKEFILE OFF)
#)
FIND_PACKAGE(GenerateCLP REQUIRED)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
FIND_PACKAGE(ModuleDescriptionParser REQUIRED)
LINK_DIRECTORIES(${ModuleDescriptionParser_BINARY_DIR})
FIND_PACKAGE(ITK REQUIRED)
......@@ -21,8 +23,6 @@ INCLUDE(${ITK_USE_FILE})
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
INCLUDE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
IF (Slicer3_SOURCE_DIR)
SET(LIBRARY_OUTPUT_PATH "${SLICER_LIBRARIES_DIR}/Plugins")
SET(EXECUTABLE_OUTPUT_PATH "${SLICER_LIBRARIES_DIR}/Plugins")
......
......@@ -9,15 +9,15 @@ PROJECT( dwiNoiseFilter )
#)
FIND_PACKAGE(GenerateCLP REQUIRED)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
FIND_PACKAGE(ModuleDescriptionParser REQUIRED)
LINK_DIRECTORIES(${ModuleDescriptionParser_BINARY_DIR})
FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})
INCLUDE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
IF (Slicer3_SOURCE_DIR)
SET(LIBRARY_OUTPUT_PATH "${SLICER_LIBRARIES_DIR}/Plugins")
SET(EXECUTABLE_OUTPUT_PATH "${SLICER_LIBRARIES_DIR}/Plugins")
......
......@@ -24,9 +24,10 @@ INCLUDE(${SLICERLIBCURL_USE_FILE})
#
# Find GenerateCLP
FIND_PACKAGE(GenerateCLP REQUIRED)
INCLUDE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
#
# Set and generate source
SET(DownloadSlicerTutorials_SOURCE DownloadSlicerTutorials.cxx)
......
PROJECT( Realign )
FIND_PACKAGE(GenerateCLP REQUIRED)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
FIND_PACKAGE(ModuleDescriptionParser REQUIRED)
LINK_DIRECTORIES(${ModuleDescriptionParser_BINARY_DIR} ${vtkTeem_LIB_DIR})
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
INCLUDE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
IF (Slicer3_SOURCE_DIR)
SET(LIBRARY_OUTPUT_PATH "${SLICER_LIBRARIES_DIR}/Plugins")
SET(EXECUTABLE_OUTPUT_PATH "${SLICER_LIBRARIES_DIR}/Plugins")
......
......@@ -4,6 +4,9 @@
INCLUDE_REGULAR_EXPRESSION("^.*$")
FIND_PACKAGE(GenerateCLP REQUIRED)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
INCLUDE_DIRECTORIES(${Slicer3_SOURCE_DIR}/Applications/CLI)
INCLUDE_DIRECTORIES(${Slicer3_BINARY_DIR}/Applications/CLI)
......
......@@ -267,7 +267,10 @@ KWWidgets_INSTALL_TCL_TK_SUPPORT_FILES("/lib")
#
# use the command line utilities
#
INCLUDE(${Slicer3_SOURCE_DIR}/Libs/GenerateCLP/UseGenerateCLP.cmake)
FIND_PACKAGE(GenerateCLP REQUIRED)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
GENERATECLP(${SRC} Slicer3.xml)
......
......@@ -2,9 +2,12 @@ PROJECT( GUITesting )
#####################
FIND_PACKAGE(GenerateCLP REQUIRED)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
FIND_PACKAGE(vtkITK REQUIRED)
FIND_PACKAGE(ModuleDescriptionParser REQUIRED)
LINK_DIRECTORIES(${ModuleDescriptionParser_BINARY_DIR})
FIND_PACKAGE(ITK REQUIRED)
......@@ -14,8 +17,6 @@ FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
INCLUDE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
SET (CLP EventBrokerTest)
SET ( ${CLP}_SOURCE ${CLP}.cxx )
......
......@@ -227,20 +227,27 @@ SET(TCLAP_DIR ${Slicer3_BINARY_DIR}/Libs/tclap)
OPTION(BUILD_CLI "Build Slicer3 CLI Plugins" ON)
MARK_AS_ADVANCED(BUILD_CLI)
OPTION(BUILD_MODULES "Build Slicer3 Modules" ON)
MARK_AS_ADVANCED(BUILD_MODULES)
SUBDIRS(
Libs
)
SUBDIRS(
Base
Applications
)
)
OPTION(BUILD_MODULES "Build Slicer3 Modules" ON)
MARK_AS_ADVANCED(BUILD_MODULES)
IF(BUILD_MODULES)
SUBDIRS(Modules)
ENDIF(BUILD_MODULES)
## Applications need to be built after Modules to capture the TractTracing in
## the correct ordering.
SUBDIRS(
Applications
)
IF (Slicer3_BUILD_TESTING)
SUBDIRS( Testing )
ENDIF (Slicer3_BUILD_TESTING)
......
......@@ -18,7 +18,7 @@ SET(Slicer3_USE_FILE_CONFIG ${Slicer3_BINARY_DIR}/UseSlicer3.cmake)
SET(TCLAP_DIR_CONFIG ${Slicer3_BINARY_DIR}/Libs/tclap)
SET(ModuleDescriptionParser_DIR_CONFIG ${Slicer3_BINARY_DIR}/Libs/ModuleDescriptionParser)
SET(GenerateCLP_DIR_CONFIG ${Slicer3_BINARY_DIR}/Libs/GenerateCLP)
SET(GenerateCLP_USE_FILE_CONFIG ${Slicer3_SOURCE_DIR}/Libs/GenerateCLP/UseGenerateCLP.cmake)
SET(GenerateCLP_USE_FILE_CONFIG ${Slicer3_BINARY_DIR}/Libs/GenerateCLP/UseGenerateCLP.cmake)
SET(Slicer3_INCLUDE_DIRS_CONFIG ${Slicer3_SOURCE_DIR}/Applications/CLI)
SET(Slicer3_LIBRARY_DIRS_CONFIG ${Slicer3_BINARY_DIR}/bin)
......
PROJECT( SlicerLibs )
## GenerateGLP needs to be compiled first.
SUBDIRS(
tclap
ModuleDescriptionParser
GenerateCLP
)
# Note: Order of of SUBDIRS is important if your projects depend
# on code in other projects (put dependent project later).
IF( TEEM_FOUND )
......@@ -13,9 +19,6 @@ SUBDIRS(
FreeSurfer
Qdec
MRML
tclap
ModuleDescriptionParser
GenerateCLP
SlicerIO
ITKCommandIO
MRMLIDImageIO
......
......@@ -17,18 +17,6 @@ IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ENDIF(ITK_FOUND)
INCLUDE(UseGenerateCLP.cmake)
INCLUDE(GenerateGenerateCLPConfig.cmake)
# If we followed the standard pattern, UseGenerateCLP.cmake would be
# a configured file
#
#CONFIGURE_FILE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake.in
# ${GenerateCLP_BINARY_DIR}/UseGenerateCLP.cmake
# COPYONLY IMMEDIATE)
SET (GENERATECLP_SOURCE GenerateCLP.cxx)
ADD_EXECUTABLE ( GenerateCLP ${GENERATECLP_SOURCE})
TARGET_LINK_LIBRARIES ( GenerateCLP
......@@ -40,8 +28,15 @@ IF(BUILD_TESTING)
SUBDIRS(Testing)
ENDIF(BUILD_TESTING)
INCLUDE(GenerateGenerateCLPConfig.cmake)
INSTALL(TARGETS GenerateCLP RUNTIME DESTINATION bin COMPONENT Development)
INSTALL(FILES ${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake
${GenerateCLP_BINARY_DIR}/install/GenerateCLPConfig.cmake
INSTALL(FILES ${GenerateCLP_BINARY_DIR}/GenerateCLPConfig.cmake_install
DESTINATION lib/GenerateCLP
COMPONENT Development
RENAME GenerateCLPConfig.cmake)
INSTALL(FILES ${GenerateCLP_BINARY_DIR}/UseGenerateCLP.cmake_install
DESTINATION lib/GenerateCLP
COMPONENT Development)
COMPONENT Development
RENAME UseGenerateCLP.cmake)
# Generate the GenerateCLPConfig.cmake file in the build tree and configure
# one the installation tree.
# Following the standard pattern, UseGenerateCLP.cmake is a configured file
#
IF(Slicer3_BINARY_DIR)
SET(USE_CONFIG_FILE_INSTALL_DIR ${Slicer3_BINARY_DIR}/bin)
ELSE(Slicer3_BINARY_DIR)
SET(USE_CONFIG_FILE_INSTALL_DIR ${GenerateCLP_BINARY_DIR})
ENDIF(Slicer3_BINARY_DIR)
SET(GENERATECLP_EXE ${USE_CONFIG_FILE_INSTALL_DIR}/${CMAKE_CFG_INTDIR}/GenerateCLP)
# 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_INCLUDE_DIRS_CONFIG ${GenerateCLP_BINARY_DIR} ${GenerateCLP_SOURCE_DIR})
SET(GenerateCLP_LIBRARY_DIRS_CONFIG ${GenerateCLP_BINARY_DIR})
SET(GenerateCLP_USE_FILE_CONFIG ${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake)
SET(GENERATECLP_EXE_CONFIG ${GENERATECLP_EXE})
SET(TCLAP_DIR_CONFIG ${TCLAP_DIR})
SET(ModuleDescriptionParser_DIR_CONFIG ${ModuleDescriptionParser_DIR})
SET(ITK_DIR_CONFIG ${ITK_DIR})
# Configure GenerateCLPConfig.cmake for the install tree.
CONFIGURE_FILE(${GenerateCLP_SOURCE_DIR}/GenerateCLPConfig.cmake.in
${GenerateCLP_BINARY_DIR}/GenerateCLPConfig.cmake @ONLY IMMEDIATE)
# Settings specific for installation trees
#
#
SET(GenerateCLP_INCLUDE_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/include/GenerateCLP)
SET(GenerateCLP_LIBRARY_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/GenerateCLP)
SET(GenerateCLP_USE_FILE_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/GenerateCLP/UseGenerateCLP.cmake)
SET(GENERATECLP_EXE_CONFIG ${CMAKE_INSTALL_PREFIX}/bin/GenerateCLP)
SET(TCLAP_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/tclap)
SET(ModuleDescriptionParser_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/ModuleDescriptionParser)
SET(ITK_DIR_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/InsightToolkit)
CONFIGURE_FILE(${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake.in
${GenerateCLP_BINARY_DIR}/UseGenerateCLP.cmake_install
@ONLY IMMEDIATE)
# Configure GenerateCLPConfig.cmake for the install tree.
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
${GenerateCLP_BINARY_DIR}/install/GenerateCLPConfig.cmake @ONLY IMMEDIATE)
${GenerateCLP_BINARY_DIR}/GenerateCLPConfig.cmake_install @ONLY IMMEDIATE)
......@@ -5,7 +5,10 @@ ELSE ( ITK_FOUND )
MESSAGE ( FATAL_ERROR "Cannot build without ITK" )
ENDIF ( ITK_FOUND )
INCLUDE(../UseGenerateCLP.cmake)
FIND_PACKAGE(GenerateCLP REQUIRED)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
SET ( CLPEXAMPLE1_SOURCE CLPExample1.cxx )
GENERATECLP(CLPEXAMPLE1_SOURCE CLPExample1.xml)
......
......@@ -2,51 +2,33 @@ FIND_PACKAGE(ITK)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(ERROR "Cannot build without ITK. Please set ITK_DIR.")
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
IF(Slicer3_SOURCE_DIR)
SET(TCLAP_DIR ${Slicer3_BINARY_DIR}/Libs/tclap)
ENDIF(Slicer3_SOURCE_DIR)
# 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})
ENDIF(ModuleDescriptionParser_FOUND)
#INCLUDE_DIRECTORIES (${TCLAP_SOURCE_DIR}/include)
#
#IF(ModuleDescriptionParser_SOURCE_DIR)
# INCLUDE_DIRECTORIES(
# ${ModuleDescriptionParser_SOURCE_DIR}
# ${ModuleDescriptionParser_BINARY_DIR}
# )
#ELSE(ModuleDescriptionParser_SOURCE_DIR)
# INCLUDE_DIRECTORIES(
# ${Slicer3_SOURCE_DIR}/Libs/ModuleDescriptionParser
# )
#ENDIF(ModuleDescriptionParser_SOURCE_DIR)
UTILITY_SOURCE(GENERATECLP_EXE GenerateCLP ./ GenerateCLP.cxx)
IF (NOT GENERATECLP_EXE)
FIND_PROGRAM(GENERATECLP_EXE GenerateCLP PATHS ${GenerateCLP_BINARY_DIR} DOC "GenerateCLP executable")
MESSAGE(ERROR " Requires GenerateCLP executable. Please specify its location.")
ENDIF (NOT GENERATECLP_EXE)
# create the .clp files
# usage: GENERATE_CLP(foo_SRCS XML_FILE [LOGO_FILE])
MACRO(GENERATECLP SOURCES)
# what is the filename without the extension
GET_FILENAME_COMPONENT(TMP_FILENAME ${ARGV1} NAME_WE)
# the input file might be full path so handle that
GET_FILENAME_COMPONENT(TMP_FILEPATH ${ARGV1} PATH)
......
......@@ -17,5 +17,7 @@ ADD_TEST(Parser1Test1 ${EXECUTABLE_OUTPUT_PATH}/Parser1Test ${TEST_DATA}/ParserT
ADD_TEST(Parser1Test2 ${EXECUTABLE_OUTPUT_PATH}/Parser1Test ${TEST_DATA}/ParserTest2.xml)
IF(Slicer3_BINARY_DIR)
ADD_TEST(ModuleFactoryTest ${EXECUTABLE_OUTPUT_PATH}/ModuleFactoryTest ${Slicer3_BINARY_DIR}/${SLICER_INSTALL_LIBRARIES_DIR}/Plugins/)
ENDIF(Slicer3_BINARY_DIR)
PROJECT (EMSegmentCommandLineExecutable)
INCLUDE(${Slicer3_SOURCE_DIR}/Libs/GenerateCLP/UseGenerateCLP.cmake)
FIND_PACKAGE(GenerateCLP REQUIRED)
IF(GenerateCLP_FOUND)
INCLUDE(${GenerateCLP_USE_FILE})
ENDIF(GenerateCLP_FOUND)
INCLUDE_DIRECTORIES (
${EMSegment_SOURCE_DIR}
......
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