-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
168 lines (140 loc) · 4.67 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# SPDX-FileCopyrightText: (C) The kokkos-fft development team, see COPYRIGHT.md file
#
# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.22)
set(KOKKOSFFT_TOP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
# Set project
project(
KokkosFFT
VERSION 0.2.1
LANGUAGES CXX
)
# Add cmake helpers
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Options
option(KokkosFFT_ENABLE_HOST_AND_DEVICE "Enable FFT on both host and device" OFF)
option(KokkosFFT_ENABLE_INTERNAL_KOKKOS "Build internal Kokkos instead of relying on external one" OFF)
option(KokkosFFT_ENABLE_EXAMPLES "Build KokkosFFT examples" OFF)
option(KokkosFFT_ENABLE_TESTS "Build KokkosFFT tests" OFF)
option(KokkosFFT_ENABLE_BENCHMARK "Build benchmarks for KokkosFFT" OFF)
option(KokkosFFT_ENABLE_DOCS "Build KokkosFFT documentaion/website" OFF)
# Device specific options
option(KokkosFFT_ENABLE_ROCFFT "Enable rocfft as a KokkosFFT backend on AMD GPUs" OFF)
# Version information
set(KOKKOSFFT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(KOKKOSFFT_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(KOKKOSFFT_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(KOKKOS_REQUIRED_VERSION 4.4.0)
if (NOT KokkosFFT_ENABLE_INTERNAL_KOKKOS)
# First check, Kokkos is added as subdirectory or not
if(NOT TARGET Kokkos::kokkos)
find_package(Kokkos ${KOKKOS_REQUIRED_VERSION} REQUIRED)
endif()
else ()
add_subdirectory(tpls/kokkos)
endif ()
# Set tpls
set(KOKKOSFFT_TPL_LIST)
set(KOKKOSFFT_BACKEND_LIST)
include(KokkosFFT_tpls)
get_tpls_list(KOKKOSFFT_TPL_LIST KOKKOSFFT_BACKEND_LIST)
# ==================================================================
# CMake Summary
# ==================================================================
message("")
message(STATUS "KokkosFFT version: ${KOKKOSFFT_VERSION_MAJOR}.${KOKKOSFFT_VERSION_MINOR}.${KOKKOSFFT_VERSION_PATCH}")
message(STATUS "KokkosFFT TPLs:")
if(KOKKOSFFT_TPL_LIST)
include(KokkosFFT_utils)
foreach(BACKEND TPL IN ZIP_LISTS KOKKOSFFT_BACKEND_LIST KOKKOSFFT_TPL_LIST)
# [TO DO] show more information about the library (like location)
pad_string(BACKEND_PADDED "${BACKEND}" 13)
message(STATUS " ${BACKEND_PADDED}: ${TPL}")
endforeach()
else()
message(STATUS " (None)")
endif()
message("")
# Googletest
if(KokkosFFT_ENABLE_TESTS)
include(CTest)
find_package(GTest CONFIG)
if(NOT GTest_FOUND)
add_subdirectory(tpls/googletest)
endif()
endif()
# Build documentation with Doxygen and Sphinx
if(KokkosFFT_ENABLE_DOCS)
find_package(Doxygen REQUIRED)
find_package(Sphinx REQUIRED)
add_subdirectory(docs)
endif()
# Benchmark
if(KokkosFFT_ENABLE_BENCHMARK)
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." OFF)
add_subdirectory(tpls/benchmark)
include(KokkosFFT_Git_Hash)
# [TO DO] Fix this, it detects benchmark not a googlebench
#find_package(benchmark QUIET)
#if(NOT benchmark_FOUND)
# add_subdirectory(tpls/benchmark)
#endif()
endif()
# Configure files to display configuration
# Configure the library
set(
PACKAGE_NAME_CONFIG_FILES
KokkosFFT_config.h
KokkosFFT_Version_Info.hpp
)
foreach(CONFIG_FILE ${PACKAGE_NAME_CONFIG_FILES})
configure_file(
cmake/${CONFIG_FILE}.in
${CMAKE_BINARY_DIR}/${CONFIG_FILE}
)
endforeach()
# Set directories used for install
include(GNUInstallDirs)
set(LIBDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
set(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
set(INSTALL_LIBDIR ${LIBDIR})
set(KokkosFFT_EXPORT_TARGET "${PROJECT_NAME}-Targets")
add_subdirectory(common)
add_subdirectory(fft)
if(KokkosFFT_ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()
# Installation
include(CMakePackageConfigHelpers)
install(
TARGETS common fft
EXPORT ${KokkosFFT_EXPORT_TARGET}
)
install(
EXPORT ${KokkosFFT_EXPORT_TARGET}
NAMESPACE KokkosFFT::
DESTINATION ${INSTALL_LIBDIR}
)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/common/src/ ${CMAKE_CURRENT_SOURCE_DIR}/fft/src/
DESTINATION ${INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.hpp"
)
install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindFFTW.cmake
DESTINATION ${INSTALL_LIBDIR}
)
configure_package_config_file(cmake/KokkosFFTConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfig.cmake
INSTALL_DESTINATION ${INSTALL_LIBDIR}
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfigVersion.cmake
VERSION ${KokkosFFT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfigVersion.cmake
DESTINATION ${INSTALL_LIBDIR}
)