Skip to content

Commit

Permalink
ENH: Update SuperBuild process and package extension for SLICER
Browse files Browse the repository at this point in the history
  • Loading branch information
juanprietob committed Aug 14, 2016
1 parent 590f70b commit 2ea5e5b
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 60 deletions.
1 change: 0 additions & 1 deletion CMakeFiles/cmake.check_cache

This file was deleted.

1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ project(${LOCAL_PROJECT_NAME})
#-----------------------------------------------------------------------------
option(${LOCAL_PROJECT_NAME}_SUPERBUILD "Build ${LOCAL_PROJECT_NAME} and the projects it depends on via SuperBuild.cmake." ON)
mark_as_advanced(${LOCAL_PROJECT_NAME}_SUPERBUILD)

#-----------------------------------------------------------------------------
# Superbuild script
#-----------------------------------------------------------------------------
Expand Down
16 changes: 0 additions & 16 deletions Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@
include(CMakeDependentOption)


#Declare DTIPrep extension variables
set(EXTENSION_NAME DTIPrep)
set(EXTENSION_HOMEPAGE "http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/DTIPrep")
set(EXTENSION_CATEGORY "Diffusion")
set(EXTENSION_CONTRIBUTORS "Francois Budin (UNC)")
set(EXTENSION_DESCRIPTION "This extension provides the tool DTIPrep integrated in Slicer")
set(EXTENSION_ICONURL "http://www.nitrc.org/project/screenshot.php?group_id=283&screenshot_id=608")
set(EXTENSION_SCREENSHOTURLS "http://www.nitrc.org/project/screenshot.php?group_id=283&screenshot_id=609 http://www.nitrc.org/project/screenshot.php?group_id=283&screenshot_id=610")
set(EXTENSION_STATUS "Beta")
set(EXTENSION_DEPENDS "DTIProcess" ) # Specified as a space separated list or 'NA' if any
set(EXTENSION_BUILD_SUBDIRECTORY DTIPrepTools-build )





#-----------------------------------------------------------------------------
# Build option(s)
#-----------------------------------------------------------------------------
Expand Down
9 changes: 5 additions & 4 deletions DTIPrepTools.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)

set(MODULE_NAME ${EXTENSION_NAME}) # Do not use 'project()'
set(MODULE_TITLE ${MODULE_NAME})

Expand Down Expand Up @@ -117,8 +119,6 @@ include(${GenerateCLP_USE_FILE})
include(${SlicerExecutionModel_USE_FILE})
include(${SlicerExecutionModel_CMAKE_DIR}/SEMMacroBuildCLI.cmake)

include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)

if(USE_ANTS)
# find ANTS includes
message("ANTs_SOURCE_DIR=${ANTs_SOURCE_DIR}")
Expand Down Expand Up @@ -194,9 +194,10 @@ if( DTIPrep_BUILD_SLICER_EXTENSION )
set(EXTENSION_CATEGORY "DWI/DTI Quality Control")
set(EXTENSION_CONTRIBUTORS "Joy Matsui, Zhexing Liu, Clement Vachet, David Welch, Guido Gerig, kent williams, Mahshid Farzinfar, Sylvain Gouttard, Vincent Magnotta, Hans Johnson, Martin Styner, Francois Budin, Juan Prieto")
set(EXTENSION_DESCRIPTION "DTIPrep performs a "Study-specific Protocol" based automatic pipeline for DWI/DTI quality control and preparation")
set(EXTENSION_ICONURL "https://www.nitrc.org/project/list_screenshots.php?group_id=283&screenshot_id=216")
set(EXTENSION_ICONURL "http://www.nitrc.org/project/screenshot.php?group_id=283&screenshot_id=608")
set(EXTENSION_SCREENSHOTURLS "http://www.nitrc.org/project/screenshot.php?group_id=283&screenshot_id=609 http://www.nitrc.org/project/screenshot.php?group_id=283&screenshot_id=610")
set(EXTENSION_DEPENDS "NA") # Specified as a space separated list or 'NA' if any
set(EXTENSION_BUILD_SUBDIRECTORY ".")
set(EXTENSION_BUILD_SUBDIRECTORY ".")

