Commit 440dc98b authored by Raul Tambre's avatar Raul Tambre
Browse files

CUDA: Clang CUDA 11.1 support

version.txt is gone from CUDA 11.1 installations, but the rest is the same.
Instead of looking for version.txt look for <CUDA path>/nvvm/libdevice, which
is the main thing that Clang requires (though it also checks for the existence
of bin and include).

Fixes #21353.
parent 4549027a
...@@ -346,3 +346,5 @@ Changes made since CMake 3.19.0 include the following. ...@@ -346,3 +346,5 @@ Changes made since CMake 3.19.0 include the following.
it can break projects that were using the property only to it can break projects that were using the property only to
cause the specified language's compiler to be used. This has cause the specified language's compiler to be used. This has
been reverted to restore behavior from CMake 3.18 and below. been reverted to restore behavior from CMake 3.18 and below.
* CUDA 11.1 support for Clang.
...@@ -176,12 +176,12 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) ...@@ -176,12 +176,12 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
# In a non-scattered installation the following are equivalent to CMAKE_CUDA_COMPILER_TOOLKIT_ROOT. # In a non-scattered installation the following are equivalent to CMAKE_CUDA_COMPILER_TOOLKIT_ROOT.
# We first check for a non-scattered installation to prefer it over a scattered installation. # We first check for a non-scattered installation to prefer it over a scattered installation.
# CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library and version file. # CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library.
if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/version.txt") if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/nvvm/libdevice")
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/version.txt") elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/nvvm/libdevice")
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/cuda") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/cuda")
elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/version.txt") elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/nvvm/libdevice")
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT}/usr/lib/cuda") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT}/usr/lib/cuda")
endif() endif()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment