-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
302 lines (255 loc) · 6.66 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
cmake_minimum_required(VERSION 3.21)
project(
xsdk-examples
DESCRIPTION "xSDK Examples"
LANGUAGES CXX C
)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(CTest)
include(FindPackageHandleStandardArgs)
include(XsdkAddTest)
# build options
option(ENABLE_CUDA "Enable CUDA" OFF)
option(ENABLE_HIP "Enable HIP" OFF)
option(ENABLE_AMREX "Enable AMReX" ON)
set(AMREX_DIR
"${AMREX_DIR}"
CACHE PATH "Path to AMReX installation directory"
)
option(ENABLE_DEAL_II "Enable deal.II" ON)
set(DEAL_II_DIR
"${DEAL_II_DIR}"
CACHE PATH "Path to deal.II installation directory"
)
option(ENABLE_GINKGO "Enable Ginkgo" ON)
set(Ginkgo_DIR
"${Ginkgo_DIR}"
CACHE PATH "Path to Ginkgo installation directory"
)
option(ENABLE_HEFFTE "Enable heFFTe" OFF)
set(HEFFTE_DIR
"${HEFFTE_DIR}"
CACHE PATH "Path to the heFFTe installation directory"
)
option(ENABLE_HIOP "Enable HiOp" ON)
set(HIOP_DIR
"${HIOP_DIR}"
CACHE PATH "Path to HiOp installation directory"
)
option(ENABLE_HYPRE "Enable hypre" ON)
set(HYPRE_DIR
"${HYPRE_DIR}"
CACHE PATH "Path to hypre installation directory"
)
option(ENABLE_MAGMA "Enable MAGMA" OFF)
set(MAGMA_DIR
"${MAGMA_DIR}"
CACHE PATH "Path to MAGMA installation directory"
)
option(ENABLE_MFEM "Enable MFEM" ON)
set(MFEM_DIR
"${MFEM_DIR}"
CACHE PATH "Path to MFEM installation directory"
)
option(ENABLE_PETSC "Enable PETSc" ON)
set(PETSc_DIR
"${PETSc_DIR}"
CACHE PATH "Path to PETSc installation directory"
)
option(ENABLE_PLASMA "Enable PLASMA" ON)
set(PLASMA_DIR
"${PLASMA_DIR}"
CACHE PATH "Path to PLASMA installation directory"
)
option(ENABLE_PRECICE "Enable preCICE" ON)
set(PRECICE_DIR
"${PRECICE_DIR}"
CACHE PATH "Path to preCICE installation directory"
)
option(ENABLE_PUMI "Enable PUMI" ON)
set(PUMI_DIR
"${PUMI_DIR}"
CACHE PATH "Path to PUMI installation directory"
)
option(ENABLE_SUNDIALS "Enable SUNDIALS" ON)
set(SUNDIALS_DIR
"${SUNDIALS_DIR}"
CACHE PATH "Path to SUNDIALS installation directory"
)
option(ENABLE_SUPERLU "Enable SuperLU" ON)
set(SUPERLUDIST_DIR
"${SUPERLUDIST_DIR}"
CACHE PATH "Path to SuperLU_DIST installation directory"
)
option(ENABLE_STRUMPACK "Enable STRUMPACK" OFF)
set(STRUMPACK_DIR
"${STRUMPACK_DIR}"
CACHE PATH "Path to STRUMPACK installation directory"
)
option(ENABLE_TASMANIAN "Enable Tasmanian" OFF)
set(TASMANIAN_DIR
"${TASMANIAN_DIR}"
CACHE PATH "Path to the Tasmanian installation directory"
)
option(ENABLE_TRILINOS "Enable TRILINOS" OFF)
set(TRILINOS_DIR
"${Trilinos_DIR}"
CACHE PATH "Path to Trilinos installation directory"
)
set(METIS_DIR
"${METIS_DIR}"
CACHE PATH "Path to Metis installation directory"
)
# Don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# When building, don't use the install RPATH already (but later on when
# installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
# Add the automatically determined parts of the RPATH which point to directories
# outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# The RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
endif()
# check for MPI
find_package(MPI REQUIRED)
# check for OpenMP
find_package(OpenMP)
# compiler options
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
# setup CUDA
if(ENABLE_CUDA)
enable_language(CUDA)
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
find_package(CUDAToolkit REQUIRED)
endif()
if(ENABLE_HIP)
enable_language(HIP)
find_package(hip REQUIRED)
find_package(hipsparse REQUIRED)
find_package(hiprand REQUIRED)
find_package(rocrand REQUIRED)
find_package(rocprim REQUIRED)
find_package(rocsparse REQUIRED)
find_package(rocsolver REQUIRED)
endif()
# check for AMReX
if(ENABLE_AMREX)
find_package(AMReX REQUIRED)
endif()
# check for deal.II
if(ENABLE_DEAL_II)
# deal.II resets CMAKE_CUDA_ARCHITECTURES in its CMake config file, so we
# need to save it here and restore it below.
set(_cuda_archs "${CMAKE_CUDA_ARCHITECTURES}")
find_package(deal.II REQUIRED
HINTS ${deal.II_DIR} ${DEAL_II_DIR} $ENV{DEAL_II_DIR}
)
set(CMAKE_CUDA_ARCHITECTURES "${_cuda_archs}")
endif()
if(ENABLE_HEFFTE)
find_package(Heffte 2.2 PATHS "${HEFFTE_DIR}" REQUIRED)
endif()
# check for HiOp
if(ENABLE_HIOP)
find_package(HiOp REQUIRED)
endif()
# check for hypre
if(ENABLE_HYPRE)
find_package(HYPRE REQUIRED)
endif()
# check for MAGMA
if(ENABLE_MAGMA)
find_package(MAGMA REQUIRED)
endif()
# check for MFEM
if(ENABLE_MFEM)
find_package(ZLIB REQUIRED)
find_package(MFEM REQUIRED)
if(ENABLE_GINKGO)
find_package(Ginkgo REQUIRED)
endif()
endif()
# check for PETSC
if(ENABLE_PETSC)
find_package(PETSc REQUIRED)
endif()
# check for PLASMA
if(ENABLE_PLASMA)
find_package(PLASMA REQUIRED)
find_package(BLASPP REQUIRED)
find_package(LAPACKPP REQUIRED)
find_package(SLATE REQUIRED)
endif()
# check for preCICE
if(ENABLE_PRECICE)
find_package(precice 2 REQUIRED
HINTS ${PRECICE_DIR} $ENV{PRECICE_DIR}
)
endif()
# check for PUMI
if(ENABLE_PUMI)
# not really needed: MFEM links with PUMI if it is built with it
# find_package(SCOREC REQUIRED)
endif()
# check for SUNDIALS
if(ENABLE_SUNDIALS)
find_package(SUNDIALS REQUIRED)
endif()
# check for SuperLU DIST
if(ENABLE_SUPERLU)
find_package(SUPERLUDIST REQUIRED)
endif()
# check for STRUMPACK
if(ENABLE_STRUMPACK)
find_package(STRUMPACK REQUIRED)
endif()
if(ENABLE_TASMANIAN)
find_package(Tasmanian 7.5 PATHS "${TASMANIAN_DIR}" REQUIRED)
endif()
# check for math
find_library(MATH_LIBRARY NAMES m)
# check for metis
find_package(METIS)
# example subdirectories
if(ENABLE_AMREX)
add_subdirectory(amrex)
endif()
if(ENABLE_DEAL_II)
add_subdirectory(dealii)
endif()
if(ENABLE_HEFFTE)
add_subdirectory(heffte)
endif()
if(ENABLE_HYPRE)
add_subdirectory(hypre)
endif()
if(ENABLE_MFEM)
add_subdirectory(mfem)
endif()
if(ENABLE_PETSC)
add_subdirectory(petsc)
endif()
if(ENABLE_PLASMA)
add_subdirectory(plasma)
endif()
if(ENABLE_STRUMPACK)
add_subdirectory(strumpack)
endif()
if(ENABLE_SUNDIALS)
add_subdirectory(sundials)
endif()
if(ENABLE_TASMANIAN)
add_subdirectory(tasmanian)
endif()
if(ENABLE_TRILINOS)
add_subdirectory(trilinos)
endif()