unsetForSlicer( NAMES SlicerExecutionModel_DIR ITK_DIR VTK_DIR CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_CXX_FLAGS CMAKE_C_FLAGS ITK_LIBRARIES )
find_package(Slicer REQUIRED)
Expand Down
42 changes: 5 additions & 37 deletions SuperBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,12 @@ enable_testing()
include(CTest)

#-----------------------------------------------------------------------------
include(${CMAKE_CURRENT_SOURCE_DIR}/Common.cmake)

#-----------------------------------------------------------------------------
#If it is build as an extension
#-----------------------------------------------------------------------------
if( DTIPrep_BUILD_SLICER_EXTENSION )
set( EXTERNAL_SOURCE_IN_BINARY_DIR ON)
set( USE_SYSTEM_VTK ON CACHE BOOL "Use system VTK" FORCE )
#VTK_VERSION_MAJOR is define but not a CACHE variable
set( VTK_VERSION_MAJOR ${VTK_VERSION_MAJOR} CACHE STRING "Choose the expected VTK major version to build Slicer (5 or 6).")
set( USE_SYSTEM_DCMTK ON CACHE BOOL "Use system DCMTK" FORCE )
set( USE_SYSTEM_Teem ON CACHE BOOL "Use system Teem" FORCE )
set( BUILD_SHARED_LIBS OFF CACHE BOOL "Use shared libraries" FORCE)
unsetForSlicer(NAMES CMAKE_MODULE_PATH CMAKE_C_COMPILER CMAKE_CXX_COMPILER DCMTK_DIR ITK_DIR SlicerExecutionModel_DIR VTK_DIR QT_QMAKE_EXECUTABLE ITK_VERSION_MAJOR CMAKE_CXX_FLAGS CMAKE_C_FLAGS Teem_DIR)
find_package(Slicer REQUIRED)
unsetAllForSlicerBut( NAMES VTK_DIR QT_QMAKE_EXECUTABLE DCMTK_DIR Teem_DIR )
resetForSlicer(NAMES CMAKE_MODULE_PATH CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_CXX_FLAGS CMAKE_C_FLAGS ITK_DIR SlicerExecutionModel_DIR ITK_VERSION_MAJOR )
if( APPLE )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,@loader_path/../../../../../")
endif()
find_package(Subversion REQUIRED )
else()
set( USE_ITK_Module_MGHIO ON )
set( SUPERBUILD_NOT_EXTENSION TRUE )
option(USE_DTIProcess "Build DTIProcess" ON)
endif()
option(USE_NIRALUtilities "Build NIRALUtilities" ON)

include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)

