forked from medInria/TTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
365 lines (286 loc) · 11.5 KB
/
CMakeLists.txt
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
cmake_minimum_required(VERSION 3.0)
set(CMAKE_MACOSX_RPATH OFF)
set(TTK_VERSION_NUMBER 1.4.0)
mark_as_advanced(TTK_VERSION_NUMBER)
project(TTK VERSION ${TTK_VERSION_NUMBER})
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
# warnings
IF(WIN32)
IF(NOT BORLAND)
IF(NOT CYGWIN)
IF(NOT MINGW)
IF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
ADD_DEFINITIONS(
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
-D_CRT_IS_WCTYPE_NO_DEPRECATE
-D_CRT_MANAGED_FP_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE_GLOBALS
-D_CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE
-D_CRT_TIME_FUNCTIONS_NO_DEPRECATE
-D_CRT_VCCLRIT_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
)
ENDIF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
ENDIF(NOT MINGW)
ENDIF(NOT CYGWIN)
ENDIF(NOT BORLAND)
ENDIF(WIN32)
set(${PROJECT_NAME}_VERSION_MAJOR 1 CACHE STRING "TTK major version number.")
set(${PROJECT_NAME}_VERSION_MINOR 4 CACHE STRING "TTK minor version number.")
set(${PROJECT_NAME}_VERSION_BUILD 0 CACHE STRING "TTK build version number.")
set(${PROJECT_NAME}_VERSION
"${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_BUILD}")
mark_as_advanced(${PROJECT_NAME}_VERSION_MAJOR)
mark_as_advanced(${PROJECT_NAME}_VERSION_MINOR)
mark_as_advanced(${PROJECT_NAME}_VERSION_BUILD)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake)
## #################################################################
## Configure path
## #################################################################
set(${PROJECT_NAME}_ARCHIVE_OUTPUT_DIRECTORY lib)
set(${PROJECT_NAME}_RUNTIME_OUTPUT_DIRECTORY bin)
set(${PROJECT_NAME}_LIBRARY_OUTPUT_DIRECTORY lib)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${${PROJECT_NAME}_LIBRARY_OUTPUT_DIRECTORY})
set(ARCHIVE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${${PROJECT_NAME}_ARCHIVE_OUTPUT_DIRECTORY})
set(RUNTIME_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${${PROJECT_NAME}_RUNTIME_OUTPUT_DIRECTORY})
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${${PROJECT_NAME}_RUNTIME_OUTPUT_DIRECTORY})
set(LIBRARY_INSTALL_OUTPUT_PATH ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_LIBRARY_OUTPUT_DIRECTORY})
set(ARCHIVE_INSTALL_OUTPUT_PATH ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_ARCHIVE_OUTPUT_DIRECTORY})
set(RUNTIME_INSTALL_OUTPUT_PATH ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_RUNTIME_OUTPUT_DIRECTORY})
set(EXECUTABLE_INSTALL_OUTPUT_PATH ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_RUNTIME_OUTPUT_DIRECTORY})
# -------------------------------------------------------------------------------------
# Setup installation settings
# -------------------------------------------------------------------------------------
set(${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT 0 CACHE BOOL "Do not install development")
set(${PROJECT_NAME}_INSTALL_NO_RUNTIME 0 CACHE BOOL "Do not install runtime")
set(${PROJECT_NAME}_INSTALL_NO_LIBRARIES)
if(${PROJECT_NAME}_BUILD_SHARED_LIBS)
if(${PROJECT_NAME}_INSTALL_NO_RUNTIME AND ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
set(${PROJECT_NAME}_INSTALL_NO_LIBRARIES 1)
endif(${PROJECT_NAME}_INSTALL_NO_RUNTIME AND ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
else(${PROJECT_NAME}_BUILD_SHARED_LIBS)
if(${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
set(${PROJECT_NAME}_INSTALL_NO_LIBRARIES 1)
else(${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
set(${PROJECT_NAME}_INSTALL_NO_LIBRARIES 0)
endif(${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
endif(${PROJECT_NAME}_BUILD_SHARED_LIBS)
mark_as_advanced(${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT
${PROJECT_NAME}_INSTALL_NO_RUNTIME
${PROJECT_NAME}_INSTALL_NO_LIBRARIES
)
## #################################################################
## Required dependencies
## #################################################################
find_package(ITK REQUIRED)
find_package(VTK REQUIRED)
## ###################################################################
## Some packages options are required for this project. Check them now
## ###################################################################
set(_ITKVersionString "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}" )
math(EXPR _ITKVersionNum "${ITK_VERSION_MAJOR}*100*100 + ${ITK_VERSION_MINOR}*100 + ${ITK_VERSION_PATCH}")
if( _ITKVersionNum LESS 41300 )
message(SEND_ERROR "The ITK version you want to use (${_ITKVersionString}) is not supported by this project. Please use a more recent version of ITK. The minimum required version is 4.13.0. The recommended version is 4.13.0.")
endif()
SET(ITKIO_LIBRARIES
ITKIOImageBase
ITKIOBMP
ITKIOBruker
ITKIOLSM
ITKIOJPEG
ITKIOPNG
ITKIOVTK
ITKIOGDCM
ITKIOGE
ITKIOMINC
ITKNrrdIO
ITKIONRRD
ITKIOMeta
ITKIONIFTI
ITKIOGIPL
ITKIOHDF5
ITKIOBioRad
ITKIOStimulate
ITKIOMRC
ITKIOTIFF
${ITKIOPhilipsREC_LIBRARIES}
)
set(ITK_TRANSFORM_LIBRARIES
ITKIOTransformBase
ITKIOTransformInsightLegacy
ITKIOTransformHDF5
ITKIOTransformMatlab
)
## #################################################################
## Options
## #################################################################
option(TTK_USE_GMM OFF "Use GMM to build registration (tensor demons, log domain tensor demons) module")
option(TTK_USE_MKL OFF "Use MKL to solve eigensystems")
option(TTK_USE_ACML OFF "Use ACML to solve eigensystems")
option(TTK_USE_MIPS OFF "Use MIPS and make TTK compatible with inrimage file format (discouraged)")
option(TTK_USE_VTKINRIA3D OFF "Use vtkINRIA3D and make TTK compatible with GIS file format")
if (TTK_USE_GMM)
find_path(GMM_INCLUDE_DIR gmm/gmm.h)
endif(TTK_USE_GMM)
if (TTK_USE_MKL
AND TTK_USE_ACML)
message(FATAL_ERROR "Both TTK_USE_MKL and TTK_USE_ACML are set to ON, only one can be used at the same time")
endif (TTK_USE_MKL
AND TTK_USE_ACML)
set(TTK_LAPACK_LIBRARIES
)
if (TTK_USE_MKL)
find_package(MKL REQUIRED)
set(TTK_LAPACK_LIBRARIES
${MKL_LIBRARIES}
)
endif(TTK_USE_MKL)
if (TTK_USE_ACML)
find_package(ACML REQUIRED)
set(TTK_LAPACK_LIBRARIES
${ACML_LIBRARY}
)
endif(TTK_USE_ACML)
set(TTK_MIPS_LIBRARIES
)
if(TTK_USE_MIPS)
find_package(MIPS REQUIRED)
include(${MIPS_USE_FILE})
set(TTK_MIPS_LIBRARIES
mipsItkImageIO
InrimageNG
LinearAlgebra
Basics
mipsZ)
endif(TTK_USE_MIPS)
set(TTK_VTKINRIA3D_LIBRARIES
)
if(TTK_USE_VTKINRIA3D)
find_package(vtkINRIA3D REQUIRED)
include(${vtkINRIA3D_USE_FILE})
set(TTK_VTKINRIA3D_LIBRARIES
itkIOAddOn
vtkImaging
vtkVisuManagement
vtkGraphics
)
endif(TTK_USE_VTKINRIA3D)
# -----------------------------------------------------------------------------
# Header file used to pass CMake settings to the source code
# -----------------------------------------------------------------------------
configure_file(${PROJECT_SOURCE_DIR}/ttkConfigure.h.in
${PROJECT_BINARY_DIR}/ttkConfigure.h)
if(NOT ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
install(FILES ${TTK_BINARY_DIR}/ttkConfigure.h
DESTINATION include)
endif(NOT ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
set(TTK_REQUIRED_C_FLAGS)
set(TTK_REQUIRED_CXX_FLAGS)
include(${TTK_SOURCE_DIR}/ttkIncludeDirectories.cmake)
include_directories(
${TTK_INCLUDE_DIRS_BUILD_TREE}
${TTK_INCLUDE_DIRS_SYSTEM}
)
add_subdirectory(IPF)
find_package(IPF)
include(${IPF_USE_FILE})
include(${ITK_USE_FILE})
include(${VTK_USE_FILE})
set(TTK_BUILD_TYPE
STATIC
)
if (NOT WIN32)
if (ITK_BUILD_SHARED)
set (TTK_BUILD_TYPE SHARED)
endif (ITK_BUILD_SHARED)
endif (NOT WIN32)
# set TTK_DIR so it can be used by subprojects
SET(TTK_DIR "${PROJECT_BINARY_DIR}" CACHE INTERNAL "TTK_DIR variable to be used by subprojects")
#-----------------------------------------------------------------------------
# Help other projects use TTK.
CONFIGURE_FILE(${TTK_SOURCE_DIR}/UseTTK.cmake.in
${TTK_BINARY_DIR}/UseTTK.cmake COPYONLY IMMEDIATE)
# Create the TTKConfig.cmake file containing the TTK configuration.
INCLUDE (${TTK_SOURCE_DIR}/ttkGenerateTTKConfig.cmake)
if(NOT ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
INSTALL(FILES
${TTK_BINARY_DIR}/UseTTK.cmake
${TTK_BINARY_DIR}/Utilities/TTKConfig.cmake
DESTINATION lib
)
endif(NOT ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
#-----------------------------------------------------------------------------
# Set any extra compilation flags here
if(CMAKE_COMPILER_IS_GNUCXX)
# Add some useful warning flags
# Note: -Wall and -Wno-deprecated are already pulled in by
# UseITK.cmake
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
endif(CMAKE_COMPILER_IS_GNUCXX)
#-----------------------------------------------------------------------------
# Add compiler flags TTK needs to work on this platform. This must be
# done AFTER the call to CMAKE_EXPORT_BUILD_SETTINGS.
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TTK_REQUIRED_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TTK_REQUIRED_CXX_FLAGS}")
add_subdirectory(Common)
add_subdirectory(Algorithms)
if (TTK_USE_GMM)
add_subdirectory(Registration)
endif (TTK_USE_GMM)
add_subdirectory(Commands)
#-----------------------------------------------------------------------------
# Packing stuff
#-----------------------------------------------------------------------------
if (NOT CPACK_PACKAGE_NAME)
if(NOT ${PROJECT_NAME}_INSTALL_NO_RUNTIME)
if (EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
set (CMAKE_INSTALL_MFC_LIBRARIES 1)
include (InstallRequiredSystemLibraries)
endif (EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
endif(NOT ${PROJECT_NAME}_INSTALL_NO_RUNTIME)
set (CPACK_PACKAGE_NAME ${PROJECT_NAME})
set (CPACK_SOURCE_PACKAGE_FILE_NAME "ttk-${TTK_VERSION}")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Tensor ToolKit")
set (CPACK_PACKAGE_DESCRIPTION ${PROJECT_NAME})
set (CPACK_PACKAGE_VENDOR "INRIA France")
set (CPACK_PACKAGE_CONTACT "Pierre Fillard <pierre.fillard@inria.fr>")
set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
set (CPACK_PACKAGE_VERSION_MAJOR "${TTK_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${TTK_VERSION_MINOR}")
set (CPACK_PACKAGE_VERSION_PATCH "${TTK_VERSION_BUILD}")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "ttk-${TTK_VERSION}")
set (CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
if (${CMAKE_SYSTEM_NAME} MATCHES Windows)
if (CMAKE_CL_64)
set (CPACK_SYSTEM_NAME win64)
else (CMAKE_CL_64)
set (CPACK_SYSTEM_NAME win32)
endif (CMAKE_CL_64)
endif (${CMAKE_SYSTEM_NAME} MATCHES Windows)
set (CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
if (WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly.
# Make sure there is at least one set of four (4) backslashes.
#set (CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake")
#set (CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\CMakeSetup.exe")
set (CPACK_NSIS_DISPLAY_NAME "TTK - The TensorToolKit")
#set (CPACK_NSIS_HELP_LINK "http:\\\\\\\\")
#set (CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\")
set (CPACK_NSIS_MODIFY_PATH ON)
else (WIN32 AND NOT UNIX)
#set (CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest")
#set (CPACK_PACKAGE_EXECUTABLES "")
endif (WIN32 AND NOT UNIX)
include(CPack)
ENDIF(NOT CPACK_PACKAGE_NAME)
#### TESTING stuff ###
enable_testing()
include(CTest)
if( BUILD_TESTING )
add_subdirectory(Testing)
endif( BUILD_TESTING )