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

ENH: Build Applications external project with SuperElastixSuperBuildConfig.cmake

parent 1e636253
......@@ -47,6 +47,9 @@ if (OPENMP_FOUND)
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
endif()
find_package( SuperElastixSuperBuild )
include( ${SUPERELASTIXSUPERBUILD_USE_FILE} )
find_package( SuperElastix )
include( ${SUPERELASTIX_USE_FILE} )
......
......@@ -41,7 +41,7 @@ macro( _selxmodules_initialize )
set( SUPERELASTIX_MODULES )
set( SUPERELASTIX_INCLUDE_DIRS )
set( SUPERELASTIX_LIBRARIES )
set( SUPERELASTIX_LIBRARIY_DIRS )
set( SUPERELASTIX_LIBRARY_DIRS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} )
set( SUPERELASTIX_TEST_SOURCE_FILES )
set( SUPERELASTIX_INTERFACE_DIRS )
......
......@@ -90,13 +90,19 @@ if( NOT CMAKE_BUILD_TYPE )
endif()
# ---------------------------------------------------------------------
# Load SuperBuild settings. Use all system libraries by setting
# USE_SYSTEM_DEPENDENCIES to ON, or use individual system libraries by
# setting USE_SYSTEM_DEPENDENCIES to OFF _and_ USE_SYSTEM_ITK to ON,
# Use SuperBuild.
# The SuperBuild is typically used to build dependencies. Should
# you wish to build them yourself (e.g. if you need a specific
# version of ITK), set USE_SUPERBUILD to OFF _and_ USE_SYSTEM_ITK to ON,
# USE_SYSTEM_BOOST to ON, USE_SYSTEM_GTEST to ON or USE_SYSTEM_ELASTIX
# to ON.
# to ON. The find_package() command will then load your system libraries
# instead.
option( USE_SUPERBUILD "Use dependencies built by SuperBuild." ON )
mark_as_advanced( USE_SUPERBUILD )
if( NOT USE_SYSTEM_DEPENDENCIES )
if( USE_SUPERBUILD )
find_package( SuperElastixSuperBuild REQUIRED )
include( ${SUPERELASTIXSUPERBUILD_USE_FILE} )
endif()
......@@ -113,6 +119,8 @@ include( ${ITK_USE_FILE} )
set( Boost_USE_STATIC_LIBS ON ) # only find static libs
set( Boost_USE_MULTITHREADED ON )
set( Boost_USE_STATIC_RUNTIME OFF )
# TODO: These are hardcoded for the SuperBuild
set( BOOST_INCLUDEDIR "${BOOST_ROOT}/BOOST-prefix/src/Boost/boost/" )
set( BOOST_LIBRARYDIR "${BOOST_ROOT}/BOOST-prefix/src/Boost/stage/lib/" )
set( BOOST_ROOT "${BOOST_ROOT}/BOOST-prefix/src/Boost/" )
......@@ -208,30 +216,19 @@ export( PACKAGE SuperElastix )
# Create the SuperElastix.cmake files
# ... for the build tree
set( SUPERELASTIX_INSTALL_INCLUDE_DIRS ${SUPERELASTIX_INCLUDE_DIRS} )
set( SUPERELASTIX_INSTALL_LIBRARY_DIRS ${SUPERELASTIX_LIBRARY_DIRS} )
set( SUPERELASTIX_INSTALL_LIBRARIES ${SUPERELASTIX_LIBRARIES} )
set( SUPERELASTIX_INSTALL_USE_FILE "${PROJECT_BINARY_DIR}/UseSuperElastix.cmake" )
set( SUPERELASTIX_USE_FILE "${PROJECT_BINARY_DIR}/UseSuperElastix.cmake" )
configure_file( SuperElastixConfig.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixConfig.cmake" @ONLY)
configure_file( UseSuperElastix.cmake.in "${SUPERELATIX_USE_FILE}" @ONLY )
configure_file( SuperElastixConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixConfigVersion.cmake" @ONLY)
configure_file( UseSuperElastix.cmake.in "${SUPERELASTIX_USE_FILE}" @ONLY )
# ... for the install tree
set( SUPERELASTIX_INSTALL_INCLUDE_DIRS include )
set( SUPERELASTIX_INSTALL_LIBRARY_DIRS lib )
set( SUPERELASTIX_INSTALL_LIBRARIES ModuleFilter ModuleBlueprints ModuleLogger )
set( SUPERELASTIX_INSTALL_USE_FILE "${CMAKE_INSTALL_DIR}/UseSuperElastix.cmake" )
configure_file( SuperElastixConfig.cmake.in "${PROJECT_BINARY_DIR}/install/SuperElastixConfig.cmake" @ONLY)
configure_file( UseSuperElastix.cmake.in "${PROJECT_BINARY_DIR}/install/UserSuperElastix.cmake" @ONLY )
# Create the SuperElastixVersion.cmake file
configure_file( SuperElastixConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixConfigVersion.cmake" @ONLY)
# Install the SuperElastix.cmake and SuperElastixConfigVersion.cmake
install( FILES
"${PROJECT_BINARY_DIR}/install/SuperElastixConfig.cmake"
"${PROJECT_BINARY_DIR}/SuperElastixConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/install/UserSuperElastix.cmake"
DESTINATION "${CMAKE_INSTALL_DIR}" )
install(CODE "set( SUPERELASTIX_INSTALL_INCLUDE_DIRS include )" )
install(CODE "set( SUPERELASTIX_INSTALL_LIBRARY_DIRS lib )" )
install(CODE "set( SUPERELASTIX_INSTALL_LIBRARIES ModuleFilter ModuleBlueprints ModuleLogger )" )
install(CODE "set( SUPERELASTIX_INSTALL_USE_FILE ${CMAKE_INSTALL_DIR}/UseSuperElastix.cmake )" )
install(CODE "configure_file( SuperElastixConfig.cmake.in ${CMAKE_INSTALL_DIR}/SuperElastixConfig.cmake @ONLY)" )
install(CODE "configure_file( SuperElastixConfigVersion.cmake.in ${CMAKE_INSTALL_DIR}/SuperElastixConfigVersion.cmake @ONLY)" )
install(CODE "configure_file( UseSuperElastix.cmake.in ${SUPERELASTIX_INSTALL_USE_FILE} @ONLY )" )
install( FILES
Modules/Filter/include/selxSuperElastixFilter.h
......
......@@ -30,7 +30,7 @@ enum SeverityType {
DEBUG,
INFO,
WARNING,
ERROR,
// ERROR,
FATAL
};
......
......@@ -141,17 +141,16 @@ else()
set( CMAKE_INSTALL_DIR lib/CMake/SuperElastix )
endif()
set( SUPERELASTIXSUPERBUILD_USE_FILE "${PROJECT_BINARY_DIR}/UseSuperElastixSuperBuild.cmake" )
set( SUPERELASTIXSUPERBUILD_USE_FILE "${PROJECT_BINARY_DIR}/UseSuperElastixSuperBuild.cmake")
configure_file( SuperElastixSuperBuildConfig.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixSuperBuildConfig.cmake" @ONLY)
configure_file( SuperElastixSuperBuildConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixSuperBuildConfigVersion.cmake.in" @ONLY)
configure_file( SuperElastixSuperBuildConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixSuperBuildConfigVersion.cmake" @ONLY)
configure_file( UseSuperElastixSuperBuild.cmake.in "${SUPERELASTIXSUPERBUILD_USE_FILE}" @ONLY )
# TODO: Install to system
# ---------------------------------------------------------------------
# Build SuperElastix
# configure_file( SuperElastixSuperBuildConfig.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixConfig.cmake" @ONLY)
# configure_file( UseSuperElastix.cmake.in "${SUPERELATIX_USE_FILE}" @ONLY )
include( SuperElastix )
# ---------------------------------------------------------------------
......
......@@ -46,8 +46,6 @@ else()
endif()
endif()
set( BOOST_BUILD_DIR "${CMAKE_INSTALL_PREFIX}/${proj}-build/" )
ExternalProject_Add( BOOST
BUILD_IN_SOURCE 1
URL "${BOOST_URL}"
......@@ -58,7 +56,7 @@ ExternalProject_Add( BOOST
INSTALL_COMMAND ""
)
set( BOOST_ROOT "${CMAKE_INSTALL_PREFIX}/${proj}-prefix/src/BOOST" )
set( BOOST_ROOT "${PROJECT_BINARY_DIR}/${proj}-prefix/src/BOOST" )
set( BOOST_LIBRARYDIR "${BOOST_ROOT}/stage/lib/" )
list( APPEND SUPERELASTIX_DEPENDENCIES ${proj} )
......@@ -20,7 +20,7 @@
set( proj Elastix )
set( ELASTIX_GIT_REPOSITORY http://github.com/mstaring/elastix )
set( ELASTIX_GIT_TAG 860faf8f4076060cbb986087a092da9d334f5ff4 )
set( ELASTIX_GIT_TAG fd5cde3060ca4093d4c904ead36b3a0dd2f63360 )
ExternalProject_Add( ${proj}
GIT_REPOSITORY ${ELASTIX_GIT_REPOSITORY}
......
set( SUPERELASTIX_DIR @PROJECT_BINARY_DIR@ )
# Add include directories needed to use SuperElastix
set( SUPERELASTIX_INCLUDE_DIRS @SUPERELASTIX_INSTALL_INCLUDE_DIRS@ )
set( SUPERELASTIX_INCLUDE_DIRS @SUPERELASTIX_INCLUDE_DIRS@ )
# Add list of SuperElastix library directories
set( SUPERELASTIX_LIBRARY_DIRS @SUPERELASTIX_INSTALL_LIBRARY_DIRS@ )
set( SUPERELASTIX_LIBRARY_DIRS @SUPERELASTIX_LIBRARY_DIRS@ )
# Add list of SuperElastix libraries
set( SUPERELASTIX_LIBRARIES @SUPERELASTIX_INSTALL_LIBRARIES@ )
set( SUPERELASTIX_LIBRARIES @SUPERELASTIX_LIBRARIES@ )
# The location of the SuperElastix use-file
set( SUPERELASTIX_USE_FILE @SUPERELASTIX_INSTALL_USE_FILE@)
set( SUPERELASTIX_USE_FILE @SUPERELASTIX_USE_FILE@)
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