Commit 57394347 authored by Kasper Marstal's avatar Kasper Marstal
Browse files

ENH: Move ConfigurationReader to Applications/CommandLineInterface

parent 7cbb01e9
......@@ -19,8 +19,12 @@
set( ${APPLICATION}_TARGET_NAME SuperElastix )
set( ${APPLICATION}_INCLUDE_DIRS
${${APPLICATION}_SOURCE_DIR}/include
)
set( ${APPLICATION}_SOURCE_FILES
${${APPLICATION}_SOURCE_DIR}/src/selxSuperElastix.cxx
${${APPLICATION}_SOURCE_DIR}/src/selxConfigurationReader.cxx
)
set( ${APPLICATION}_LINK_LIBRARIES
......@@ -30,7 +34,11 @@ set( ${APPLICATION}_LINK_LIBRARIES
)
set( ${APPLICATION}_MODULE_DEPENDENCIES
ModuleCore
ModuleFilter
)
set( ${MODULE}_TEST_SOURCE_FILES
${${MODULE}_SOURCE_DIR}/test/selxConfigurationReader.cxx
)
set( ${APPLICATION}_INTEGRATION_TEST_SOURCE_FILES
......
......@@ -28,6 +28,7 @@ file(GLOB COMMANDLINE_HEADER_FILES "${COMMANDLINE_SOURCE_DIR}/*/include/*.*")
set( COMMANDLINE_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/selxSuperElastix.cxx
${CMAKE_CURRENT_SOURCE_DIR}/src/selxConfigurationReader.cxx
)
#set(Boost_DEBUG ON )
......@@ -40,9 +41,10 @@ set(BOOST_INCLUDEDIR ${BOOST_ROOT}/boost )
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/stage/lib)
find_package(Boost COMPONENTS program_options system filesystem REQUIRED QUIET )
include_directories(${Boost_INCLUDE_DIR})
include_directories( ${Boost_INCLUDE_DIR} )
# Compile executable
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/include" )
add_executable( SuperElastix ${COMMANDLINE_SOURCE_FILES} ${COMMANDLINE_HEADER_FILES} )
target_link_libraries( SuperElastix ${SUPERELASTIX_LIBRARIES} ${Boost_LIBRARIES})
......
......@@ -80,37 +80,29 @@ macro( _selxapplication_enable APPLICATION UPSTREAM )
message( STATUS "Enabling ${APPLICATION} requested by ${UPSTREAM}.")
if( NOT ${APPLICATION}_IS_ENABLED )
include( ${${APPLICATION}_CMAKE_FILE} )
set( ${APPLICATION}_IS_ENABLED TRUE )
set( ${APPLICATION}_IS_ENABLED TRUE )
include( ${${APPLICATION}_CMAKE_FILE} )
if( ${APPLICATION}_MODULE_DEPENDENCIES )
_selxmodule_enable_dependencies( ${APPLICATION}_MODULE_DEPENDENCIES ${APPLICATION} )
endif()
if( NOT ${APPLICATION}_TARGET_NAME )
set( ${APPLICATION}_TARGET_NAME ${APPLICATION} )
endif()
# TODO: Add check for source files
add_executable( ${${APPLICATION}_TARGET_NAME} "${${APPLICATION}_HEADER_FILES}" "${${APPLICATION}_SOURCE_FILES}" )
if( ${APPLICATION}_INCLUDE_DIRS )
_selxmodule_include_directories( ${${APPLICATION}_TARGET_NAME} ${APPLICATION} )
include_directories( ${${APPLICATION}_INCLUDE_DIRS} )
endif()
if( ${APPLICATION}_MODULE_DEPENDENCIES )
_selxmodule_enable_dependencies( ${APPLICATION}_MODULE_DEPENDENCIES ${APPLICATION} )
# Include directories
target_include_directories( ${${APPLICATION}_TARGET_NAME} PUBLIC ${${DEPENDENCY}_INCLUDE_DIRS} )
# Link if the dependency is a library (as opposed to header-only)
foreach( DEPENDENCY ${${APPLICATION}_MODULE_DEPENDENCIES} )
if( TARGET ${DEPENDENCY} )
target_link_libraries( ${${APPLICATION}_TARGET_NAME} ${DEPENDENCY} )
endif()
endforeach()
add_executable( ${${APPLICATION}_TARGET_NAME} "${${APPLICATION}_HEADER_FILES}" "${${APPLICATION}_SOURCE_FILES}" )
if( ${APPLICATION}_LINK_LIBRARIES )
target_link_libraries( ${${APPLICATION}_TARGET_NAME} ${${APPLICATION}_LINK_LIBRARIES} )
endif()
if( ${APPLICATION}_LINK_LIBRARIES )
target_link_libraries( ${${APPLICATION}_TARGET_NAME} ${${APPLICATION}_LINK_LIBRARIES} )
if( BUILD_TESTING AND ${MODULE}_TEST_SOURCE_FILES )
list( APPEND SUPERELASTIX_TEST_SOURCE_FILES ${${MODULE}_TEST_SOURCE_FILES} )
endif()
message( STATUS "${APPLICATION} enabled." )
......
......@@ -88,6 +88,10 @@ macro( _selxmodule_enable MODULE UPSTREAM )
set( ${MODULE}_IS_ENABLED TRUE )
include( ${${MODULE}_CMAKE_FILE} )
if( ${MODULE}_MODULE_DEPENDENCIES )
_selxmodule_enable_dependencies( ${MODULE} ${MODULE}_MODULE_DEPENDENCIES )
endif()
if( ${MODULE}_INCLUDE_DIRS )
include_directories( ${${MODULE}_INCLUDE_DIRS} )
list( APPEND SUPERELASTIX_INCLUDE_DIRS ${${MODULE}_INCLUDE_DIRS} )
......@@ -97,10 +101,6 @@ macro( _selxmodule_enable MODULE UPSTREAM )
list( APPEND SUPERELASTIX_TEST_SOURCE_FILES ${${MODULE}_TEST_SOURCE_FILES} )
endif()
if( ${MODULE}_MODULE_DEPENDENCIES )
_selxmodule_enable_dependencies( ${MODULE} ${MODULE}_MODULE_DEPENDENCIES )
endif()
if( ${MODULE}_LIBRARIES )
list( APPEND SUPERELASTIX_LIBRARIES ${${MODULE}_LIBRARIES} )
endif()
......
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