forked from BRAINSia/BRAINSStandAlone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BRAINSTools.cmake
124 lines (105 loc) · 4.18 KB
/
BRAINSTools.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
#-----------------------------------------------------------------------------
# Update CMake module path
#------------------------------------------------------------------------------
set(BRAINSCommonLib_BUILDSCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/BRAINSCommonLib/BuildScripts)
set(CMAKE_MODULE_PATH
${BRAINSCommonLib_BUILDSCRIPTS_DIR}
${${PROJECT_NAME}_SOURCE_DIR}/CMake
${${PROJECT_NAME}_BINARY_DIR}/CMake
${CMAKE_MODULE_PATH}
)
#-----------------------------------------------------------------------------
find_package(ITK REQUIRED)
if(Slicer_BUILD_BRAINSTOOLS)
set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1)
endif()
include(${ITK_USE_FILE})
#-----------------------------------------------------------------------------
find_package(SlicerExecutionModel REQUIRED GenerateCLP)
include(${GenerateCLP_USE_FILE})
include(${SlicerExecutionModel_USE_FILE})
include(${SlicerExecutionModel_CMAKE_DIR}/SEMMacroBuildCLI.cmake)
if(USE_ANTS)
# find ANTS includes
include_directories(${ANTS_SOURCE_DIR}/Temporary)
include_directories(${ANTS_SOURCE_DIR}/Utilities)
include_directories(${ANTS_SOURCE_DIR}/Examples)
include_directories(${ANTS_SOURCE_DIR}/ImageRegistration)
link_directories(${BRAINSStandAlone_LIBRARY_PATH})
set(ANTS_LIBS ${ANTS_LIBS} antsUtilities)
endif()
if(USE_ICCDEF OR ITK_USE_FFTWD OR ITK_USE_FFTWF)
set(${PROJECT_NAME}_BUILD_FFTWF_SUPPORT ON)
endif()
#-----------------------------------------------------------------------------
enable_testing()
include(CTest)
#-----------------------------------------------------------------------
# Setup locations to find externally maintained test data.
#-----------------------------------------------------------------------
include(BRAINSToolsExternalData)
set(TestData_DIR ${CMAKE_CURRENT_SOURCE_DIR}/TestData)
#
# choose between using HDF5 or MAT format transform files
set(XFRM_EXT "h5" CACHE STRING "Choose the preferred transform file format")
#-----------------------------------------------------------------------------
# BRAINSCommonLib (Required)
#-----------------------------------------------------------------------------
include(CMakeBRAINS3BuildMacros)
add_subdirectory(BRAINSCommonLib)
set(BRAINSCommonLib_DIR ${CMAKE_CURRENT_BINARY_DIR}/BRAINSCommonLib)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/BRAINSCommonLib
${CMAKE_CURRENT_BINARY_DIR}/BRAINSCommonLib)
#-----------------------------------------------------------------------------
# Define list of module names
#-----------------------------------------------------------------------------
set(brains_modulenames
AutoWorkup
BRAINSFit
BRAINSResample
BRAINSROIAuto
GTRACT
ImageCalculator
BRAINSCut
BRAINSLandmarkInitializer
BRAINSSnapShotWriter
BRAINSDemonWarp ## NOTE: This is off by default, but is valid for both ITKv3/4
## This builds just fine with ITKv3/4, but test cases need
## further review before trusting it.
BRAINSSurfaceTools
ICCDEF
BRAINSContinuousClass
BRAINSImageConvert
BRAINSMush
BRAINSMultiModeSegment
BRAINSInitializedControlPoints
BRAINSTransformConvert
BRAINSConstellationDetector
BRAINSABC
ConvertBetweenFileFormats
DWIConvert
BRAINSCreateLabelMapFromProbabilityMaps
BRAINSMultiSTAPLE
)
if(USE_DebugImageViewer)
list(APPEND brains_modulenames
DebugImageViewer)
endif()
## HACK: This is needed to get DWIConvert to build in installed tree
## KENT: Please remove this line and make DWIConvert build by fixing ITK install of DCMTK
include_directories(${ITK_INSTALL_PREFIX}/install)
#-----------------------------------------------------------------------------
# Add module sub-directory if USE_<MODULENAME> is both defined and true
#-----------------------------------------------------------------------------
foreach(modulename ${brains_modulenames})
# message("DEFINED USE_${modulename} AND ${USE_${modulename}}")
if(DEFINED USE_${modulename} AND USE_${modulename})
# message("Adding ${modulename}")
add_subdirectory(${modulename})
#else()
# message("USE_${modulename} = ${USE_${modulename}}")
endif()
endforeach()
ExternalData_Add_Target( ${PROJECT_NAME}FetchData ) # Name of data management target