-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
77 lines (63 loc) · 2.7 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
cmake_minimum_required(VERSION 3.10.0)
# specify the project name and language
project(cosyr LANGUAGES CXX)
# policy for <PackageName>_ROOT variables
cmake_policy(SET CMP0074 NEW)
# create the target
add_executable(cosyr)
# set compiler standard and extensions
target_compile_features(cosyr PRIVATE cxx_std_14)
set(CMAKE_CXX_EXTENSIONS OFF)
#------------------------------------------------------------------------------#
# Enable Pybind11
#------------------------------------------------------------------------------#
find_package(pybind11 REQUIRED HINTS ${pybind11_DIR}/share/cmake) # or `add_subdirectory(pybind11)
target_link_libraries(cosyr PRIVATE pybind11::embed)
#------------------------------------------------------------------------------#
# Enable OpenMP and MPI
#------------------------------------------------------------------------------#
find_package(OpenMP REQUIRED)
find_package(MPI REQUIRED)
target_link_libraries(cosyr PRIVATE OpenMP::OpenMP_CXX)
target_link_libraries(cosyr PRIVATE MPI::MPI_CXX)
#------------------------------------------------------------------------------#
# Enable Portage
#------------------------------------------------------------------------------#
find_package(portage REQUIRED HINTS ${PORTAGE_DIR}/lib/cmake)
target_link_libraries(cosyr PRIVATE portage::portage)
#-----------------------------------------------------------------------------
# Enable Kokkos
#-----------------------------------------------------------------------------
find_package(Kokkos REQUIRED HINTS ${Kokkos_DIR})
target_link_libraries(cosyr PRIVATE Kokkos::kokkos)
target_compile_definitions(cosyr PRIVATE ENABLE_KOKKOS=1)
#-----------------------------------------------------------------------------
# Enable Cabana
#-----------------------------------------------------------------------------
find_package(Cabana REQUIRED HINTS ${Cabana_DIR})
target_link_libraries(cosyr PRIVATE Cabana::cabanacore)
target_compile_definitions(cosyr PRIVATE ENABLE_CABANA=1)
#-----------------------------------------------------------------------------
# Enable TCMalloc
#-----------------------------------------------------------------------------
if (ENABLE_TCMALLOC)
string(APPEND CMAKE_EXE_LINKER_FLAGS " -ltcmalloc ${TCMALLOC_LIB}")
endif()
# disable GCC visibility warnings
target_compile_options(cosyr PRIVATE "-Wno-attributes")
# set headers source and libraries
target_include_directories(cosyr PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_sources(cosyr PRIVATE
src/main.cpp
src/beam.cpp
src/mesh.cpp
src/remap.cpp
src/kernel.cpp
src/pusher.cpp
src/wavelet.cpp
src/input.cpp
src/io.cpp
src/formula.cpp
src/analysis.cpp)