-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
executable file
·64 lines (50 loc) · 2.06 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
cmake_minimum_required(VERSION 3.16.0)
project(shaw CXX)
# guard against in-source builds
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed.
Remove CMakeCache.txt. Make a separate build directory and run CMake from there.")
endif()
# default to release if build type is empty
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
# we need c++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
#==================================
find_package(yaml-cpp REQUIRED HINTS ${YAMLCPP_DIR})
include_directories(${YAMLCPP_DIR}/include)
if(EXISTS "${YAMLCPP_DIR}/lib64/libyaml-cpp.a")
set(YAML_CPP_LIBRARIES ${YAMLCPP_DIR}/lib64/libyaml-cpp.a)
endif()
if(EXISTS "${YAMLCPP_DIR}/lib/libyaml-cpp.a")
set(YAML_CPP_LIBRARIES ${YAMLCPP_DIR}/lib/libyaml-cpp.a)
endif()
find_package(KokkosKernels REQUIRED HINTS ${KOKKOSKERNELS_DIR})
# executables
add_executable(
shawExe
${CMAKE_CURRENT_SOURCE_DIR}/src/kokkos/main.cc)
target_link_libraries(shawExe dl ${YAML_CPP_LIBRARIES} Kokkos::kokkoskernels)
add_executable(
extractStateFromSnaps
${CMAKE_CURRENT_SOURCE_DIR}/src/tools/main_extract_state_from_snaps.cc)
target_link_libraries(extractStateFromSnaps dl ${YAML_CPP_LIBRARIES} Kokkos::kokkoskernels)
add_executable(
reconstructFomState
${CMAKE_CURRENT_SOURCE_DIR}/src/tools/main_reconstruct_fom_state.cc)
target_link_libraries(reconstructFomState dl ${YAML_CPP_LIBRARIES} Kokkos::kokkoskernels)
add_executable(
reconstructSeismogram
${CMAKE_CURRENT_SOURCE_DIR}/src/tools/main_reconstruct_seismo.cc)
target_link_libraries(reconstructSeismogram dl ${YAML_CPP_LIBRARIES} Kokkos::kokkoskernels)
find_package(OpenMP)
add_executable(computeThinSVD ${CMAKE_CURRENT_SOURCE_DIR}/src/tools/main_eigen_svd.cc)
target_compile_options(computeThinSVD PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-march=native>)
target_include_directories(computeThinSVD PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/eigen)
target_link_libraries(computeThinSVD OpenMP::OpenMP_CXX)
# tests
enable_testing()
add_subdirectory(tests)