forked from BRAINSia/BRAINSStandAlone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBRAINSTools.cmake
117 lines (100 loc) · 4.48 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
project(BRAINSTools)
include(${CMAKE_CURRENT_SOURCE_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}
)
#-----------------------------------------------------------------------------
set(expected_ITK_VERSION_MAJOR ${ITK_VERSION_MAJOR})
find_package(ITK REQUIRED)
if(${ITK_VERSION_MAJOR} VERSION_LESS ${expected_ITK_VERSION_MAJOR})
# Note: Since ITKv3 doesn't include a ITKConfigVersion.cmake file, let's check the version
# explicitly instead of passing the version as an argument to find_package() command.
message(FATAL_ERROR "Could not find a configuration file for package \"ITK\" that is compatible "
"with requested version \"${expected_ITK_VERSION_MAJOR}\".\n"
"The following configuration files were considered but not accepted:\n"
" ${ITK_CONFIG}, version: ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}\n")
endif()
include(${ITK_USE_FILE})
#-----------------------------------------------------------------------------
find_package(SlicerExecutionModel REQUIRED GenerateCLP)
include(${GenerateCLP_USE_FILE})
include(${SlicerExecutionModel_USE_FILE})
include(${SlicerExecutionModel_CMAKE_DIR}/SEMMacroBuildCLI.cmake)
#-----------------------------------------------------------------------------
enable_testing()
include(CTest)
#-----------------------------------------------------------------------
# Setup locations to find externally maintained test data.
#-----------------------------------------------------------------------
list(APPEND ExternalData_URL_TEMPLATES
# Local data store populated by the ITK pre-commit hook
"file:///${${PROJECT_NAME}_SOURCE_DIR}/.ExternalData/%(algo)/%(hash)"
# Data published by Iowa Psychiatry web interface
"http://www.psychiatry.uiowa.edu/users/brainstestdata/ctestdata/%(algo)/%(hash)"
# Data published by MIDAS
"http://midas.kitware.com/api/rest/midas.bitstream.by.hash?hash=%(hash)&algorithm=%(algo)"
# Data published by developers using git-gerrit-push.
"http://www.itk.org/files/ExternalData/%(algo)/%(hash)"
)
# Tell ExternalData commands to transform raw files to content links.
# TODO: Condition this feature on presence of our pre-commit hook.
set(ExternalData_LINK_CONTENT MD5)
set(ExternalData_SOURCE_ROOT ${${PROJECT_NAME}_SOURCE_DIR})
include(ExternalData)
set(TestData_DIR ${CMAKE_CURRENT_SOURCE_DIR}/TestData)
#-----------------------------------------------------------------------------
# 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
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.
BRAINSContinuousClass
)
## Tools that only work with ITKv4
if(ITK_VERSION_MAJOR GREATER 3)
list(APPEND brains_modulenames
BRAINSConstellationDetector
BRAINSABC
BRAINSMush
BRAINSMultiModeSegment
BRAINSInitializedControlPoints
BRAINSTransformConvert
)
endif()
if(USE_DebugImageViewer)
list(APPEND brains_modulenames
DebugImageViewer)
endif()
#-----------------------------------------------------------------------------
# Add module sub-directory if USE_<MODULENAME> is both defined and true
#-----------------------------------------------------------------------------
foreach(modulename ${brains_modulenames})
if(DEFINED USE_${modulename} AND USE_${modulename})
add_subdirectory(${modulename})
endif()
endforeach()