summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-11-03 12:22:45 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-11-03 12:22:54 (GMT)
commit37d75e5fdd1c045f97ea7cdeb0c5227b525f2b3f (patch)
tree915543fead8070a4d16bf9856fe3d0892b49ced4
parent15578c465a19a21c570d384ae1ce932f507f009a (diff)
parent0832516beca1e5b04da26f73e526efcd55727b82 (diff)
downloadCMake-37d75e5fdd1c045f97ea7cdeb0c5227b525f2b3f.zip
CMake-37d75e5fdd1c045f97ea7cdeb0c5227b525f2b3f.tar.gz
CMake-37d75e5fdd1c045f97ea7cdeb0c5227b525f2b3f.tar.bz2
Merge topic 'fix-cuda-qnx' into release-3.19
0832516bec Help: Add 3.19 release note about CUDA support on QNX bcdd486bf7 CUDA: Enable support on QNX Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Raul Tambre <raul@tambre.ee> Merge-request: !5446
-rw-r--r--Help/release/3.19.rst2
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake2
-rw-r--r--Modules/FindCUDA.cmake4
-rw-r--r--Modules/FindCUDAToolkit.cmake4
4 files changed, 9 insertions, 3 deletions
diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst
index 6e46452..7f6e44c 100644
--- a/Help/release/3.19.rst
+++ b/Help/release/3.19.rst
@@ -51,6 +51,8 @@ Languages
- separable compilation (:prop_tgt:`CUDA_SEPARABLE_COMPILATION`), and
- finding scattered toolkit installations when cross-compiling.
+* ``CUDA`` language support now works on QNX.
+
File-Based API
--------------
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 1a724a0..95a51f6 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -64,7 +64,7 @@ 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)
+if(UNIX AND NOT (CMAKE_SYSTEM_NAME STREQUAL "QNX"))
list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl")
endif()
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index a93d4fd..f04f571 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -732,6 +732,8 @@ if(CMAKE_CROSSCOMPILING)
# Support for aarch64 cross compilation
if (ANDROID_ARCH_NAME STREQUAL "arm64")
set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux-androideabi")
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "QNX")
+ set(CUDA_TOOLKIT_TARGET_NAME "aarch64-qnx")
else()
set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux")
endif (ANDROID_ARCH_NAME STREQUAL "arm64")
@@ -902,7 +904,7 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME)
find_package(Threads REQUIRED)
set(CMAKE_C_FLAGS ${_cuda_cmake_c_flags})
- if(NOT APPLE)
+ if(NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "QNX"))
#On Linux, you must link against librt when using the static cuda runtime.
find_library(CUDA_rt_LIBRARY rt)
if (NOT CUDA_rt_LIBRARY)
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index b4599a3..b3c8569 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -678,6 +678,8 @@ if(CMAKE_CROSSCOMPILING)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
if(ANDROID_ARCH_NAME STREQUAL "arm64")
set(CUDAToolkit_TARGET_NAME "aarch64-linux-androideabi")
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "QNX")
+ set(CUDAToolkit_TARGET_NAME "aarch64-qnx")
else()
set(CUDAToolkit_TARGET_NAME "aarch64-linux")
endif(ANDROID_ARCH_NAME STREQUAL "arm64")
@@ -860,7 +862,7 @@ if(CUDAToolkit_FOUND)
target_link_libraries(CUDA::cudart_static_deps INTERFACE Threads::Threads ${CMAKE_DL_LIBS})
endif()
- if(UNIX AND NOT APPLE)
+ if(UNIX AND NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "QNX"))
# On Linux, you must link against librt when using the static cuda runtime.
find_library(CUDAToolkit_rt_LIBRARY rt)
mark_as_advanced(CUDAToolkit_rt_LIBRARY)