-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCMakeLists.txt
81 lines (67 loc) · 2.67 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
cmake_minimum_required(VERSION 3.19)
project(pcms VERSION 0.1.1 LANGUAGES CXX)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
option(PCMS_ENABLE_ASAN "enable address sanitizer" OFF)
set(PCMS_HAS_ASAN OFF)
if (PCMS_ENABLE_ASAN AND CMAKE_COMPILER_IS_GNUCXX MATCHES 1)
set(PCMS_HAS_ASAN ON)
endif ()
option(PCMS_ENABLE_SERVER "enable the coupling server implementation" ON)
option(PCMS_ENABLE_CLIENT "enable the coupling client implementation" ON)
option(PCMS_ENABLE_XGC "enable xgc field adapter" ON)
option(PCMS_ENABLE_OMEGA_H "enable Omega_h field adapter" OFF)
option(PCMS_ENABLE_C "Enable pcms C api" ON)
option(PCMS_PRINT_ENABLED "PCMS print statements enabled" ON)
find_package(spdlog QUIET)
# find package before fortran enabled, so we don't require the adios2 fortran interfaces
# this is important because adios2 build with clang/gfortran is broken
find_package(redev 4.3.0 REQUIRED)
if (PCMS_ENABLE_C)
enable_language(C)
option(PCMS_ENABLE_Fortran "Enable pcms fortran api" ON)
if(PCMS_ENABLE_Fortran)
enable_language(Fortran)
endif()
endif ()
if (PCMS_ENABLE_SERVER)
set(PCMS_ENABLE_OMEGA_H ON CACHE BOOL "enable Omega_h field adapter" FORCE)
endif ()
set(MPI_CXX_SKIP_MPICXX ON)
find_package(MPI REQUIRED)
message(STATUS "Found redev: ${redev_DIR} (found version ${redev_VERSION})")
if (PCMS_ENABLE_OMEGA_H)
find_package(Omega_h REQUIRED VERSION 10)
message(STATUS "Found Omega_h: ${Omega_h_DIR} (found version ${Omega_h_VERSION})")
if(NOT Omega_h_USE_MPI)
message(FATAL_ERROR "Omega_h must be built with MPI enabled.")
endif()
endif()
#adios2 adds C and Fortran depending on how it was built
find_package(ADIOS2 2.5 REQUIRED)
find_package(Kokkos 4.5 REQUIRED)
## use pkgconfig since the fftw autoconf install produces
## broken cmake config files
## https://github.com/FFTW/fftw3/issues/130
find_package(PkgConfig REQUIRED)
pkg_check_modules(fftw REQUIRED IMPORTED_TARGET fftw3>=3.3)
add_subdirectory(src)
include(CTest)
include(test/testing.cmake)
#define 'smoke tests' to test the install
add_custom_target(test_install DEPENDS check) # maintain test_install target
if(NOT BUILD_TESTING)
add_custom_target(check
COMMAND ${CMAKE_CTEST_COMMAND} -R smoke_test
COMMENT "Test installed PUMIPic utilities")
endif()
add_executable(smoke_test test/test_ohClassPtn.cpp)
target_link_libraries(smoke_test pcms::core test_support)
dual_mpi_test(TESTNAME smoke_test
TIMEOUT 4
NAME1 rdv EXE1 ./smoke_test PROCS1 2 ARGS1 1 ${PCMS_TEST_DATA_DIR}/cyclone/23elements/mesh.osh/
NAME2 app EXE2 ./smoke_test PROCS2 1 ARGS2 0 ${PCMS_TEST_DATA_DIR}/cyclone/23elements/mesh.osh/)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
add_subdirectory(tools)