forked from topology-tool-kit/ttk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
185 lines (154 loc) · 4.53 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
cmake_minimum_required(VERSION 3.21) # since paraview 5.10
# The C is required to build with VTK when it has MPI
project(ttk VERSION 1.1 LANGUAGES CXX C)
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "Build in sources is not supported by TTK, please use a separate build folder")
endif()
include(CMakeDependentOption)
# options & dependencies
include(CMake/config.cmake)
# cmake packaging
include(CMake/cpack_config.cmake)
# Use folder as configured by the distribution
include(GNUInstallDirs)
# Base code
# ---------
include(CMake/CompilerFlags.cmake)
include(CMake/BaseCode.cmake)
add_library(baseAll INTERFACE)
add_subdirectory(core)
target_link_libraries(baseAll INTERFACE ${TTK_BASECODES})
install(
TARGETS
baseAll
EXPORT
TTKBaseTargets
RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}/ttk
ARCHIVE DESTINATION
${CMAKE_INSTALL_LIBDIR}/ttk
LIBRARY DESTINATION
${CMAKE_INSTALL_LIBDIR}/ttk
)
install(
EXPORT
TTKBaseTargets
NAMESPACE
ttk::base::
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/ttkBase"
)
configure_file(core/base/TTKBaseConfig.cmake.in TTKBaseConfig.cmake @ONLY)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/TTKBaseConfig.cmake"
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/ttkBase"
)
# generate a TopologyToolKit.h header for the base layer
SET(TTK_HEADER "#pragma once\n\n")
LIST(APPEND TTK_HEADER "// This file has been generated by CMake\n\n")
foreach(module ${TTK_BASECODES})
# get the header name from the module name (capitalize first letter)
STRING(SUBSTRING ${module} 0 1 FIRST_LETTER)
STRING(SUBSTRING ${module} 1 -1 STEM)
STRING(TOUPPER ${FIRST_LETTER} FIRST_LETTER)
STRING(CONCAT module ${FIRST_LETTER} ${STEM})
# specific cases...
if(${module} STREQUAL "Common")
LIST(APPEND TTK_HEADER "#include <CommandLineParser.h>\n")
elseif(${module} STREQUAL "ContourAroundPoint")
LIST(APPEND TTK_HEADER "#include <${module}.hpp>\n")
elseif(${module} STREQUAL "FtmTree")
LIST(APPEND TTK_HEADER "#include <FTMTree.h>\n")
elseif(${module} STREQUAL "FtmTreePP")
LIST(APPEND TTK_HEADER "#include <FTMTreePP.h>\n")
elseif(${module} STREQUAL "FtrGraph")
LIST(APPEND TTK_HEADER "#include <FTRGraph.h>\n")
elseif(${module} STREQUAL "KdTree")
LIST(APPEND TTK_HEADER "#include <KDTree.h>\n")
elseif(${module} STREQUAL "Skeleton")
continue()
elseif(${module} STREQUAL "WebSocketIO")
# avoid the public dependency to websocket++...
continue()
else()
LIST(APPEND TTK_HEADER "#include <${module}.h>\n")
endif()
endforeach()
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/TopologyToolKit.h ${TTK_HEADER})
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/TopologyToolKit.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ttk/base
)
# Paraview plugin
# ---------------
set(VTKWRAPPER_DIR "${CMAKE_CURRENT_LIST_DIR}/core/vtk/")
# VTK Wrappers
# ------------
if(TTK_BUILD_VTK_WRAPPERS)
include(CMake/VTKModule.cmake)
add_library(ttkAll INTERFACE)
add_subdirectory(core/vtk)
target_link_libraries(ttkAll INTERFACE ${TTK_ENABLED_MODULES})
add_dependencies(ttkAll baseAll)
install(
TARGETS
ttkAll
EXPORT
TTKVTKTargets
RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}/ttk
ARCHIVE DESTINATION
${CMAKE_INSTALL_LIBDIR}/ttk
LIBRARY DESTINATION
${CMAKE_INSTALL_LIBDIR}/ttk
)
install(
EXPORT
TTKVTKTargets
NAMESPACE
ttk::vtk::
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/ttkVTK
)
configure_file(core/vtk/TTKVTKConfig.cmake.in TTKVTKConfig.cmake @ONLY)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/TTKVTKConfig.cmake"
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/ttkVTK
)
endif()
if(TTK_BUILD_PARAVIEW_PLUGINS)
include(CMake/ParaViewFilter.cmake)
add_compile_definitions("TTK_BUILD_PARAVIEW_PLUGINS")
# Install location
if(NOT "$ENV{PV_PLUGIN_PATH}" STREQUAL "")
set(TTK_INSTALL_PLUGIN_DIR
$ENV{PV_PLUGIN_PATH}
CACHE
PATH
"Directory where the ParaView plugin will be installed"
)
else()
set(TTK_INSTALL_PLUGIN_DIR
"${CMAKE_INSTALL_BINDIR}/plugins"
CACHE
PATH
"Directory where the ParaView plugin will be installed"
)
endif()
# set rpath for the plugin
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${TTK_INSTALL_PLUGIN_DIR}/${TTK_PLUGIN_SUBDIR}")
add_subdirectory(paraview)
endif()
# Standalones
# -----------
if(TTK_BUILD_STANDALONE_APPS)
add_subdirectory(standalone)
endif()
# Status
# ------
include(CMake/Print.cmake)
ttk_print_summary()