Skip to content

Commit

Permalink
ENH: Superbuild.cmake: Simplify passing of build option to inner proj…
Browse files Browse the repository at this point in the history
…ect.

Simply calling "mark_as_superbuild" after declaring the option is
now sufficient to ensure the value will be passed to inner BRAINSTools
project.
  • Loading branch information
jcfr committed Jun 17, 2016
1 parent c599343 commit 5d27bb8
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 94 deletions.
89 changes: 51 additions & 38 deletions Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,56 +58,69 @@ endif()
#-----------------------------------------------------------------------------
# Build option(s)
#-----------------------------------------------------------------------------
option(USE_AutoWorkup "Build AutoWorkup" ON)
option(USE_ReferenceAtlas "Build the Reference Atlas" ON)

option(USE_ANTS "Build ANTS" ON)

option(USE_BRAINSFit "Build BRAINSFit" ON)
option(USE_BRAINSResample "Build BRAINSResample" ON)
option(USE_BRAINSROIAuto "Build BRAINSROIAuto" ON)
option(USE_DWIConvert "Build DWIConvert" ON)
option(USE_BRAINSLabelStats "Build BRAINSLabelStats" ON)
option(USE_BRAINSStripRotation "Build BRAINSStripRotation" ON)
option(USE_BRAINSTransformConvert "Build BRAINSTransformConvert" ON)
option(USE_BRAINSConstellationDetector "Build BRAINSConstellationDetector" ON)
CMAKE_DEPENDENT_OPTION(USE_BRAINSConstellationDetectorGUI "Build BRAINSConstellationDetectorGUI" OFF "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
option(USE_BRAINSInitializedControlPoints "Build BRAINSInitializedControlPoints" ON)
option(USE_BRAINSLandmarkInitializer "Build BRAINSLandmarkInitializer" ON)
option(USE_ImageCalculator "Build ImageCalculator" ON)
option(USE_ConvertBetweenFileFormats "Build ConvertBetweenFileFormats" ON)
option(USE_BRAINSDWICleanup "Build BRAINSDWICleanup" ON)
option(USE_BRAINSCreateLabelMapFromProbabilityMaps "Build BRAINSCreateLabelMapFromProbabilityMaps" OFF)
option(USE_BRAINSSnapShotWriter "Build BRAINSSnapShotWriter" ON)

# bt_option: Convenience macro allowing to set an option and call mark_as_superbuild.
macro(bt_option name)
option(${name} ${ARGN})
mark_as_superbuild(${name})
endmacro()

# bt_dependent_option: Convenience macro allowing to set a dependent option and mark_as_superbuild.
macro(bt_dependent_option name)
CMAKE_DEPENDENT_OPTION(${name} ${ARGN})
mark_as_superbuild(${name})
endmacro()

bt_option(USE_AutoWorkup "Build AutoWorkup" ON)
bt_option(USE_ReferenceAtlas "Build the Reference Atlas" ON)

bt_option(USE_ANTS "Build ANTS" ON)

bt_option(USE_BRAINSFit "Build BRAINSFit" ON)
bt_option(USE_BRAINSResample "Build BRAINSResample" ON)
bt_option(USE_BRAINSROIAuto "Build BRAINSROIAuto" ON)
bt_option(USE_DWIConvert "Build DWIConvert" ON)
bt_option(USE_BRAINSLabelStats "Build BRAINSLabelStats" ON)
bt_option(USE_BRAINSStripRotation "Build BRAINSStripRotation" ON)
bt_option(USE_BRAINSTransformConvert "Build BRAINSTransformConvert" ON)
bt_option(USE_BRAINSConstellationDetector "Build BRAINSConstellationDetector" ON)
bt_dependent_option(USE_BRAINSConstellationDetectorGUI "Build BRAINSConstellationDetectorGUI" OFF "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
bt_option(USE_BRAINSInitializedControlPoints "Build BRAINSInitializedControlPoints" ON)
bt_option(USE_BRAINSLandmarkInitializer "Build BRAINSLandmarkInitializer" ON)
bt_option(USE_ImageCalculator "Build ImageCalculator" ON)
bt_option(USE_ConvertBetweenFileFormats "Build ConvertBetweenFileFormats" ON)
bt_option(USE_BRAINSDWICleanup "Build BRAINSDWICleanup" ON)
bt_option(USE_BRAINSCreateLabelMapFromProbabilityMaps "Build BRAINSCreateLabelMapFromProbabilityMaps" OFF)
bt_option(USE_BRAINSSnapShotWriter "Build BRAINSSnapShotWriter" ON)

if(CMAKE_CXX_STANDARD LESS 11)
option(USE_BRAINSABC "Build BRAINSABC" OFF)
bt_option(USE_BRAINSABC "Build BRAINSABC" OFF)
else()
option(USE_BRAINSABC "Build BRAINSABC" OFF)
bt_option(USE_BRAINSABC "Build BRAINSABC" OFF)
endif()


## These are no longer needed on a day to day basis
if(NOT BUILD_FOR_DASHBOARD)
set(BUILD_FOR_DASHBOARD OFF)
endif()
option(USE_BRAINSCut "Build BRAINSCut" ${BUILD_FOR_DASHBOARD})
option(USE_BRAINSMultiSTAPLE "Build BRAINSMultiSTAPLE" ${BUILD_FOR_DASHBOARD})
CMAKE_DEPENDENT_OPTION(USE_BRAINSDemonWarp "Build BRAINSDemonWarp " ${BUILD_FOR_DASHBOARD} "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
CMAKE_DEPENDENT_OPTION(USE_GTRACT "Build GTRACT" ${BUILD_FOR_DASHBOARD} "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
option(USE_BRAINSMush "Build BRAINSMush" ${BUILD_FOR_DASHBOARD})
option(USE_BRAINSMultiModeSegment "Build BRAINSMultiModeSegment" ${BUILD_FOR_DASHBOARD})
bt_option(USE_BRAINSCut "Build BRAINSCut" ${BUILD_FOR_DASHBOARD})
bt_option(USE_BRAINSMultiSTAPLE "Build BRAINSMultiSTAPLE" ${BUILD_FOR_DASHBOARD})
bt_dependent_option(USE_BRAINSDemonWarp "Build BRAINSDemonWarp " ${BUILD_FOR_DASHBOARD} "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
bt_dependent_option(USE_GTRACT "Build GTRACT" ${BUILD_FOR_DASHBOARD} "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
bt_option(USE_BRAINSMush "Build BRAINSMush" ${BUILD_FOR_DASHBOARD})
bt_option(USE_BRAINSMultiModeSegment "Build BRAINSMultiModeSegment" ${BUILD_FOR_DASHBOARD})

## These are not yet ready for prime time.
CMAKE_DEPENDENT_OPTION(USE_BRAINSTalairach "Build BRAINSTalairach" ${BUILD_FOR_DASHBOARD} "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
CMAKE_DEPENDENT_OPTION(USE_BRAINSSurfaceTools "Build BRAINSSurfaceTools" ${BUILD_FOR_DASHBOARD} "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
option(USE_BRAINSContinuousClass "Build BRAINSContinuousClass" OFF)
option(USE_ICCDEF "Build ICCDEF " OFF)
option(USE_BRAINSPosteriorToContinuousClass "Build BRAINSPosteriorToContinuousClass" OFF)
CMAKE_DEPENDENT_OPTION(USE_DebugImageViewer "Build DebugImageViewer" OFF "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
option(BRAINS_DEBUG_IMAGE_WRITE "Enable writing out intermediate image results" OFF)

option(USE_TBB "Build TBB as an internal module. This feature is still experimental and unsupported" OFF)
bt_dependent_option(USE_BRAINSTalairach "Build BRAINSTalairach" ${BUILD_FOR_DASHBOARD} "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
bt_dependent_option(USE_BRAINSSurfaceTools "Build BRAINSSurfaceTools" ${BUILD_FOR_DASHBOARD} "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
bt_option(USE_BRAINSContinuousClass "Build BRAINSContinuousClass" OFF)
bt_option(USE_ICCDEF "Build ICCDEF " OFF)
bt_option(USE_BRAINSPosteriorToContinuousClass "Build BRAINSPosteriorToContinuousClass" OFF)
bt_dependent_option(USE_DebugImageViewer "Build DebugImageViewer" OFF "${PRIMARY_PROJECT_NAME}_REQUIRES_VTK" OFF)
bt_option(BRAINS_DEBUG_IMAGE_WRITE "Enable writing out intermediate image results" OFF)

bt_option(USE_TBB "Build TBB as an internal module. This feature is still experimental and unsupported" OFF)
mark_as_advanced(USE_TBB)

if(NOT ${PRIMARY_PROJECT_NAME}_REQUIRES_VTK)
Expand Down
57 changes: 1 addition & 56 deletions SuperBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ set(${LOCAL_PROJECT_NAME}_CLI_ARCHIVE_DESTINATION lib)
set(${LOCAL_PROJECT_NAME}_CLI_INSTALL_RUNTIME_DESTINATION bin)
set(${LOCAL_PROJECT_NAME}_CLI_INSTALL_LIBRARY_DESTINATION lib)
set(${LOCAL_PROJECT_NAME}_CLI_INSTALL_ARCHIVE_DESTINATION lib)

#-----------------------------------------------------------------------------
# Add external project CMake args
#-----------------------------------------------------------------------------
Expand All @@ -299,31 +300,6 @@ mark_as_superbuild(
${LOCAL_PROJECT_NAME}_CLI_INSTALL_ARCHIVE_DESTINATION:PATH
${LOCAL_PROJECT_NAME}_CLI_INSTALL_RUNTIME_DESTINATION:PATH

USE_AutoWorkup:BOOL
USE_GTRACT:BOOL
USE_BRAINSFit:BOOL
USE_BRAINSTalairach:BOOL
USE_BRAINSABC:BOOL
USE_BRAINSCut:BOOL
USE_BRAINSLandmarkInitializer:BOOL
USE_BRAINSMush:BOOL
USE_BRAINSROIAuto:BOOL
USE_BRAINSResample:BOOL
USE_BRAINSConstellationDetector:BOOL
USE_BRAINSDemonWarp:BOOL
USE_BRAINSMultiModeSegment:BOOL
USE_BRAINSInitializedControlPoints:BOOL
USE_BRAINSTransformConvert:BOOL
USE_ConvertBetweenFileFormats:BOOL
USE_ImageCalculator:BOOL
USE_BRAINSSnapShotWriter:BOOL
USE_DebugImageViewer:BOOL
USE_BRAINSSurfaceTools:BOOL
USE_BRAINSContinuousClass:BOOL
USE_BRAINSPosteriorToContinuousClass:BOOL
USE_DWIConvert:BOOL
USE_ICCDEF:BOOL
USE_ANTS:BOOL
BOOST_INCLUDE_DIR:PATH
BRAINS_DEBUG_IMAGE_WRITE:BOOL
INSTALL_RUNTIME_DESTINATION:STRING
Expand Down Expand Up @@ -396,37 +372,6 @@ ExternalProject_Add(${proj}
-DSuperBuild_BRAINSTools_BUILD_DICOM_SUPPORT:BOOL=${SuperBuild_BRAINSTools_BUILD_DICOM_SUPPORT}
-DSuperBuild_BRAINSTools_USE_CTKAPPLAUNCHER:BOOL=${SuperBuild_BRAINSTools_USE_CTKAPPLAUNCHER}
-DSuperBuild_BRAINSTools_USE_GIT_PROTOCOL:BOOL=${SuperBuild_BRAINSTools_USE_GIT_PROTOCOL}
-DUSE_ANTS:BOOL=${USE_ANTS}
-DUSE_AutoWorkup:BOOL=${USE_AutoWorkup}
-DUSE_BRAINSABC:BOOL=${USE_BRAINSABC}
-DUSE_BRAINSConstellationDetector:BOOL=${USE_BRAINSConstellationDetector}
-DUSE_BRAINSContinuousClass:BOOL=${USE_BRAINSContinuousClass}
-DUSE_BRAINSCreateLabelMapFromProbabilityMaps:BOOL=${USE_BRAINSCreateLabelMapFromProbabilityMaps}
-DUSE_BRAINSCut:BOOL=${USE_BRAINSCut}
-DUSE_BRAINSDWICleanup:BOOL=${USE_BRAINSDWICleanup}
-DUSE_BRAINSDemonWarp:BOOL=${USE_BRAINSDemonWarp}
-DUSE_BRAINSFit:BOOL=${USE_BRAINSFit}
-DUSE_BRAINSInitializedControlPoints:BOOL=${USE_BRAINSInitializedControlPoints}
-DUSE_BRAINSLabelStats:BOOL=${USE_BRAINSLabelStats}
-DUSE_BRAINSLandmarkInitializer:BOOL=${USE_BRAINSLandmarkInitializer}
-DUSE_BRAINSMultiModeSegment:BOOL=${USE_BRAINSMultiModeSegment}
-DUSE_BRAINSMultiSTAPLE:BOOL=${USE_BRAINSMultiSTAPLE}
-DUSE_BRAINSMush:BOOL=${USE_BRAINSMush}
-DUSE_BRAINSPosteriorToContinuousClass:BOOL=${USE_BRAINSPosteriorToContinuousClass}
-DUSE_BRAINSROIAuto:BOOL=${USE_BRAINSROIAuto}
-DUSE_BRAINSResample:BOOL=${USE_BRAINSResample}
-DUSE_BRAINSSnapShotWriter:BOOL=${USE_BRAINSSnapShotWriter}
-DUSE_BRAINSStripRotation:BOOL=${USE_BRAINSStripRotation}
-DUSE_BRAINSSurfaceTools:BOOL=${USE_BRAINSSurfaceTools}
-DUSE_BRAINSTalairach:BOOL=${USE_BRAINSTalairach}
-DUSE_BRAINSTransformConvert:BOOL=${USE_BRAINSTransformConvert}
-DUSE_ConvertBetweenFileFormats:BOOL=${USE_ConvertBetweenFileFormats}
-DUSE_DWIConvert:BOOL=${USE_DWIConvert}
-DUSE_DebugImageViewer:BOOL=${USE_DebugImageViewer}
-DUSE_GTRACT:BOOL=${USE_GTRACT}
-DUSE_ICCDEF:BOOL=${USE_ICCDEF}
-DUSE_ImageCalculator:BOOL=${USE_ImageCalculator}
-DUSE_ReferenceAtlas:BOOL=${USE_ReferenceAtlas}
-DUSE_SYSTEM_DCMTK:BOOL=${USE_SYSTEM_DCMTK}
-DUSE_SYSTEM_ITK:BOOL=${USE_SYSTEM_ITK}
-DUSE_SYSTEM_SlicerExecutionModel:BOOL=${USE_SYSTEM_SlicerExecutionModel}
Expand Down

0 comments on commit 5d27bb8

Please sign in to comment.