-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
122 lines (103 loc) · 3.83 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
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
# use minimum version required by Kokkos
cmake_minimum_required(VERSION 3.18)
# CMake 3.24 and above prefers to set the timestamps of all extracted contents
# to the time of the extraction.
if(NOT CMAKE_VERSION VERSION_LESS 3.24)
cmake_policy(SET CMP0135 NEW)
endif()
project(AMR_mandelbrot CXX C)
# always export compile commands database
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# C++17 is for Kokkos
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
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()
#
# Make sure Kokkos is available (as a git submodule)
#
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/external/kokkos/Makefile.kokkos")
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif()
#
# Prevent from build in source tree
# The recommended way of building this app is one build directory per hardware config
# e.g. mkdir build_openmp for openmp build
# or mkdir build_cuda for cuda build
#
include(cmake/preventBuildInSource.cmake)
#
# Init build type: Release, Debug, ...
#
include(cmake/initBuildType.cmake)
#
# dependencies : kokkos
#
include(cmake/build_or_find_kokkos.cmake)
#
# sources
#
add_subdirectory(src)
##################### PRINT CONFIGURE STATUS ######################
message("//===================================================")
message("// ${PROJECT_NAME} build configuration:")
message("//===================================================")
message("")
message(" CMake version : ${CMAKE_VERSION}")
if (NOT CMAKE_BUILD_TYPE)
message(" CMake build type : NOT SET !")
else()
message(" CMake build type : ${CMAKE_BUILD_TYPE}")
endif()
message(" CMake install prefix : ${CMAKE_INSTALL_PREFIX}")
message(" CMake system processor : ${CMAKE_SYSTEM_PROCESSOR}")
message(" CMake system name (OS) : ${CMAKE_SYSTEM_NAME}")
message("")
message(" C++ Compiler : ${CMAKE_CXX_COMPILER_ID} "
"${CMAKE_CXX_COMPILER_VERSION} "
"${CMAKE_CXX_COMPILER_WRAPPER}")
message(" ${CMAKE_CXX_COMPILER}")
message("")
if(Kokkos_ENABLE_OPENMP)
message(" Kokkos_ENABLE_OPENMP = ${Kokkos_ENABLE_OPENMP}")
endif()
if(Kokkos_ENABLE_CUDA)
message(" Kokkos_ENABLE_CUDA = ${Kokkos_ENABLE_CUDA}")
if( (${Kokkos_CUDA_LAMBDA_ENABLED}) OR (${Kokkos_ENABLE_CUDA_LAMBDA}))
message(" Kokkos_ENABLE_CUDA_LAMBDA = ON")
else()
message(" Kokkos_ENABLE_CUDA_LAMBDA = OFF")
endif()
if( (${Kokkos_CUDA_CONSTEXPR_ENABLED}) OR (${Kokkos_ENABLE_CUDA_CONSTEXPR}))
message(" Kokkos_ENABLE_CUDA_CONSTEXPR = ON")
else()
message(" Kokkos_ENABLE_CUDA_CONSTEXPR = OFF")
endif()
if( (${Kokkos_CUDA_UVM_ENABLED}) OR (${Kokkos_ENABLE_CUDA_UVM}))
message(" Kokkos_ENABLE_CUDA_UVM = ON")
else()
message(" Kokkos_ENABLE_CUDA_UVM = OFF")
endif()
message(" Kokkos CUDA flags = ${KOKKOS_CUDA_OPTIONS}")
#message(" CUDA Compiler : ${CMAKE_CUDA_COMPILER}")
#message(" CUDA Compiler exec : ${CUDA_NVCC_EXECUTABLE}")
#message(" CUDA Compile flags : ${CUDA_NVCC_FLAGS}")
endif(Kokkos_ENABLE_CUDA)
if(Kokkos_ENABLE_HIP)
message(" Kokkos_ENABLE_HIP = ${Kokkos_ENABLE_HIP}")
endif(Kokkos_ENABLE_HIP)
if ( (${Kokkos_TPLS_HWLOC_ENABLED}) OR (${Kokkos_ENABLE_HWLOC}) )
message(" Kokkos_ENABLE_HWLOC = ON")
else()
message(" Kokkos_ENABLE_HWLOC = OFF")
endif()
message(" Kokkos architecture = ${Kokkos_ARCH}")