-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
104 lines (85 loc) · 2.57 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
cmake_minimum_required(VERSION 3.23)
#---- Read the version file.
file(READ version.json VERSION_JSON)
#---- Get the version of kokkos-utils.
string(JSON KOKKOS_UTILS_VERSION GET "${VERSION_JSON}" "kokkos-utils" "value")
#---- Define the project. It uses C++ only.
project(
kokkos-utils
VERSION ${KOKKOS_UTILS_VERSION}
LANGUAGES CXX
)
#---- Options.
option(KokkosUtils_ENABLE_TESTS "Enable testing" ON)
option(KokkosUtils_ENABLE_DOC "Enable documentation" ON)
#---- Global property that helps us keep track of files that will automatically be added
# to our Doxygen documentation.
define_property(GLOBAL PROPERTY KokkosUtils_FILES_FOR_DOC
BRIEF_DOCS "Files that will be added to the Doxygen documentation."
)
#---- Find Kokkos.
#
# Currently, we require the Kokkos::kokkoscore target. Other targets will be added as needed.
string(JSON Kokkos_REQUIRED_VERSION GET "${VERSION_JSON}" dependencies kokkos value)
if(NOT TARGET Kokkos::kokkoscore)
find_package(
Kokkos
${Kokkos_REQUIRED_VERSION}
CONFIG
REQUIRED
)
else()
if(DEFINED Kokkos_VERSION)
if(NOT Kokkos_VERSION VERSION_GREATER_EQUAL Kokkos_REQUIRED_VERSION)
message(FATAL_ERROR "Kokkos target(s) already set, but version not at least ${Kokkos_REQUIRED_VERSION}.")
endif()
else()
message(WARNING "Kokkos target(s) already set, but could not check version.")
endif()
endif()
#---- Build the Kokkos::utils library.
add_library(KokkosUtils INTERFACE)
add_library(Kokkos::utils ALIAS KokkosUtils)
target_sources(
KokkosUtils
INTERFACE
include/kokkos-utils/atomics/InsertOp.hpp
include/kokkos-utils/concepts/DualView.hpp
include/kokkos-utils/concepts/ExecutionSpace.hpp
include/kokkos-utils/concepts/MemorySpace.hpp
include/kokkos-utils/concepts/Space.hpp
include/kokkos-utils/concepts/View.hpp
include/kokkos-utils/impl/type_list.hpp
include/kokkos-utils/impl/type_traits.hpp
include/kokkos-utils/view/extents.hpp
include/kokkos-utils/view/slice.hpp
)
target_include_directories(
KokkosUtils
INTERFACE
"include/"
)
target_compile_features(
KokkosUtils
INTERFACE
cxx_std_20
)
target_compile_definitions(
KokkosUtils
INTERFACE
KOKKOS_IMPL_PUBLIC_INCLUDE
)
target_link_libraries(
KokkosUtils
INTERFACE
Kokkos::kokkoscore
)
#---- Testing.
if(KokkosUtils_ENABLE_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
#---- Documentation.
if(KokkosUtils_ENABLE_DOC)
add_subdirectory(docs)
endif()