-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeListsLib.txt
755 lines (682 loc) · 31.9 KB
/
CMakeListsLib.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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
# =========================================================================
# Check where the code originates
# =========================================================================
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
EXECUTE_PROCESS(COMMAND git ls-remote --get-url OUTPUT_VARIABLE GIT_ORIGIN WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
# Strip lead and trailing white space
string(STRIP ${GIT_ORIGIN} GIT_ORIGIN)
# Origin pointing to gitlab?
MESSAGE(STATUS "Checking git origin: " ${GIT_ORIGIN})
ENDIF()
IF("${GIT_ORIGIN}" MATCHES "piclas.boltzplatz.eu")
# Checked out using SSH
IF("${GIT_ORIGIN}" MATCHES "^git@")
SET(LIBS_DLPATH "[email protected]:piclas/")
# Checked out using HTTPS
# IF("${GIT_ORIGIN}" MATCHES "^https@")
ELSEIF("${GIT_ORIGIN}" MATCHES "^ssh:")
SET(LIBS_DLPATH "[email protected]:piclas/")
ELSE()
SET(LIBS_DLPATH "https://piclas.boltzplatz.eu/piclas/")
ENDIF()
ELSE()
# Select each lib separately
SET(LIBS_DLPATH "")
ENDIF()
# =========================================================================
# MPI
# =========================================================================
# Try to find system MPI
SET(MPI_DETERMINE_LIBRARY_VERSION TRUE)
FIND_PACKAGE(MPI QUIET)
IF (MPI_FOUND)
MESSAGE (STATUS "[MPI] found in system libraries")
OPTION(LIBS_USE_MPI "Compile SINGLE or MPI version" ON)
ELSE()
MESSAGE (STATUS "[MPI] not found in system libraries")
OPTION(LIBS_USE_MPI "Compile SINGLE or MPI version" OFF)
ENDIF()
IF(LIBS_USE_MPI)
# If library is specifically requested, it is required
SET(MPI_DETERMINE_LIBRARY_VERSION TRUE)
FIND_PACKAGE(MPI REQUIRED)
IF (NOT MPI_Fortran_NO_INTERROGATE)
FOREACH(DIR ${MPI_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${DIR})
ENDFOREACH()
FOREACH(DIR ${MPI_Fortran_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${DIR})
ENDFOREACH()
LIST(APPEND linkedlibs ${MPI_Fortran_LIBRARIES})
ENDIF()
MARK_AS_ADVANCED(FORCE MPI_LIBRARY MPI_EXTRA_LIBRARY)
REMOVE_DEFINITIONS(-DLIBS_MPICH_FIX_SHM_INTERFACE)
# Detect MPI implementation and version since it changes some MPI definitions
IF(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*CRAY MPICH.*" AND MPI_C_VERSION_MAJOR VERSION_EQUAL "3")
SET(LIBS_MPI_NAME "Cray MPICH")
STRING(REGEX MATCH "([0-9]+)\\.([0-9]+)" MPI_C_LIBRARY_VERSION ${MPI_C_LIBRARY_VERSION_STRING})
ELSEIF(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*MPICH.*" AND MPI_C_VERSION_MAJOR VERSION_GREATER_EQUAL "3")
SET(LIBS_MPI_NAME "MPICH")
STRING(REGEX MATCH "([0-9]+)\\.([0-9]+)" MPI_C_LIBRARY_VERSION ${MPI_C_LIBRARY_VERSION_STRING})
# Missing interface added in 4.2, see https://github.com/pmodels/mpich/pull/6727
IF(${MPI_C_LIBRARY_VERSION} VERSION_LESS_EQUAL "4.1")
ADD_DEFINITIONS(-DLIBS_MPICH_FIX_SHM_INTERFACE=1)
ENDIF()
ELSEIF(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*Open MPI.*" AND MPI_C_VERSION_MAJOR VERSION_EQUAL "3")
SET(LIBS_MPI_NAME "OpenMPI")
STRING(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" MPI_C_LIBRARY_VERSION ${MPI_C_LIBRARY_VERSION_STRING})
ELSEIF(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*HPE MPT.*" AND MPI_C_VERSION_MAJOR VERSION_EQUAL "3")
SET(LIBS_MPI_NAME "HPE MPT")
STRING(REGEX MATCH "([0-9]+)\\.([0-9]+)" MPI_C_LIBRARY_VERSION ${MPI_C_LIBRARY_VERSION_STRING})
ADD_DEFINITIONS(-DLIBS_MPT=1)
ELSEIF(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*Intel.*" AND MPI_C_VERSION_MAJOR VERSION_EQUAL "3")
SET(LIBS_MPI_NAME "Intel MPI")
STRING(REGEX MATCH "([0-9]+)\\.([0-9]+)" MPI_C_LIBRARY_VERSION ${MPI_C_LIBRARY_VERSION_STRING})
ELSE()
MESSAGE(FATAL_ERROR "Cannot detect supported MPI type or version. Valid options are Cray MPICH, IntelMPI, MPICH, HPE MPT, and OpenMPI supporting MPI version 3.x")
ENDIF()
MESSAGE(STATUS "Compiling with [${LIBS_MPI_NAME}] (v${MPI_C_LIBRARY_VERSION})")
ADD_DEFINITIONS(-DUSE_MPI=1)
# LUMI needs even more help here
IF("${CMAKE_FQDN_HOST}" MATCHES ".can")
SET(MPI_C_COMPILER cc)
SET(MPI_CXX_COMPILER CC)
SET(MPI_Fortran_COMPILER ftn)
ENDIF()
ELSE()
ADD_DEFINITIONS(-DUSE_MPI=0)
ENDIF()
# =========================================================================
# Add the libraries
# =========================================================================
# Set directory to compile external libraries
IF(LIBS_USE_MPI)
SET(LIBS_EXTERNAL_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/share/${CMAKE_Fortran_COMPILER_ID}-MPI)
ELSE()
SET(LIBS_EXTERNAL_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/share/${CMAKE_Fortran_COMPILER_ID})
ENDIF()
MARK_AS_ADVANCED(FORCE LIBS_EXTERNAL_LIB_DIR)
# =========================================================================
# HDF5 library
# =========================================================================
# Try to find system HDF5 using CMake
SET(LIBS_HDF5_CMAKE TRUE)
IF (NOT LIBS_BUILD_HDF5)
FIND_PACKAGE(HDF5 NAMES hdf5 COMPONENTS C Fortran ${SEARCH_TYPE} QUIET PATH_SUFFIXES share/cmake)
IF (NOT HDF5_FOUND)
# Try to find the configure version
SET(LIBS_HDF5_CMAKE FALSE)
FIND_PACKAGE(HDF5 COMPONENTS C Fortran QUIET)
ENDIF()
ENDIF()
# Hide all the HDF5 libs paths
MARK_AS_ADVANCED(FORCE HDF5_DIR)
IF (HDF5_FOUND)
# CMake version found
IF(LIBS_HDF5_CMAKE AND ${CMAKE_VERSION} VERSION_LESS "3.10.0")
MESSAGE (WARNING "HDF5 built with CMake was found! This feature is only supported for CMake 3.10+ and HDF5 1.10.2+!")
ENDIF()
MESSAGE (STATUS "HDF5 C libs:${HDF5_FOUND} static:${HDF5_static_C_FOUND} and shared:${HDF5_shared_C_FOUND}")
MESSAGE (STATUS "HDF5 Fortran libs: static:${HDF5_static_Fortran_FOUND} and shared:${HDF5_shared_Fortran_FOUND}")
MESSAGE (STATUS "h5diff found:${HDF5_DIFF_EXECUTABLE}")
MESSAGE (STATUS "[HDF5] found in system libraries")
SET(LIBS_BUILD_HDF5 OFF CACHE BOOL "Compile and build HDF5 library")
ELSE()
MESSAGE (STATUS "[HDF5] not found in system libraries")
SET(LIBS_BUILD_HDF5 ON CACHE BOOL "Compile and build HDF5 library")
ENDIF()
# Set type of library to look up, STATIC/SHARED
SET(LIB_TYPE STATIC)
STRING(TOLOWER ${LIB_TYPE} SEARCH_TYPE)
# We support two methods for finding HDF5:
# a) the version built using configure scripts and b) using CMake
# Support for CMake-built HDF5 is limited to version >1.10.2 which require at CMake >3.10
# Use system HDF5
IF(NOT LIBS_BUILD_HDF5)
# Unset leftover paths from old CMake runs
UNSET(HDF5_VERSION CACHE)
UNSET(HDF5_LIBRARIES)
UNSET(HDF5_INCLUDE_DIR_FORTRAN)
UNSET(HDF5_INCLUDE_DIR)
UNSET(HDF5_DIFF_EXECUTABLE)
# Try to find the CMake version
SET(LIBS_HDF5_CMAKE TRUE)
FIND_PACKAGE(HDF5 NAMES hdf5 COMPONENTS C Fortran ${SEARCH_TYPE} QUIET PATH_SUFFIXES share/cmake)
# CMake version found
IF (HDF5_FOUND)
IF(${CMAKE_VERSION} VERSION_LESS "3.10.0")
MESSAGE (WARNING "HDF5 built with CMake was found! This feature is only supported for CMake 3.10+ and HDF5 1.10.2+ !")
ENDIF()
MESSAGE (STATUS "HDF5 C libs:${HDF5_FOUND} static:${HDF5_static_C_FOUND} and shared:${HDF5_shared_C_FOUND}")
MESSAGE (STATUS "HDF5 Fortran libs: static:${HDF5_static_Fortran_FOUND} and shared:${HDF5_shared_Fortran_FOUND}")
MESSAGE (STATUS "h5diff found:${HDF5_DIFF_EXECUTABLE}")
ELSE()
# Try to find the configure version
SET(LIBS_HDF5_CMAKE FALSE)
FIND_PACKAGE(HDF5 COMPONENTS C Fortran)
# In case CMake did not find HDF5 here, it will generate an error by itself
ENDIF()
# Hide all the HDF5 libs paths
# MARK_AS_ADVANCED(FORCE HDF5_DIR)
MARK_AS_ADVANCED(FORCE HDF5_C_LIBRARY_dl)
MARK_AS_ADVANCED(FORCE HDF5_C_LIBRARY_hdf5)
MARK_AS_ADVANCED(FORCE HDF5_C_LIBRARY_m)
MARK_AS_ADVANCED(FORCE HDF5_C_LIBRARY_sz)
MARK_AS_ADVANCED(FORCE HDF5_C_LIBRARY_z)
MARK_AS_ADVANCED(FORCE HDF5_Fortran_LIBRARY_dl)
MARK_AS_ADVANCED(FORCE HDF5_Fortran_LIBRARY_hdf5)
MARK_AS_ADVANCED(FORCE HDF5_Fortran_LIBRARY_hdf5_fortran)
MARK_AS_ADVANCED(FORCE HDF5_Fortran_LIBRARY_m)
MARK_AS_ADVANCED(FORCE HDF5_Fortran_LIBRARY_sz)
MARK_AS_ADVANCED(FORCE HDF5_Fortran_LIBRARY_z)
SET(HDF5_BUILD_STATUS "system")
# Build HDF5 in PICLas
ELSE()
# Origin pointing to Github
IF("${GIT_ORIGIN}" STREQUAL "")
# Use https://github.com/HDFGroup/hdf5.git when using piclas without git
SET (HDF5DOWNLOAD "https://github.com/HDFGroup/hdf5.git")
ELSEIF("${GIT_ORIGIN}" MATCHES ".github.com")
# Use https://github.com/HDFGroup/hdf5.git when using piclas from github.com
SET (HDF5DOWNLOAD "https://github.com/HDFGroup/hdf5.git")
ELSE()
IF("${GIT_ORIGIN}" MATCHES "https://gitlab-ci-token")
# Use https://piclas.boltzplatz.eu/piclas/hdf5.git when gitlab runner needs to download libs
STRING(REGEX REPLACE "/piclas.git" "/hdf5.git" HDF5DOWNLOAD ${GIT_ORIGIN})
ELSE()
# Use https://piclas.boltzplatz.eu/piclas/hdf5.git when using piclas from piclas.boltzplatz.eu
SET (HDF5DOWNLOAD ${LIBS_DLPATH}hdf5.git )
ENDIF()
ENDIF()
SET (HDF5_DOWNLOAD ${HDF5DOWNLOAD} CACHE STRING "HDF5 Download-link")
MESSAGE (STATUS "HDF5 download link: ${HDF5DOWNLOAD}")
MARK_AS_ADVANCED(FORCE HDF5_DOWNLOAD)
#SET HDF5_TAG depending on MPI Version
IF(LIBS_USE_MPI)
# HDF5 1.12.0 and greater is compatible with OpenMPI 4.0.0 and greater
IF("${LIBS_MPI_NAME}" MATCHES "OpenMPI" AND ${MPI_C_LIBRARY_VERSION} VERSION_GREATER_EQUAL "4.0.0")
SET (HDF5_TAG "hdf5-1_12_0" CACHE STRING "HDF5 version tag")
SET (HDF5_VERSION "1.12" CACHE INTERNAL "HDF5 version number")
ELSE()
SET (HDF5_TAG "hdf5-1_10_6" CACHE STRING "HDF5 version tag")
SET (HDF5_VERSION "1.10" CACHE INTERNAL "HDF5 version number")
ENDIF()
MESSAGE (STATUS "Setting [HDF5] to tag ${HDF5_TAG} to be compatible with detected [${LIBS_MPI_NAME}] (v${MPI_C_LIBRARY_VERSION})")
ELSE()
SET (HDF5_TAG "hdf5-1_12_0" CACHE STRING "HDF5 version tag")
SET (HDF5_VERSION "1.12" CACHE INTERNAL "HDF5 version number")
MESSAGE (STATUS "Setting [HDF5] to tag ${HDF5_TAG} as no MPI support was requested")
ENDIF()
MARK_AS_ADVANCED(FORCE HDF5_TAG)
# Set HDF5 build dir
SET(LIBS_HDF5_DIR ${LIBS_EXTERNAL_LIB_DIR}/HDF5/build)
# Check if HDF5 was already built
IF (NOT EXISTS "${LIBS_HDF5_DIR}/lib/libhdf5.a")
# Set if HDF5 should be built in parallel
IF(LIBS_USE_MPI)
SET(LIBS_HDF5PARALLEL --enable-parallel)
SET(LIBS_HDF5FC ${MPI_Fortran_COMPILER})
SET(LIBS_HDF5CC ${MPI_C_COMPILER})
ELSE()
UNSET(LIBS_HDF5PARALLEL)
SET(LIBS_HDF5FC ${CMAKE_Fortran_COMPILER})
SET(LIBS_HDF5CC ${CMAKE_C_COMPILER} )
ENDIF()
# Set parallel build with maximum number of threads
INCLUDE(ProcessorCount)
PROCESSORCOUNT(N)
# Optional Features:
# --enable-silent-rules less verbose build output (undo: "make V=1")
# --enable-build-mode=(debug|production|clean)
# Sets the build mode. Debug turns on symbols, API
# tracing, asserts, and debug optimization, as well as
# several other minor configure options that aid in
# debugging. Production turns high optimizations on.
# Clean turns nothing on and disables optimization
# (i.e.: a 'clean slate' configuration). All these
# settings can be overridden by using specific
# configure flags. [default=production]
# --disable-dependency-tracking
# speeds up one-time build
# Let CMake take care of download, configure and build
EXTERNALPROJECT_ADD(HDF5
GIT_REPOSITORY ${HDF5_DOWNLOAD}
GIT_TAG ${HDF5_TAG}
GIT_PROGRESS TRUE
${GITSHALLOW}
PREFIX ${LIBS_HDF5_DIR}
UPDATE_COMMAND ""
CONFIGURE_COMMAND FC=${LIBS_HDF5FC} CC=${LIBS_HDF5CC} ${LIBS_HDF5_DIR}/src/HDF5/configure --prefix=${LIBS_HDF5_DIR} --with-pic --enable-fortran ${LIBS_HDF5PARALLEL} --libdir=${LIBS_HDF5_DIR}/lib --enable-build-mode=production --enable-silent-rules --disable-dependency-tracking
BUILD_BYPRODUCTS ${LIBS_HDF5_DIR}/lib/libhdf5_fortran.a ${LIBS_HDF5_DIR}/lib/libhdf5.a ${LIBS_HDF5_DIR}/bin/h5diff
# Configure explicitly requires GNU make
BUILD_COMMAND make -j${N}
)
SET(LIBS_HDF5_CMAKE FALSE)
# CMake HDF5 is fast but not yet reliable. The following section can be enabled once HDF5 promotes the CMake option to stable
#EXTERNALPROJECT_ADD(HDF5
# GIT_REPOSITORY ${HDF5DOWNLOAD}
# GIT_TAG ${HDF5_TAG}
# GIT_PROGRESS TRUE
# PREFIX ${LIBS_HDF5_DIR}
# UPDATE_COMMAND ""
# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBS_HDF5_DIR} -DCMAKE_C_COMPILER=${LIBS_HDF5CC} -DCMAKE_Fortran_COMPILER=${LIBS_HDF5FC} -DBUILD-TESTING=OFF -DHDF5_BUILD_EXAMPLES=OFF -DHDF5_BUILD_TOOLS=OFF -DHDF5_BUILD_FORTRAN=ON -DHDF5_ENABLE_PARALLEL=ON
# BUILD_COMMAND ${MAKE}
#)
# SET(LIBS_HDF5_CMAKE TRUE)
LIST(APPEND SELFBUILTEXTERNALS HDF5)
ENDIF()
# Always set for self-build libraries
SET(LIBS_HDF5_CMAKE FALSE)
# Set HDF5 paths
SET(HDF5_C_INCLUDE_DIR ${LIBS_HDF5_DIR}/include)
SET(HDF5_DIFF_EXECUTABLE ${LIBS_HDF5_DIR}/bin/h5diff)
SET(HDF5_Fortran_INCLUDE_DIR ${LIBS_HDF5_DIR}/include)
SET(HDF5_hdf5_LIBRARY_hdf5 ${LIBS_HDF5_DIR}/lib/libhdf5.so)
SET(HDF5_hdf5_LIBRARY_RELEASE ${LIBS_HDF5_DIR}/lib/libhdf5.a)
SET(HDF5_hdf5_fortran_LIBRARY_hdf5 ${LIBS_HDF5_DIR}/lib/libhdf5_fortran.so)
SET(HDF5_hdf5_fortran_LIBRARY_RELEASE ${LIBS_HDF5_DIR}/lib/libhdf5_fortran.a)
MARK_AS_ADVANCED(FORCE HDF5_C_INCLUDE_DIR)
MARK_AS_ADVANCED(FORCE HDF5_DIFF_EXECUTABLE)
MARK_AS_ADVANCED(FORCE HDF5_Fortran_INCLUDE_DIR)
MARK_AS_ADVANCED(FORCE HDF5_hdf5_LIBRARY_hdf5)
MARK_AS_ADVANCED(FORCE HDF5_hdf5_LIBRARY_RELEASE)
MARK_AS_ADVANCED(FORCE HDF5_hdf5_fortran_LIBRARY_hdf5)
MARK_AS_ADVANCED(FORCE HDF5_hdf5_fortran_LIBRARY_RELEASE)
# Unset leftover paths from old CMake runs
UNSET(HDF5_LIBRARIES)
UNSET(HDF5_INCLUDE_DIR_FORTRAN)
UNSET(HDF5_INCLUDE_DIR)
UNSET(HDF5_DIFF_EXECUTABLE)
# Add HDF5 path to include directories for linking
LIST(APPEND HDF5_INCLUDE_DIR_FORTRAN ${HDF5_Fortran_INCLUDE_DIR} ${HDF5_C_INCLUDE_DIR})
LIST(APPEND HDF5_INCLUDE_DIR ${HDF5_C_INCLUDE_DIR})
MARK_AS_ADVANCED(FORCE HDF5_z_LIBRARY_RELEASE)
# Add ZLIB to include paths for HDF5 data compression
FIND_LIBRARY(HDF5_z_LIBRARY_RELEASE z)
LIST(APPEND HDF5_LIBRARIES ${HDF5_hdf5_LIBRARY_hdf5} ${HDF5_hdf5_fortran_LIBRARY_RELEASE} ${HDF5_hdf5_fortran_LIBRARY_hdf5} ${HDF5_hdf5_LIBRARY_RELEASE} ${HDF5_z_LIBRARY_RELEASE} -ldl)
SET(HDF5_BUILD_STATUS "self-built")
ENDIF()
# HDF5 1.14 references build directory
# > https://github.com/HDFGroup/hdf5/issues/2422
IF(HDF5_VERSION VERSION_EQUAL "1.14")
LIST(FILTER HDF5_INCLUDE_DIR EXCLUDE REGEX "src/H5FDsubfiling")
ENDIF()
# Actually add the HDF5 paths (system/custom built) to the linking paths
# HDF5 build with CMake
IF(LIBS_HDF5_CMAKE)
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR} ${HDF5_INCLUDE_DIR_FORTRAN})
LIST(APPEND linkedlibs ${HDF5_C_${LIB_TYPE}_LIBRARY} ${HDF5_FORTRAN_${LIB_TYPE}_LIBRARY} )
# HDF5 build with configure
ELSE()
INCLUDE_DIRECTORIES (${HDF5_INCLUDE_DIR_FORTRAN} ${HDF5_INCLUDE_DIR})
IF(${HDF5_IS_PARALLEL})
MESSAGE(STATUS "Compiling with ${HDF5_BUILD_STATUS} [HDF5] (v${HDF5_VERSION}) with parallel support")
ELSE()
MESSAGE(STATUS "Compiling with ${HDF5_BUILD_STATUS} [HDF5] (v${HDF5_VERSION}) without parallel support")
ENDIF()
LIST(APPEND linkedlibs ${HDF5_LIBRARIES} )
ENDIF()
# =========================================================================
# Math libary
# =========================================================================
# Try to find system LAPACK/OpenBLAS
IF (NOT LIBS_BUILD_MATH_LIB)
FIND_PACKAGE(LAPACK QUIET)
ENDIF()
IF (LAPACK_FOUND)
MESSAGE (STATUS "[BLAS/Lapack] found in system libraries")
SET(LIBS_BUILD_MATH_LIB OFF CACHE BOOL "Compile and build math library")
ELSE()
MESSAGE (STATUS "[BLAS/Lapack] not found in system libraries")
SET(LIBS_BUILD_MATH_LIB ON CACHE BOOL "Compile and build math library")
ENDIF()
# Check if Intel MKL is requested instead of BLAS/LAPACK
# CMAKE_DEPENDENT_OPTION(LIBS_USE_MKL "Use system MKL libraries instead of system BLAS/LAPACK" OFF
# "NOT LIBS_BUILD_MATH_LIB" OFF)
# Use system LAPACK/MKL
IF(NOT LIBS_BUILD_MATH_LIB)
# IF (LIBS_USE_MKL)
# SET(BLA_VENDOR "Intel10_64lp") #search only for Intel BLAS (=MKL)
# ENDIF()
# Use Lapack/Blas for GNU
# If library is specifically requested, it is required
FIND_PACKAGE(LAPACK REQUIRED)
IF (LAPACK_FOUND)
LIST(APPEND linkedlibs ${LAPACK_LIBRARIES})
MESSAGE(STATUS "Compiling with system [BLAS/Lapack]")
ENDIF()
# VDM inverse, replace lapack with analytical solution
IF (CMAKE_BUILD_TYPE MATCHES "Debug" AND CMAKE_FQDN_HOST MATCHES "hawk\.hww\.hlrs\.de$")
MESSAGE(STATUS "Compiling PICLas in debug mode on Hawk with system math lib. Setting VDM inverse to analytical solution")
ADD_DEFINITIONS(-DVDM_ANALYTICAL)
ENDIF()
# Build LAPACK/OpenBLAS in FLEXI
ELSE()
# Offer LAPACK and OpenBLAS
SET (LIBS_BUILD_MATH_LIB_VENDOR LAPACK CACHE STRING "Choose the type of math lib vendor, options are: LAPACK, OpenBLAS.")
SET_PROPERTY(CACHE LIBS_BUILD_MATH_LIB_VENDOR PROPERTY STRINGS LAPACK OpenBLAS)
# Build LAPACK
IF (LIBS_BUILD_MATH_LIB_VENDOR MATCHES "LAPACK")
# Origin pointing to Github
IF("${GIT_ORIGIN}" STREQUAL "")
# Use https://github.com/Reference-LAPACK/lapack.git when using piclas without git
SET (MATHLIB_DOWNLOAD "https://github.com/Reference-LAPACK/lapack.git")
ELSEIF("${GIT_ORIGIN}" MATCHES ".github.com")
# Use https://github.com/Reference-LAPACK/lapack.git when using piclas from github.com
SET (MATHLIB_DOWNLOAD "https://github.com/Reference-LAPACK/lapack.git")
ELSE()
IF("${GIT_ORIGIN}" MATCHES "https://gitlab-ci-token")
# Use https://piclas.boltzplatz.eu/piclas/lapack.git when gitlab runner needs to download libs
STRING(REGEX REPLACE "/piclas.git" "/lapack.git" MATHLIB_DOWNLOAD ${GIT_ORIGIN})
ELSE()
# Use https://piclas.boltzplatz.eu/piclas/lapack.git when using piclas from piclas.boltzplatz.eu
SET (MATHLIB_DOWNLOAD ${LIBS_DLPATH}lapack.git )
ENDIF()
ENDIF()
MESSAGE(STATUS "Downloading from ${MATHLIB_DOWNLOAD}")
SET (MATH_LIB_DOWNLOAD ${MATHLIB_DOWNLOAD} CACHE STRING "LAPACK Download-link" FORCE)
SET (MATH_LIB_TAG "v3.10.0")
MARK_AS_ADVANCED(FORCE MATH_LIB_DOWNLOAD)
MARK_AS_ADVANCED(FORCE MATH_LIB_TAG)
# Build OpenBLAS
ELSEIF (LIBS_BUILD_MATH_LIB_VENDOR MATCHES "OpenBLAS")
IF("${GIT_ORIGIN}" STREQUAL "")
# Use https://github.com/xianyi/OpenBLAS when using piclas without git
SET (MATHLIB_DOWNLOAD "https://github.com/OpenMathLib/OpenBLAS.git")
ELSEIF("${GIT_ORIGIN}" MATCHES ".github.com")
# Use https://github.com/xianyi/OpenBLAS when using piclas from github.com
SET (MATHLIB_DOWNLOAD "https://github.com/OpenMathLib/OpenBLAS.git")
ELSE()
IF("${GIT_ORIGIN}" MATCHES "https://gitlab-ci-token")
# Use https://piclas.boltzplatz.eu/piclas/OpenBLAS.git when gitlab runner needs to download libs
STRING(REGEX REPLACE "/piclas.git" "/OpenBLAS.git" MATHLIB_DOWNLOAD ${GIT_ORIGIN})
ELSE()
# Use https://piclas.boltzplatz.eu/piclas/OpenBLAS.git when using piclas from piclas.boltzplatz.eu
SET (MATHLIB_DOWNLOAD ${LIBS_DLPATH}OpenBLAS.git )
ENDIF()
ENDIF()
MESSAGE(STATUS "Downloading from ${MATHLIB_DOWNLOAD}")
SET (MATH_LIB_DOWNLOAD ${MATHLIB_DOWNLOAD} CACHE STRING "OpenBLAS Download-link" FORCE)
SET (MATH_LIB_TAG "v0.3.17")
MARK_AS_ADVANCED(FORCE MATH_LIB_DOWNLOAD)
MARK_AS_ADVANCED(FORCE MATH_LIB_TAG)
# Unknown math lib vendor
ELSE()
MESSAGE(FATAL_ERROR "Unknown math lib vendor")
ENDIF()
# Set math libs build dir
SET(LIBS_MATH_DIR ${LIBS_EXTERNAL_LIB_DIR}/${LIBS_BUILD_MATH_LIB_VENDOR})
IF (LIBS_BUILD_MATH_LIB_VENDOR MATCHES "LAPACK")
# Check if math lib was already built
IF (NOT EXISTS "${LIBS_MATH_DIR}/lib/liblapack.so")
# Let CMake take care of download, configure and build
EXTERNALPROJECT_ADD(${LIBS_BUILD_MATH_LIB_VENDOR}
GIT_REPOSITORY ${MATH_LIB_DOWNLOAD}
GIT_TAG ${MATH_LIB_TAG}
GIT_PROGRESS TRUE
${GITSHALLOW}
PREFIX ${LIBS_MATH_DIR}
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX=${LIBS_MATH_DIR} -DBLAS++=OFF -DLAPACK++=OFF -DBUILD_SHARED_LIBS=ON -DCBLAS=OFF -DLAPACKE=OFF -DBUILD_TESTING=OFF
BUILD_BYPRODUCTS ${LIBS_MATH_DIR}/lib/liblapack.so ${LIBS_MATH_DIR}/lib/libblas.so
)
LIST(APPEND SELFBUILTEXTERNALS ${LIBS_BUILD_MATH_LIB_VENDOR})
ENDIF()
ELSEIF (LIBS_BUILD_MATH_LIB_VENDOR MATCHES "OpenBLAS")
# Check if math lib was already built
IF (NOT EXISTS "${LIBS_MATH_DIR}/libopenblas.so")
# Let CMake take care of download, configure and build
EXTERNALPROJECT_ADD(${LIBS_BUILD_MATH_LIB_VENDOR}
GIT_REPOSITORY ${MATH_LIB_DOWNLOAD}
GIT_TAG ${MATH_LIB_TAG}
GIT_PROGRESS TRUE
${GITSHALLOW}
PREFIX ${LIBS_MATH_DIR}
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_BYPRODUCTS ${LIBS_MATH_DIR}/src/${LIBS_BUILD_MATH_LIB_VENDOR}/libopenblas.so
BUILD_IN_SOURCE TRUE
INSTALL_COMMAND ""
)
LIST(APPEND SELFBUILTEXTERNALS ${LIBS_BUILD_MATH_LIB_VENDOR})
ENDIF()
ENDIF()
IF (LIBS_BUILD_MATH_LIB_VENDOR MATCHES "LAPACK")
# Set math lib paths
UNSET(MATH_LIB_LIBRARIES)
SET(MATH_LIB_LIBRARIES ${LIBS_MATH_DIR}/lib)
UNSET(LAPACK_LIBRARY)
UNSET(BLAS_LIBRARY)
UNSET(LAPACK_LIBRARIES)
SET(LAPACK_LIBRARY ${MATH_LIB_LIBRARIES}/liblapack.so)
SET(BLAS_LIBRARY ${MATH_LIB_LIBRARIES}/libblas.so)
SET(LAPACK_LIBRARIES ${LAPACK_LIBRARY}${BLAS_LIBRARY})
# Actually add the math lib paths to the linking paths
INCLUDE_DIRECTORIES (${MATH_LIB_LIBRARIES})
LIST(APPEND linkedlibs ${LAPACK_LIBRARY} ${BLAS_LIBRARY})
MESSAGE(STATUS "Compiling with self-built [LAPACK]")
ELSEIF (LIBS_BUILD_MATH_LIB_VENDOR MATCHES "OpenBLAS")
# Set math lib paths
SET(MATH_LIB_LIBRARIES ${LIBS_MATH_DIR}/src/${LIBS_BUILD_MATH_LIB_VENDOR})
UNSET(LAPACK_LIBRARY)
UNSET(LAPACK_LIBRARIES)
SET(LAPACK_LIBRARY ${MATH_LIB_LIBRARIES}/libopenblas.so)
SET(LAPACK_LIBRARIES ${LAPACK_LIBRARY}${BLAS_LIBRARY})
# Actually add the math lib paths to the linking paths
INCLUDE_DIRECTORIES (${MATH_LIB_LIBRARIES})
LIST(APPEND linkedlibs ${LAPACK_LIBRARY} ${BLAS_LIBRARY})
MESSAGE(STATUS "Compiling with self-built [OpenBLAS]")
ENDIF()
ENDIF()
# =========================================================================
# HOPR pre-processor
# =========================================================================
IF(LIBS_BUILD_HOPR)
SET (HOPRDOWNLOAD "https://github.com/hopr-framework/hopr.git")
SET (HOPR_DOWNLOAD ${HOPRDOWNLOAD} CACHE STRING "HOPR Download-link")
MESSAGE (STATUS "HOPR download link: ${HOPRDOWNLOAD}")
MARK_AS_ADVANCED(FORCE HOPR_DOWNLOAD)
IF (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/bin/hopr")
SET(HOPR_FOUND FALSE)
MESSAGE(STATUS "HOPR executable not found in: ${CMAKE_CURRENT_BINARY_DIR}. HOPR will be built and/or installed.")
ELSE()
SET(HOPR_FOUND TRUE)
MESSAGE(STATUS "HOPR has already been built.")
ENDIF()
# Set HOPR build dir
SET(LIBS_HOPR_DIR ${LIBS_EXTERNAL_LIB_DIR}/hopr/build)
MESSAGE(STATUS "HOPR directory: ${LIBS_HOPR_DIR}")
# Check if HOPR was already built and the executable is in the piclas/build/bin folder
IF (NOT HOPR_FOUND)
SET(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
# Let CMake take care of download, configure and build
EXTERNALPROJECT_ADD(HOPR
GIT_REPOSITORY ${HOPR_DOWNLOAD}
GIT_TAG ${HOPR_TAG}
GIT_PROGRESS FALSE
${GITSHALLOW}
PREFIX ${LIBS_HOPR_DIR}
# Avoids rebuilding during PICLas recompilation if HOPR has already been built in share folder
UPDATE_DISCONNECTED true
# Avoid output
LOG_CONFIGURE ON
LOG_INSTALL ON
LOG_BUILD ON
LOG_OUTPUT_ON_FAILURE ON
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR} -DLIBS_BUILD_HDF5=OFF -DLIBS_BUILD_CGNS=ON -DLIBS_USE_MPI=OFF -DCMAKE_BUILD_TYPE=Release
# BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/bin/hopr
)
# HDF5 has to be built before HOPR
IF(LIBS_BUILD_HDF5)
ExternalProject_Add_StepDependencies(HOPR build HDF5)
ENDIF()
# Make sure that the hopr binary is in the piclas/build/bin/ folder after piclas was build
ExternalProject_Add_StepDependencies(HOPR install piclas)
SET(HOPR_FOUND TRUE)
ENDIF()
ENDIF()
# Download the HOPR executable directly and place it in the bin folder
IF(LIBS_DOWNLOAD_HOPR)
MESSAGE(STATUS "HOPR executable download from: ${HOPR_DOWNLOAD_URL}")
IF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/bin/hopr")
MESSAGE(STATUS "HOPR executable not found in: ${CMAKE_CURRENT_BINARY_DIR}/bin/hopr. HOPR will be downloaded/extracted.")
# Check if .zip file has already been downloaded
FILE(GLOB HOPR_ZIP_FILE ${CMAKE_CURRENT_BINARY_DIR}/hopr-*.zip)
IF(NOT EXISTS "${HOPR_ZIP_FILE}")
EXECUTE_PROCESS(COMMAND curl -L -O ${HOPR_DOWNLOAD_URL})
FILE(GLOB HOPR_ZIP_FILE ${CMAKE_CURRENT_BINARY_DIR}/hopr-*.zip)
ENDIF()
# Check if AppImage has already been extracted
FILE(GLOB HOPR_APP_FILE ${CMAKE_CURRENT_BINARY_DIR}/hopr-*.AppImage)
IF(NOT EXISTS "${HOPR_APP_FILE}")
IF(NOT EXISTS "${HOPR_ZIP_FILE}")
MESSAGE(WARNING "FAILED to download hopr .zip file from ${HOPR_DOWNLOAD_URL}")
ELSE()
EXECUTE_PROCESS(COMMAND unzip ${HOPR_ZIP_FILE})
FILE(GLOB HOPR_APP_FILE ${CMAKE_CURRENT_BINARY_DIR}/hopr-*.AppImage)
ENDIF()
ENDIF()
# Check if AppImage file exists and create symbolic link into ./bin
IF(NOT EXISTS "${HOPR_APP_FILE}")
MESSAGE(WARNING "FAILED to extract hopr .zip file")
ELSE()
EXECUTE_PROCESS(COMMAND ln -s ${HOPR_APP_FILE} bin/hopr)
ENDIF()
ELSE()
MESSAGE(STATUS "HOPR executable already exists under ${CMAKE_CURRENT_BINARY_DIR}/bin/hopr")
ENDIF()
ENDIF()
# # =========================================================================
# # PAPI library
# # =========================================================================
# OPTION(LIBS_USE_PAPI "Use PAPI library to perform performance measurements (e.g. flop counts)." OFF)
# IF(LIBS_USE_PAPI)
# FIND_PACKAGE(PAPI REQUIRED)
# ADD_DEFINITIONS(-DPAPI)
# LIST(APPEND linkedlibs ${PAPI_LIBRARIES})
# INCLUDE_DIRECTORIES(${PAPI_INCLUDE_DIRS})
# MESSAGE(STATUS "Building PICLas with PAPI benchmark support.")
# ENDIF()
# # =========================================================================
# # OPENMP library
# # =========================================================================
# # Try to find system OpenMP
# FIND_PACKAGE(OpenMP QUIET)
# IF (OpenMP_FOUND)
# MESSAGE (STATUS "[OpenMP] found in system libraries")
# OPTION(LIBS_USE_OPENMP "Enable OpenMP" ON)
# ELSE()
# MESSAGE (STATUS "[OpenMP] not found in system libraries")
# OPTION(LIBS_USE_OPENMP "Enable OpenMP" OFF)
# ENDIF()
#
# IF(LIBS_USE_OPENMP)
# IF ("${CMAKE_VERSION}" VERSION_LESS 3.1.0)
# MESSAGE(WARNING "For finding OpenMP Fortran flags at least CMake version 3.1.0 is required. Please specify flags manually or use newer CMake version.")
# ENDIF()
# # If library is specifically requested, it is required
# FIND_PACKAGE(OpenMP REQUIRED)
# SET (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${OpenMP_Fortran_FLAGS}")
# SET (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OpenMP_Fortran_FLAGS}")
# SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OpenMP_CXX_FLAGS}")
# SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OpenMP_CXX_FLAGS}")
# SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
# ADD_DEFINITIONS(-DUSE_OPENMP=1)
# MESSAGE(STATUS "Compiling with [OpenMP] (v${OpenMP_Fortran_VERSION})")
# ELSE()
# ADD_DEFINITIONS(-DUSE_OPENMP=0)
# # ENDIF()
#=========================================================================
# PETSc
#=========================================================================
OPTION(LIBS_USE_PETSC "Use the PETSc library" OFF)
# Look quietly for PETSc
FIND_PACKAGE(PETSc QUIET)
# Set the default value whether to build PETSc or use the system library
IF(PETSC_FOUND)
CMAKE_DEPENDENT_OPTION(LIBS_BUILD_PETSC "Compile and build the PETSc library" OFF LIBS_USE_PETSC OFF)
ELSE()
CMAKE_DEPENDENT_OPTION(LIBS_BUILD_PETSC "Compile and build the PETSc library" ON LIBS_USE_PETSC OFF)
ENDIF()
IF(LIBS_USE_PETSC)
IF (LIBS_BUILD_PETSC)
SET(LIBS_BUILD_PETSC_VERSION "3.19.3" CACHE STRING "PETSc self-built version tag")
MARK_AS_ADVANCED(CLEAR LIBS_BUILD_PETSC_VERSION)
ELSE()
UNSET(LIBS_BUILD_PETSC_VERSION CACHE)
MARK_AS_ADVANCED(FORCE LIBS_BUILD_PETSC_VERSION)
ENDIF()
IF (LIBS_BUILD_PETSC)
# Set PETSc build dir
SET(LIBS_PETSC_DIR ${LIBS_EXTERNAL_LIB_DIR}/PETSc/build)
SET(PETSC_BUILD_DIR ${LIBS_EXTERNAL_LIB_DIR}/PETSc/linux-gnu-c)
SET(PETSC_LIB_LIBRARIES ${LIBS_EXTERNAL_LIB_DIR}/PETSc/linux-gnu-c/lib)
SET(PETSC_INCLUDE_DIRS ${LIBS_EXTERNAL_LIB_DIR}/PETSc/linux-gnu-c/include)
# Determine if PETSc should be built with debugging or optimization flags
IF(CMAKE_BUILD_TYPE MATCHES "Release")
MESSAGE (STATUS "Compiling [PETSc] with optimization flags!")
SET(PETSC_COMPILER_FLAGS --with-debugging=0 COPTFLAGS=-O3 -march=native -mtune=native CXXOPTFLAGS=-O3 -march=native -mtune=native FOPTFLAGS=-O3 -march=native -mtune=native)
ELSE()
MESSAGE (STATUS "Compiling [PETSc] with debugging flags!")
SET(PETSC_COMPILER_FLAGS --with-debugging=1)
ENDIF()
# Add PETSc project
EXTERNALPROJECT_ADD(PETSc
GIT_REPOSITORY "https://gitlab.com/petsc/petsc.git"
GIT_TAG "v${LIBS_BUILD_PETSC_VERSION}"
GIT_PROGRESS TRUE
${GITSHALLOW}
PREFIX ${LIBS_PETSC_DIR}
INSTALL_DIR ${LIBS_EXTERNAL_LIB_DIR}/PETSc
BUILD_IN_SOURCE TRUE
UPDATE_COMMAND ""
CONFIGURE_COMMAND
PETSC_DIR=${LIBS_PETSC_DIR}/src/PETSc
${LIBS_PETSC_DIR}/src/PETSc/configure
--prefix=${PETSC_BUILD_DIR}
${PETSC_COMPILER_FLAGS}
--with-shared-libraries=1
--with-mpi-f90module-visibility=0 # "With 0, mpi.mod will not be visible in use code (via petscsys.mod) - so mpi_f08 can now be used" (https://petsc.org/main/changes/315/)
--with-bison=0
--download-hypre
--download-mumps
--download-scalapack
# BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} -j4
BUILD_BYPRODUCTS ${PETSC_LIB_LIBRARIES}/libpetsc.so
)
# Actually add the PETSc lib paths to the linking paths
INCLUDE_DIRECTORIES(${PETSC_INCLUDE_DIRS})
INCLUDE_DIRECTORIES (${PETSC_LIB_LIBRARIES})
LIST(APPEND linkedlibs ${PETSC_LIB_LIBRARIES}/libpetsc.so)
LIST(APPEND SELFBUILTEXTERNALS PETSc)
# If HDF5 is built in PIClas, it must occur before the PETSc compilation
IF(LIBS_BUILD_HDF5)
IF (NOT EXISTS "${LIBS_HDF5_DIR}/lib/libhdf5.a")
ADD_DEPENDENCIES(PETSc HDF5)
ENDIF()
ENDIF()
ADD_DEFINITIONS(-DUSE_PETSC=1)
MESSAGE(STATUS "Compiling with self-built [PETSc] (v${LIBS_BUILD_PETSC_VERSION})")
ELSE()
IF(PETSC_FOUND)
# Check if PETSc version needs FIX317
IF (${PETSC_VERSION} VERSION_LESS 3.18)
ADD_DEFINITIONS(-DUSE_PETSC_FIX317=1)
ELSE()
ADD_DEFINITIONS(-DUSE_PETSC_FIX317=0)
ENDIF()
INCLUDE_DIRECTORIES(${PETSC_INCLUDE_DIRS})
LIST(APPEND linkedlibs ${PETSC_LINK_LIBRARIES})
ADD_DEFINITIONS(-DUSE_PETSC=1)
MESSAGE(STATUS "Compiling with system [PETSc] (v${PETSC_VERSION}) [${PETSC_LINK_LIBRARIES}]")
ELSE()
MESSAGE(FATAL_ERROR "PETSc not found! Consider building PETSc with LIBS_BUILD_PETSC = ON.")
ENDIF()
ENDIF()
# Do not allow PETSc + INT8 as this is not implemented yet
IF(PICLAS_INTKIND8)
MESSAGE(FATAL_ERROR "PETSc + INT8 is not implemented yet!")
ENDIF()
ELSE()
ADD_DEFINITIONS(-DUSE_PETSC=0)
ENDIF(LIBS_USE_PETSC)