forked from pkestene/euler2d_kokkos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (66 loc) · 2.63 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.16)
project(
euler2d
DESCRIPTION "euler2d_kokkos is mini application using C++/Kokkos library, used for teaching purpose"
LANGUAGES CXX C)
#
# default local cmake macro repository
#
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF)
# set default build type to "Release"
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# always export compile commands database
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#
# Kokkos : https://github.com/kokkos/kokkos
#
include(build_or_find_kokkos)
option (USE_DOUBLE "build with double precision" ON)
if (USE_DOUBLE)
add_compile_options(-DUSE_DOUBLE)
# cmake version also have this
#add_compile_definitions(-DUSE_DOUBLE)
endif()
option(ENABLE_HDF5 "Enable HDF5 support" ON)
if(ENABLE_HDF5)
find_package(HDF5 REQUIRED)
if(HDF5_FOUND)
include_directories(${HDF5_INCLUDE_DIR})
set(_hdf5_libs hdf5 hdf5_cpp)
else()
message("HDF5 not found")
endif()
endif()
add_subdirectory(src)
##################### PRINT CONFIGURE STATUS ######################
message("//===================================================")
message(" ${PROJECT_NAME} build configuration:")
message("//===================================================")
message(" C++ Compiler : ${CMAKE_CXX_COMPILER_ID} "
"${CMAKE_CXX_COMPILER_VERSION} "
"${CMAKE_CXX_COMPILER_WRAPPER}")
message(" ${CMAKE_CXX_COMPILER}")
message(" Kokkos_ENABLE_OPENMP = ${Kokkos_ENABLE_OPENMP}")
message(" Kokkos_ENABLE_CUDA = ${Kokkos_ENABLE_CUDA}")
if (Kokkos_ENABLE_CUDA)
message(" Kokkos_ENABLE_CUDA_LAMBDA = ${Kokkos_ENABLE_CUDA_LAMBDA}")
message(" Kokkos_ENABLE_CUDA_CONSTEXPR = ${Kokkos_ENABLE_CUDA_CONSTEXPR}")
message(" Kokkos_ENABLE_CUDA_UVM = ${Kokkos_ENABLE_CUDA_UVM}")
message(" Kokkos CUDA flags = ${KOKKOS_CUDA_OPTIONS}")
endif(Kokkos_ENABLE_CUDA)
message(" Kokkos_ENABLE_HWLOC = ${Kokkos_ENABLE_HWLOC}")
if (Kokkos_ENABLE_CUDA)
message(" CUDA Compiler : ${CMAKE_CUDA_COMPILER}")
message(" CUDA Compiler exec : ${CUDA_NVCC_EXECUTABLE}")
message(" CUDA Compile flags : ${CUDA_NVCC_FLAGS}")
endif(Kokkos_ENABLE_CUDA)