-
Notifications
You must be signed in to change notification settings - Fork 22
/
CMakeLists.txt
112 lines (90 loc) · 3.84 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
project(Ultrasound)
cmake_minimum_required(VERSION 3.16.3)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
set(Ultrasound_LIBRARIES Ultrasound)
if(NOT ITK_SOURCE_DIR)
find_package(ITK REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
endif()
option(ITKUltrasound_USE_clFFT "Build ITKUltrasound 1D FFT filters with clFFT as the back-end.\n\
https://github.com/clMathLibraries/clFFT" ${ITK_USE_GPU})
if(ITKUltrasound_USE_clFFT)
find_package(clFFT REQUIRED)
list(APPEND Ultrasound_LIBRARIES ${CLFFT_LIBRARIES})
list(APPEND Ultrasound_SYSTEM_INCLUDE_DIRS ${CLFFT_INCLUDE_DIRS})
get_target_property(Ultrasound_clFFT_LIBRARY_DIRS clFFT LINK_DIRECTORIES)
set(Ultrasound_SYSTEM_LIBRARY_DIRS ${Ultrasound_clFFT_LIBRARY_DIRS})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ITKUltrasound_USE_clFFT)
set(Ultrasound_EXPORT_CODE_INSTALL "
set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES ${CLFFT_INCLUDE_DIRS})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ITKUltrasound_USE_clFFT)
")
set(Ultrasound_EXPORT_CODE_BUILD "
if(NOT ITK_BINARY_DIR)
set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES ${CLFFT_INCLUDE_DIRS})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ITKUltrasound_USE_clFFT)
endif()
")
endif()
# required VTK version
find_package(VTK NO_MODULE QUIET)
set(itkultrasound_use_vtk_default OFF)
if(VTK_FOUND)
set(itkultrasound_use_vtk_default ON)
endif()
option(ITKUltrasound_USE_VTK "Build ITKUltrasound filters that require VTK." ${itkultrasound_use_vtk_default})
mark_as_advanced(ITKUltrasound_USE_VTK)
if(ITKUltrasound_USE_VTK)
find_package(VTK NO_MODULE REQUIRED)
# Add compiler flags needed to use VTK.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${VTK_REQUIRED_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${VTK_REQUIRED_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${VTK_REQUIRED_MODULE_LINKER_FLAGS}")
vtk_module_config(Ultrasound_VTK
vtkCommonDataModel
vtkIOLegacy
)
list(APPEND Ultrasound_LIBRARIES ${VTK_LIBRARIES})
# The VTK DICOMParser and vtkmetaio includes conflict with the ITK
# versions. Here we remove them from the include directories.
#
string(REGEX REPLACE "[^;]*MetaIO;"
"" Ultrasound_VTK_INCLUDE_DIRS "${Ultrasound_VTK_INCLUDE_DIRS}")
string(REGEX REPLACE "[^;]*vtkmetaio;"
"" Ultrasound_VTK_INCLUDE_DIRS "${Ultrasound_VTK_INCLUDE_DIRS}")
string(REGEX REPLACE "[^;]*DICOMParser;"
"" Ultrasound_VTK_INCLUDE_DIRS "${Ultrasound_VTK_INCLUDE_DIRS}")
# Set up the include and library dirs needed for the module
# Use append syntax to avoid overwriting possible clFFT-related content
list(APPEND Ultrasound_SYSTEM_INCLUDE_DIRS ${Ultrasound_VTK_INCLUDE_DIRS})
list(APPEND Ultrasound_SYSTEM_LIBRARY_DIRS ${Ultrasound_VTK_LIBRARY_DIRS})
# Add preprocessor definitions needed to use VTK.
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${Ultrasound_VTK_DEFINITIONS})
set(Ultrasound_EXPORT_CODE_INSTALL "
set(VTK_DIR \"${VTK_DIR}\")
find_package(VTK NO_MODULE REQUIRED)
vtk_module_config(Ultrasound_VTK
vtkCommonDataModel
)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS \${Ultrasound_VTK_DEFINITIONS})
")
set(Ultrasound_EXPORT_CODE_BUILD "
if(NOT ITK_BINARY_DIR)
set(VTK_DIR \"${VTK_DIR}\")
find_package(VTK NO_MODULE REQUIRED)
vtk_module_config(Ultrasound_VTK
vtkCommonDataModel
)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS \${Ultrasound_VTK_DEFINITIONS})
endif()
")
endif() # ITKUltrasound_USE_VTK
if(NOT ITK_SOURCE_DIR)
include(ITKModuleExternal)
else()
itk_module_impl()
endif()