forked from esa-tu-darmstadt/spn-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCudaToolkit.cmake
29 lines (26 loc) · 1.45 KB
/
CudaToolkit.cmake
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
# ==============================================================================
# This file is part of the SPNC project under the Apache License v2.0 by the
# Embedded Systems and Applications Group, TU Darmstadt.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
# SPDX-License-Identifier: Apache-2.0
# ==============================================================================
macro(cuda_setup)
# TODO: The old FindCUDA is deprecated, the new FindCUDAToolkit is only available in version > 3.17.
# Use this feature here after upgrading the required CMake version.
find_package(CUDA)
if (NOT CUDA_FOUND)
message(FATAL_ERROR "Targeting CUDA GPUs requires a working CUDA install, try setting CUDA_TOOLKIT_ROOT_DIR")
else ()
message(STATUS "Using CUDA ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} from ${CUDA_TOOLKIT_ROOT_DIR}")
message(STATUS "Using CUDA runtime headers: " ${CUDA_INCLUDE_DIRS})
endif ()
# When compiling for CUDA GPUs, the compiler will invoke the PTX compiler and linker
# through the CUDA runtime library API.
find_library(CUDA_RUNTIME_LIBRARY cuda)
if (NOT CUDA_RUNTIME_LIBRARY)
message(FATAL_ERROR "CUDA runtime library not found. Set location manually through CUDA_RUNTIME_LIBRARY")
else ()
message(STATUS "Using CUDA runtime library: " ${CUDA_RUNTIME_LIBRARY})
endif ()
endmacro(cuda_setup)