summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Windows-NVIDIA-CUDA.cmake
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2020-03-07 15:29:29 (GMT)
committerRaul Tambre <raul@tambre.ee>2020-05-15 14:46:51 (GMT)
commit5df21adf46be14061fe0e8ea53213d905e834600 (patch)
tree9e50ef0dc770d6ad68eede0ad04e5058d1775069 /Modules/Platform/Windows-NVIDIA-CUDA.cmake
parentdc2eae1f91f98019efe14c1398e10f23e93a7005 (diff)
downloadCMake-5df21adf46be14061fe0e8ea53213d905e834600.zip
CMake-5df21adf46be14061fe0e8ea53213d905e834600.tar.gz
CMake-5df21adf46be14061fe0e8ea53213d905e834600.tar.bz2
CUDA: Add support for Clang compiler
When crosscompiling we pass the sysroot. We need to try various architecture flags. Clang doesn't automatically select one that works. First try the ones that are more likely to work for modern installations: * <=sm_50 is deprecated since CUDA 10.2, try sm_52 first for future compatibility. * <=sm_20 is removed since CUDA 9.0, try sm_30. Otherwise fallback to Clang's current default. Currently that's `sm_20`, the lowest it supports. Separable compilation isn't supported yet. Fixes: #16586
Diffstat (limited to 'Modules/Platform/Windows-NVIDIA-CUDA.cmake')
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index f425cf8..f887594 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -74,6 +74,10 @@ set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "")
+if(UNIX)
+ list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl")
+endif()
+
string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"${_W3}${_FLAGS_CXX}\"")
string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"${_MDd}-Zi -Ob0 -Od ${_RTC1}\"")
string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"${_MD}-O2 -Ob2\" -DNDEBUG")