mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
CUDA: Enable support on QNX
This fixes the following two issues with the CUDA support on QNX: * cuda target name is not derived correctly (should be `aarch64-qnx`). * linking `cudart` must not be linked against `rt`, `dl`, `pthread`. This enables to use cmake's native cuda support on QNX. Fixes: #21381
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user