-
-
Notifications
You must be signed in to change notification settings - Fork 404
Expand file tree
/
Copy pathANTS.cmake
More file actions
247 lines (214 loc) · 8.8 KB
/
Copy pathANTS.cmake
File metadata and controls
247 lines (214 loc) · 8.8 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
configure_file(${CMAKE_CURRENT_LIST_DIR}/CTestCustom.cmake
${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake COPYONLY)
set(CMAKE_MODULE_PATH
${${PROJECT_NAME}_SOURCE_DIR}/CMake
${${PROJECT_NAME}_BINARY_DIR}/CMake
${CMAKE_MODULE_PATH}
)
set (CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
#-----------------------------------------------------------------------------
# Version information
option( ${PROJECT_NAME}_BUILD_DISTRIBUTE "Remove '-g#####' from version. ( for official distribution only )" OFF )
mark_as_advanced( ${PROJECT_NAME}_BUILD_DISTRIBUTE )
include(Version.cmake)
#-----------------------------------------------------------------------------
# CPACK Version
#
set(CPACK_PACKAGE_NAME "ANTs")
set(CPACK_PACKAGE_VENDOR "CMake.org")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ANTs - Advanced Normalization Tools")
set(CPACK_PACKAGE_VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${${PROJECT_NAME}_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${${PROJECT_NAME}_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "ANTS_Install")
set(CPACK_BINARY_GENERATORS "DragNDrop TGZ TZ")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ANTs - robust image registration, segmentation and more")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/ANTSCopyright.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
message(STATUS "Building ${PROJECT_NAME} version \"${${PROJECT_NAME}_VERSION}\"")
# When TractographyTRX is enabled, the installed ITKTargets.cmake exports a
# 'trx' imported target with INTERFACE_LINK_LIBRARIES referencing libzip::zip.
# find_package(libzip) must be called before find_package(ITK) to make that
# target available; otherwise CMake errors during ITK target import.
if(USE_TractographyTRX)
find_package(libzip QUIET)
endif()
# Set up ITK
find_package(ITK ${ITK_VERSION_ID} REQUIRED)
include(${ITK_USE_FILE})
# Set up which ANTs apps to build
option(BUILD_ALL_ANTS_APPS "Use All ANTs Apps" ON)
# -------------------------------------------------------------------------
# Install options
# -------------------------------------------------------------------------
option(ANTS_INSTALL_BIN_ONLY "Install only ANTs executables + scripts (bin/). Requires BUILD_SHARED_LIBS=OFF." OFF)
mark_as_advanced(ANTS_INSTALL_BIN_ONLY)
if(ANTS_INSTALL_BIN_ONLY AND ANTS_INSTALL_LIBS_ONLY)
message(FATAL_ERROR "ANTS_INSTALL_BIN_ONLY and ANTS_INSTALL_LIBS_ONLY are mutually exclusive.")
endif()
if(ANTS_INSTALL_BIN_ONLY AND BUILD_SHARED_LIBS)
message(FATAL_ERROR "ANTS_INSTALL_BIN_ONLY requires BUILD_SHARED_LIBS=OFF (static build).")
endif()
# Set up VTK
option(USE_VTK "Use VTK Libraries" OFF)
if(USE_VTK)
find_package(VTK 9.1 REQUIRED
COMPONENTS
CommonCore
CommonDataModel
FiltersExtraction
FiltersModeling
ImagingGeneral
ImagingStencil
IOGeometry
IOLegacy
IOPLY
IOXML
RenderingAnnotation
RenderingCore
RenderingOpenGL2
RenderingVolumeOpenGL2
InteractionStyle
)
if(NOT VTK_FOUND)
message("Cannot build some programs without VTK. Please set VTK_DIR if you need these programs.")
endif()
endif()
# With MS compilers on Win64, we need the /bigobj switch, else generated
# code results in objects with number of sections exceeding object file
# format.
# see http://msdn.microsoft.com/en-us/library/ms173499.aspx
if(CMAKE_CL_64 OR MSVC)
add_definitions(/bigobj)
endif()
option(ITK_USE_FFTWD "Use double precision fftw if found" OFF)
option(ITK_USE_FFTWF "Use single precision fftw if found" OFF)
option(ITK_USE_SYSTEM_FFTW "Use an installed version of fftw" OFF)
if (ITK_USE_FFTWD OR ITK_USE_FFTWF)
if(ITK_USE_SYSTEM_FFTW)
find_package( FFTW )
link_directories(${FFTW_LIBDIR})
else()
link_directories(${ITK_DIR}/fftw/lib)
include_directories(${ITK_DIR}/fftw/include)
endif()
endif()
# These are configure time options that specify which
# subset of tests should be run
option(RUN_SHORT_TESTS "Run the quick unit tests." ON )
option(RUN_LONG_TESTS "Run the time consuming tests. i.e. real world registrations" OFF )
option(OLD_BASELINE_TESTS "Use reported metrics from old tests" OFF )
#-----------------------------------------------------------------------------
include(CTest)
enable_testing()
#Set the global max TIMEOUT for CTest jobs. This is very large for the moment
#and should be revisted to reduce based on "LONG/SHORT" test times, set to 1 hr for now
set(CTEST_TEST_TIMEOUT 1800 CACHE STRING "Maximum seconds allowed before CTest will kill the test." FORCE)
set(DART_TESTING_TIMEOUT ${CTEST_TEST_TIMEOUT} CACHE STRING "Maximum seconds allowed before CTest will kill the test." FORCE)
configure_file(${CMAKE_CURRENT_LIST_DIR}/CTestCustom.cmake
${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake COPYONLY)
include_directories( ${BOOST_INCLUDE_DIR} ) #Define where to find Boost includes
link_directories( ${ITK_LIBRARY_PATH} )
# message("${ITK_LIBRARIES}")
#----------------------------------------------------------------------------
# Setup ants build environment
set(PICSL_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/Utilities
${CMAKE_CURRENT_SOURCE_DIR}/ImageRegistration
${CMAKE_CURRENT_SOURCE_DIR}/ImageSegmentation
# ${CMAKE_CURRENT_SOURCE_DIR}/GraphTheory
${CMAKE_CURRENT_SOURCE_DIR}/Tensor
${CMAKE_CURRENT_SOURCE_DIR}/Temporary
${CMAKE_CURRENT_SOURCE_DIR}/Examples
${CMAKE_CURRENT_BINARY_DIR}
)
include_directories(${PICSL_INCLUDE_DIRS})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ANTsVersionConfig.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/ANTsVersionConfig.h" @ONLY IMMEDIATE)
add_subdirectory(Examples)
if (NOT ANTS_INSTALL_LIBS_ONLY)
install(PROGRAMS Scripts/ANTSpexec.sh
Scripts/antsASLProcessing.sh
Scripts/antsAtroposN4.sh
Scripts/antsBOLDNetworkAnalysis.R
Scripts/antsBrainExtraction.sh
Scripts/antsCorticalThickness.sh
Scripts/antsIntermodalityIntrasubject.sh
Scripts/antsIntroduction.sh
Scripts/antsLaplacianBoundaryCondition.R
Scripts/antsLongitudinalCorticalThickness.sh
Scripts/antsJointLabelFusion.sh
Scripts/antsMultivariateTemplateConstruction.sh
Scripts/antsMultivariateTemplateConstruction2.sh
Scripts/antsNetworkAnalysis.R
Scripts/antsNeuroimagingBattery
Scripts/antsRegistrationSyN.sh
Scripts/antsRegistrationSyNQuick.sh
Scripts/waitForPBSQJobs.pl
Scripts/waitForSGEQJobs.pl
Scripts/waitForXGridJobs.pl
Scripts/waitForSlurmJobs.pl
DESTINATION bin
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT SCRIPTS
)
endif()
#Only install ITK/VTK libraries if shared build and superbuild is used
if(BUILD_SHARED_LIBS AND ((NOT USE_SYSTEM_ITK) OR ((NOT USE_SYSTEM_VTK) AND USE_VTK)))
install(DIRECTORY ${CMAKE_BINARY_DIR}/../staging/${CMAKE_INSTALL_LIBDIR}/
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT ANTS_INSTALL_BIN_ONLY)
# Single source of truth for the public-header subdirs; also substituted
# into ANTSConfig.cmake.in to build the legacy ANTS_INCLUDE_DIRS list.
set(ANTS_PUBLIC_HEADER_DIRS
Examples
Utilities
ImageRegistration
ImageSegmentation
Tensor
Temporary
)
foreach(_d IN LISTS ANTS_PUBLIC_HEADER_DIRS)
install(DIRECTORY "${${PROJECT_NAME}_SOURCE_DIR}/${_d}/"
DESTINATION "include/ANTs/${_d}"
COMPONENT DEVELOPMENT_antsUtilities
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hxx"
PATTERN "*.txx"
)
endforeach()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ANTsVersionConfig.h"
DESTINATION "include/ANTs"
COMPONENT DEVELOPMENT_antsUtilities
)
endif()
if(NOT ANTS_INSTALL_BIN_ONLY)
include(CMakePackageConfigHelpers)
set(ANTS_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/ANTS")
export(EXPORT ANTSTargets
NAMESPACE ANTS::
FILE "${CMAKE_CURRENT_BINARY_DIR}/ANTSTargets.cmake")
install(EXPORT ANTSTargets
NAMESPACE ANTS::
FILE ANTSTargets.cmake
DESTINATION "${ANTS_CONFIG_INSTALL_DIR}"
COMPONENT DEVELOPMENT_antsUtilities)
configure_package_config_file(
"${${PROJECT_NAME}_SOURCE_DIR}/CMake/ANTSConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/ANTSConfig.cmake"
INSTALL_DESTINATION "${ANTS_CONFIG_INSTALL_DIR}")
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/ANTSConfigVersion.cmake"
VERSION "${${PROJECT_NAME}_VERSION}"
COMPATIBILITY SameMajorVersion)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/ANTSConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/ANTSConfigVersion.cmake"
DESTINATION "${ANTS_CONFIG_INSTALL_DIR}"
COMPONENT DEVELOPMENT_antsUtilities)
endif()