if( EXTERNAL_SOURCE_IN_BINARY_DIR )
set( EXTERNAL_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
Expand Down Expand Up @@ -133,12 +112,14 @@ option(USE_SYSTEM_Teem "Build using external Teem" OFF)
option(USE_SYSTEM_zlib "Build using external zlib" OFF)
option(USE_ANTs "Build BRAINSTools with ANTs" OFF)
option(${PROJECT_NAME}_BUILD_FFTW_SUPPORT "Build external FFTW" OFF)
option(USE_SYSTEM_DTIProcess "Build using external DTIProcess" OFF)
option(USE_SYSTEM_niral_utilities "Build using external niral_utilities" OFF)
#option(${PROJECT_NAME}_BUILD_DICOM_SUPPORT "Build Dicom Support" ON)

#------------------------------------------------------------------------------
# ${LOCAL_PROJECT_NAME} dependency list
#------------------------------------------------------------------------------
set( ${LOCAL_PROJECT_NAME}_DEPENDENCIES DCMTK ITKv4 SlicerExecutionModel VTK BRAINSTools )
set( ${LOCAL_PROJECT_NAME}_DEPENDENCIES DCMTK ITKv4 SlicerExecutionModel VTK DTIProcess niral_utilities BRAINSTools)
set( ${PROJECT_NAME}_BUILD_DICOM_SUPPORT ON )
set( ${PROJECT_NAME}_BUILD_ZLIB_SUPPORT ON )
if( UNIX )
Expand Down Expand Up @@ -311,17 +292,6 @@ if(verbose)
endforeach()
endif()


if(USE_DTIProcess)
include(${CMAKE_CURRENT_LIST_DIR}/SuperBuild/External_DTIProcess.cmake)
list( APPEND ${LOCAL_PROJECT_NAME}_DEPENDENCIES DTIProcess )
endif()

if(USE_NIRALUtilities)
include(${CMAKE_CURRENT_LIST_DIR}/SuperBuild/External_niral_utilities.cmake)
list( APPEND ${LOCAL_PROJECT_NAME}_DEPENDENCIES niral_utilities )
endif()

#------------------------------------------------------------------------------
# Configure and build
#------------------------------------------------------------------------------
Expand All @@ -338,8 +308,6 @@ ExternalProject_Add(${proj}
${COMMON_EXTERNAL_PROJECT_ARGS}
-D${LOCAL_PROJECT_NAME}_SUPERBUILD:BOOL=OFF
-DBUILD_TESTING:BOOL=${BUILD_TESTING}
-DUSE_NIRALUtilities:BOOL=${USE_NIRALUtilities}
-DUSE_DTIProcess:BOOL=${USE_DTIProcess}
INSTALL_COMMAND ""
)

Expand Down
73 changes: 72 additions & 1 deletion SuperBuild/External_BRAINSTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,77 @@ if(NOT ( DEFINED "${extProjName}_SOURCE_DIR" OR ( DEFINED "USE_SYSTEM_${extProjN
# Set CMake OSX variable to pass down the external project
set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
if(APPLE)
#This code was taken from BRAINSTools, for some reason is not working when doing the superbuild but if done here it works
# Waiting universal binaries are supported and tested, complain if
# multiple architectures are specified.
if(NOT "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
if(arch_count GREATER 1)
message(FATAL_ERROR "error: Only one value (i386 or x86_64) should be associated with CMAKE_OSX_ARCHITECTURES.")
endif()
endif()

# See CMake/Modules/Platform/Darwin.cmake)
# 8.x == Mac OSX 10.4 (Tiger)
# 9.x == Mac OSX 10.5 (Leopard)
# 10.x == Mac OSX 10.6 (Snow Leopard)
# 11.x == Mac OSX 10.7 (Lion)
# 12.x == Mac OSX 10.8 (Mountain Lion)
# 13.x == Mac OSX 10.9 (Mavericks)
# 14.x == Mac OSX 10.10 (Yosemite)
set(OSX_SDK_104_NAME "Tiger")
set(OSX_SDK_105_NAME "Leopard")
set(OSX_SDK_106_NAME "Snow Leopard")
set(OSX_SDK_107_NAME "Lion")
set(OSX_SDK_108_NAME "Mountain Lion")
set(OSX_SDK_109_NAME "Mavericks")
set(OSX_SDK_1010_NAME "Yosemite")
set(OSX_SDK_1011_NAME "El Capitan")

set(OSX_SDK_ROOTS
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
/Developer/SDKs
)

# Explicitly set the OSX_SYSROOT to the latest one, as its required
# when the SX_DEPLOYMENT_TARGET is explicitly set
foreach(SDK_ROOT ${OSX_SDK_ROOTS})
if( "x${CMAKE_OSX_SYSROOT}x" STREQUAL "xx")
file(GLOB SDK_SYSROOTS "${SDK_ROOT}/MacOSX*.sdk")

if(NOT "x${SDK_SYSROOTS}x" STREQUAL "xx")
set(SDK_SYSROOT_NEWEST "")
set(CMAKE_OSX_DEPLOYMENT_TARGET "0")
# find the latest SDK
foreach(SDK_ROOT_I ${SDK_SYSROOTS})
# extract version from SDK
string(REGEX MATCH "MacOSX([0-9]+\\.[0-9]+)\\.sdk" _match "${SDK_ROOT_I}")
if("${CMAKE_MATCH_1}" VERSION_GREATER "${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(SDK_SYSROOT_NEWEST "${SDK_ROOT_I}")
set(CMAKE_OSX_DEPLOYMENT_TARGET "${CMAKE_MATCH_1}")
endif()
endforeach()

if(NOT "x${SDK_SYSROOT_NEWEST}x" STREQUAL "xx")
string(REPLACE "." "" sdk_version_no_dot ${CMAKE_OSX_DEPLOYMENT_TARGET})
set(OSX_NAME ${OSX_SDK_${sdk_version_no_dot}_NAME})
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Force build for 64-bit ${OSX_NAME}." FORCE)
set(CMAKE_OSX_SYSROOT "${SDK_SYSROOT_NEWEST}" CACHE PATH "Force build for 64-bit ${OSX_NAME}." FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}" CACHE PATH "Force Deployment Target ${OSX_NAME}." FORCE)
message(STATUS "Setting OSX_ARCHITECTURES to '${CMAKE_OSX_ARCHITECTURES}' as none was specified.")
message(STATUS "Setting OSX_SYSROOT to latest '${CMAKE_OSX_SYSROOT}' as none was specified.")
message(STATUS "Setting OSX_DEPLOYMENT_TARGET to latest '${CMAKE_OSX_DEPLOYMENT_TARGET}' as none was specified.")
endif()
endif()
endif()
endforeach()

if(NOT "${CMAKE_OSX_SYSROOT}" STREQUAL "")
if(NOT EXISTS "${CMAKE_OSX_SYSROOT}")
message(FATAL_ERROR "error: CMAKE_OSX_SYSROOT='${CMAKE_OSX_SYSROOT}' does not exist")
endif()
endif()

list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
Expand Down Expand Up @@ -167,7 +238,7 @@ if(NOT ( DEFINED "${extProjName}_SOURCE_DIR" OR ( DEFINED "USE_SYSTEM_${extProjN

### --- End Project specific additions
set(${proj}_REPOSITORY "${git_protocol}://github.com/BRAINSia/BRAINSTools.git")
set(${proj}_GIT_TAG 98fe1ad2b9297e444d662d09dc83a9409fcf520a )
set(${proj}_GIT_TAG b0b4a0950b9cfa3abb7c6dd7f8314d15f2aa2a21 )
ExternalProject_Add(${proj}
GIT_REPOSITORY ${${proj}_REPOSITORY}
GIT_TAG ${${proj}_GIT_TAG}
Expand Down
3 changes: 3 additions & 0 deletions SuperBuild/External_DTIProcess.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ if(NOT ( DEFINED "USE_SYSTEM_${extProjName}" AND "${USE_SYSTEM_${extProjName}}"
-DUSE_SYSTEM_ITK:BOOL=ON
-DUSE_SYSTEM_VTK:BOOL=ON
-DUSE_SYSTEM_SlicerExecutionModel:BOOL=ON
-DITK_DIR=${ITK_DIR}
-DVTK_DIR=${VTK_DIR}
-DSlicerExecutionModel_DIR=${SlicerExecutionModel_DIR}
-DDTIProcess_SUPERBUILD:BOOL=OFF
-DEXECUTABLES_ONLY:BOOL=ON
-DSubversion_SVN_EXECUTABLE:PATH=${SVNCOMMAND}
Expand Down
2 changes: 2 additions & 0 deletions SuperBuild/External_niral_utilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ if(NOT ( DEFINED "USE_SYSTEM_${extProjName}" AND "${USE_SYSTEM_${extProjName}}"
-DUSE_SYSTEM_SlicerExecutionModel:BOOL=ON
-DUSE_SYSTEM_ITK:BOOL=ON
-DUSE_SYSTEM_VTK:BOOL=ON
-DITK_DIR=${ITK_DIR}
-DVTK_DIR=${VTK_DIR}
-DITK_VERSION_MAJOR:STRING=${ITK_VERSION_MAJOR}
)

Expand Down

0 comments on commit 2ea5e5b

Please sign in to comment.