mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-11-18 09:58:18 +08:00
CUDA 13.4 samples update - v13.4-public
Release 13.4 of the CUDA Samples supported by CUDA Toolkit 13.4. See Changelog for more information.
This commit is contained in:
@@ -35,3 +35,50 @@ add_link_options("-V${__qnx_gcc_ver},gcc_ntoaarch64le")
|
||||
set(CROSS_COMPILE_FOR_QNX ON CACHE BOOL "Cross compiling for QNX platforms")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -D_QNX_SOURCE")
|
||||
string(APPEND CMAKE_CUDA_FLAGS " -D_QNX_SOURCE")
|
||||
|
||||
# cudaNvSci needs NvSci headers/libs from the QNX rootfs; point TARGET_FS at it. This pre-seeds
|
||||
# FindNVSCI's cache vars and auto-detects the header/lib dirs across rootfs layouts.
|
||||
if(DEFINED TARGET_FS)
|
||||
# Expand a leading ~ so paths reach the linker absolute.
|
||||
if(TARGET_FS MATCHES "^~")
|
||||
string(REGEX REPLACE "^~" "$ENV{HOME}" TARGET_FS "${TARGET_FS}")
|
||||
endif()
|
||||
get_filename_component(_nvsci_sdk_root "${TARGET_FS}" DIRECTORY)
|
||||
|
||||
# Header dir varies by rootfs layout. Both headers are required, so accept a dir only if it
|
||||
# holds both.
|
||||
foreach(_inc "${TARGET_FS}/include" "${_nvsci_sdk_root}/include" "${TARGET_FS}/usr/include")
|
||||
if(NOT _nvsci_inc AND EXISTS "${_inc}/nvscibuf.h" AND EXISTS "${_inc}/nvscisync.h")
|
||||
set(_nvsci_inc "${_inc}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Lib dir varies by rootfs layout. FindNVSCI needs both libraries, so accept a dir only if it
|
||||
# holds both.
|
||||
foreach(_lib "${TARGET_FS}/lib-target" "${TARGET_FS}/usr/libnvidia" "${TARGET_FS}/usr/lib")
|
||||
if(NOT _nvsci_lib AND EXISTS "${_lib}/libnvscibuf.so" AND EXISTS "${_lib}/libnvscisync.so")
|
||||
set(_nvsci_lib "${_lib}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# A rootfs without NvSci is not an error: FindNVSCI then reports NvSci as missing and only the
|
||||
# NvSci samples are skipped.
|
||||
if(_nvsci_inc AND _nvsci_lib)
|
||||
set(NVSCIBUF_INCLUDE_DIR "${_nvsci_inc}" CACHE PATH "NvSciBuf headers")
|
||||
set(NVSCISYNC_INCLUDE_DIR "${_nvsci_inc}" CACHE PATH "NvSciSync headers")
|
||||
set(NVSCIBUF_LIBRARY "${_nvsci_lib}/libnvscibuf.so" CACHE FILEPATH "NvSciBuf library")
|
||||
set(NVSCISYNC_LIBRARY "${_nvsci_lib}/libnvscisync.so" CACHE FILEPATH "NvSciSync library")
|
||||
|
||||
# rpath-link the rootfs lib dirs so NvSci's transitive deps resolve at link time.
|
||||
# NvSci pulls in NvRm/NvOs/NvSciIpc, which can sit in a lib dir of their own.
|
||||
foreach(_dir "${_nvsci_lib}" "${TARGET_FS}/lib-target" "${_nvsci_sdk_root}/lib-target"
|
||||
"${TARGET_FS}/usr/libnvidia" "${TARGET_FS}/usr/lib")
|
||||
if(IS_DIRECTORY "${_dir}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,${_dir}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath-link,${_dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
message(STATUS "NvSci headers/libs not found in TARGET_FS='${TARGET_FS}'")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user