Skip to content
Snippets Groups Projects
Commit a881fe86 authored by Kasper Marstal's avatar Kasper Marstal
Browse files

STYLE: ELASTIX-1 Improve build system naming conventions

parent 7aa24c09
No related branches found
No related tags found
No related merge requests found
...@@ -9,4 +9,4 @@ set( CompilerFlags ...@@ -9,4 +9,4 @@ set( CompilerFlags
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_RELWITHDEBINFO
) )
\ No newline at end of file
# Visual Studio complains if paths are too long
string( LENGTH "${CMAKE_CURRENT_SOURCE_DIR}" n ) string( LENGTH "${CMAKE_CURRENT_SOURCE_DIR}" n )
if( n GREATER 50 ) if( n GREATER 50 )
message( message(
......
# GoogleTest needs static linking # GoogleTest needs static linking
include( ${CMAKE_SOURCE_DIR}/CMake/elxCompilerFlags.cmake )
include( elxCompilerFlags.cmake )
foreach( CompilerFlag ${CompilerFlags} ) foreach( CompilerFlag ${CompilerFlags} )
string( REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}" ) string( REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}" )
endforeach() endforeach()
cmake_minimum_required( VERSION 2.8 ) cmake_minimum_required( VERSION 2.8 )
# Include SuperElastix CMake scripts
list( APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/CMake"
)
if( CMAKE_HOST_WIN32 ) if( CMAKE_HOST_WIN32 )
include( elxWinConfig.cmake ) include( elxWinConfig.cmake )
endif() endif()
...@@ -13,7 +18,7 @@ project( Elastix ) ...@@ -13,7 +18,7 @@ project( Elastix )
find_package( ITK REQUIRED ) find_package( ITK REQUIRED )
set( ITK_NO_IO_FACTORY_REGISTER_MANAGER 1 ) set( ITK_NO_IO_FACTORY_REGISTER_MANAGER 1 )
include( ${ITK_USE_FILE} ) include( ${ITK_USE_FILE} )
include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/elxRequiredITKModules.cmake" ) include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/elxITKRequiredModules.cmake" )
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Build Elastix # Build Elastix
...@@ -21,14 +26,16 @@ include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/elxRequiredITKModules.cmake" ) ...@@ -21,14 +26,16 @@ include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/elxRequiredITKModules.cmake" )
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Testing # Testing
# Do not build tests by default since this requires GoogleTest submodule # Build tests by default
# to be initialized. Otherwise users may see FATAL_ERRORs out of the box. option( ELASTIX_BUILD_TESTING "Enable building tests." ON )
# The SuperBuild will correctly initialize the GoogleTest submodule and
# build tests by default. # ExternalData module requires newer CMake versions
option( ELASTIX_BUILD_TESTING "Enable building tests." OFF ) if( CMAKE_VERSION VERSION_LESS 2.8.11 )
set( ELASTIX_BUILD_TESTING OFF FORCE )
message( STATUS "ELASTIX_BUILD_TESTING was set to OFF because CMake version is less than 2.8.11")
endif()
if( ELASTIX_BUILD_TESTING ) if( ELASTIX_BUILD_TESTING )
option( ELASTIX_BUILD_BENCHMARKING "Enable building benchmarks." OFF )
enable_testing() enable_testing()
add_subdirectory( Testing ) add_subdirectory( Testing )
endif() endif()
...@@ -40,5 +47,5 @@ mark_as_advanced( ELASTIX_BUILD_DOXYGEN ) ...@@ -40,5 +47,5 @@ mark_as_advanced( ELASTIX_BUILD_DOXYGEN )
option( ELASTIX_BUILD_DOXYGEN "Enable building Doxygen documentation." OFF ) option( ELASTIX_BUILD_DOXYGEN "Enable building Doxygen documentation." OFF )
mark_as_advanced( ELASTIX_BUILD_READTHEDOCS ) mark_as_advanced( ELASTIX_BUILD_READTHEDOCS )
option( ELASTX_BUILD_READTHEDOCS "Enable building readthedocs.org documentation." OFF ) option( ELASTIX_BUILD_READTHEDOCS "Enable building readthedocs.org documentation." OFF )
cmake_minimum_required( VERSION 2.8 ) cmake_minimum_required( VERSION 2.8 )
#--------------------------------------------------------------------- #---------------------------------------------------------------------
project( elastixSuperBuild ) project( ElastixSuperBuild )
find_package( Git REQUIRED ) find_package( Git REQUIRED )
...@@ -13,6 +13,8 @@ set( CMAKE_MODULE_PATH ...@@ -13,6 +13,8 @@ set( CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH}
) )
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "SuperBuild install directory" FORCE)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Elastix SuperBuild configuration # Elastix SuperBuild configuration
...@@ -30,10 +32,11 @@ option( ELASTIX_BUILD_TESTING "Enable building tests." ON ) ...@@ -30,10 +32,11 @@ option( ELASTIX_BUILD_TESTING "Enable building tests." ON )
if( ELASTIX_BUILD_TESTING ) if( ELASTIX_BUILD_TESTING )
option( ELASTIX_BUILD_BENCHMARKING "Enable building benchmarks." ON ) option( ELASTIX_BUILD_BENCHMARKING "Enable building benchmarks." ON )
option( ELASTIX_BUILD_DASHBOARD "Enable building benchmarks." ON )
endif() endif()
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Build ITK as external project # Build ITK
set( ITK_VERSION_MAJOR "4" ) set( ITK_VERSION_MAJOR "4" )
set( ITK_VERSION_MINOR "7" ) set( ITK_VERSION_MINOR "7" )
...@@ -52,7 +55,7 @@ else() ...@@ -52,7 +55,7 @@ else()
endif() endif()
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Build Elastix as an external project # Build Elastix
include( Elastix ) include( Elastix )
......
...@@ -4,11 +4,11 @@ ExternalProject_Add( ${proj} ...@@ -4,11 +4,11 @@ ExternalProject_Add( ${proj}
DOWNLOAD_COMMAND "" DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/.. SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..
BINARY_DIR ${proj}-build BINARY_DIR ${proj}-build
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CMAKE_ARGS CMAKE_ARGS
--no-warn-unused-cli --no-warn-unused-cli
-DELASTIX_BUILD_TESTING:BOOL=${ELASTIX_BUILD_TESTING} -DELASTIX_BUILD_TESTING:BOOL=${ELASTIX_BUILD_TESTING}
-DELASTIX_BUILD_BENCHMARKING:BOOL=${ELASTIX_BUILD_BENCHMARKING} -DELASTIX_BUILD_BENCHMARKING:BOOL=${ELASTIX_BUILD_BENCHMARKING}
-DELASTIX_BUILD_DASHBOARD:BOOL=${ELASTIX_BUILD_DASHBOARD}
-DITK_DIR:PATH=${ITK_DIR} -DITK_DIR:PATH=${ITK_DIR}
DEPENDS ${ELASTIX_DEPENDENCIES} DEPENDS ${ELASTIX_DEPENDENCIES}
INSTALL_COMMAND "" INSTALL_COMMAND ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment