mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-10-25 22:28:17 +08:00
Bug 5133197: Add cmake toolchain and and update the CMakeList of some sample for tegra linux cross build
This commit is contained in:
@@ -18,31 +18,10 @@ endif()
|
||||
# Include directories and libraries
|
||||
include_directories(../../../Common)
|
||||
|
||||
find_package(NVSCI)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# Find the NVSCI libraries
|
||||
# use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command
|
||||
set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH})
|
||||
foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH})
|
||||
file(GLOB_RECURSE NVSCIBUF_LIB
|
||||
${LIBRARY_PATH}/libnvscibuf.so
|
||||
${LIBRARY_PATH}/*/libnvscibuf.so
|
||||
)
|
||||
file(GLOB_RECURSE NVSCISYNC_LIB
|
||||
${LIBRARY_PATH}/libnvscisync.so
|
||||
${LIBRARY_PATH}/*/libnvscisync.so
|
||||
)
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Find the NVSCI header files
|
||||
# use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command
|
||||
set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH})
|
||||
find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR)
|
||||
if(NVSCI_FOUND)
|
||||
message(STATUS "FOUND NVSCI libs: ${NVSCIBUF_LIB} ${NVSCISYNC_LIB}")
|
||||
message(STATUS "Using NVSCI headers path: ${NVSCIBUF_INCLUDE_DIR} ${NVSCIBUF_INCLUDE_DIR}")
|
||||
# Source file
|
||||
@@ -57,14 +36,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
||||
target_include_directories(cudaNvSci PUBLIC
|
||||
${CUDAToolkit_INCLUDE_DIRS}
|
||||
${NVSCIBUF_INCLUDE_DIR}
|
||||
${NVSCISYNC_INCLUDE_DIR}
|
||||
${NVSCI_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(cudaNvSci
|
||||
CUDA::cuda_driver
|
||||
${NVSCIBUF_LIB}
|
||||
${NVSCISYNC_LIB}
|
||||
${NVSCI_LIBRARIES}
|
||||
)
|
||||
# Copy teapot1024.ppm to the output directory
|
||||
add_custom_command(TARGET cudaNvSci POST_BUILD
|
||||
|
||||
@@ -27,25 +27,16 @@ target_compile_features(jitLto PRIVATE cxx_std_17 cuda_std_17)
|
||||
|
||||
set_target_properties(jitLto PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||
|
||||
find_library(NVJITLINK_LIB
|
||||
NAME nvJitLink
|
||||
PATHS "${CUDAToolkit_LIBRARY_DIR}" "${CMAKE_LIBRARY_PATH}")
|
||||
|
||||
target_include_directories(jitLto PRIVATE
|
||||
${CUDAToolkit_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
|
||||
target_link_libraries(jitLto PRIVATE
|
||||
CUDA::cuda_driver
|
||||
CUDA::nvrtc
|
||||
)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
target_link_libraries(jitLto PRIVATE
|
||||
${CUDAToolkit_LIBRARY_DIR}/libnvJitLink.so
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_link_libraries(jitLto PRIVATE
|
||||
${CUDAToolkit_LIBRARY_DIR}/nvJitLink.lib
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(jitLto PRIVATE
|
||||
CUDA::cuda_driver
|
||||
CUDA::nvrtc
|
||||
${NVJITLINK_LIB}
|
||||
)
|
||||
|
||||
@@ -28,9 +28,13 @@ include(CheckIncludeFile)
|
||||
check_include_file("GLFW/glfw3.h" HAVE_GLFW3_H)
|
||||
|
||||
# Find GLFW header and lib for Windows
|
||||
if(WIN32)
|
||||
find_file(GLFW3_H "GLFW/glfw3.h" PATH "${GLFW_INCLUDE_DIR}")
|
||||
find_library(GLFW3_LIB "glfw3" PATH "${GLFW_LIB_DIR}")
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
set(GLFW_INCLUDE_DIRS "${GLFW_INCLUDE_DIR}" "${CMAKE_INCLUDE_PATH}")
|
||||
find_file(GLFW3_H "GLFW/glfw3.h" PATHS ${GLFW_INCLUDE_DIRS})
|
||||
find_library(GLFW3_LIB
|
||||
NAMES glfw3 glfw
|
||||
PATHS "${GLFW_LIB_DIR}"
|
||||
PATH_SUFFIXES lib lib64)
|
||||
if(GLFW3_H AND GLFW3_LIB)
|
||||
message(STATUS "Found GLFW/glfw3.h and GLFW library.")
|
||||
set(HAVE_GLFW3_H 1)
|
||||
@@ -58,9 +62,9 @@ if(${Vulkan_FOUND})
|
||||
${Vulkan_LIBRARIES}
|
||||
OpenGL::GL
|
||||
)
|
||||
if(WIN32)
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
target_include_directories(simpleVulkan PUBLIC
|
||||
${GLFW_INCLUDE_DIR}
|
||||
${GLFW_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(simpleVulkan
|
||||
${GLFW3_LIB}
|
||||
|
||||
@@ -27,9 +27,13 @@ include(CheckIncludeFile)
|
||||
check_include_file("GLFW/glfw3.h" HAVE_GLFW3_H)
|
||||
|
||||
# Find GLFW header and lib for Windows
|
||||
if(WIN32)
|
||||
find_file(GLFW3_H "GLFW/glfw3.h" PATH "${GLFW_INCLUDE_DIR}")
|
||||
find_library(GLFW3_LIB "glfw3" PATH "${GLFW_LIB_DIR}")
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
set(GLFW_INCLUDE_DIRS "${GLFW_INCLUDE_DIR}" "${CMAKE_INCLUDE_PATH}")
|
||||
find_file(GLFW3_H "GLFW/glfw3.h" PATHS ${GLFW_INCLUDE_DIRS})
|
||||
find_library(GLFW3_LIB
|
||||
NAMES glfw3 glfw
|
||||
PATHS "${GLFW_LIB_DIR}"
|
||||
PATH_SUFFIXES lib lib64)
|
||||
if(GLFW3_H AND GLFW3_LIB)
|
||||
message(STATUS "Found GLFW/glfw3.h and GLFW library.")
|
||||
set(HAVE_GLFW3_H 1)
|
||||
@@ -58,9 +62,9 @@ if(${Vulkan_FOUND})
|
||||
OpenGL::GL
|
||||
CUDA::cuda_driver
|
||||
)
|
||||
if(WIN32)
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
target_include_directories(simpleVulkanMMAP PUBLIC
|
||||
${GLFW_INCLUDE_DIR}
|
||||
${GLFW_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(simpleVulkanMMAP
|
||||
${GLFW3_LIB}
|
||||
|
||||
@@ -27,9 +27,13 @@ include(CheckIncludeFile)
|
||||
check_include_file("GLFW/glfw3.h" HAVE_GLFW3_H)
|
||||
|
||||
# Find GLFW header and lib for Windows
|
||||
if(WIN32)
|
||||
find_file(GLFW3_H "GLFW/glfw3.h" PATH "${GLFW_INCLUDE_DIR}")
|
||||
find_file(GLFW3_LIB "glfw3" PATH "${GLFW_LIB_DIR}")
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
set(GLFW_INCLUDE_DIRS "${GLFW_INCLUDE_DIR}" "${CMAKE_INCLUDE_PATH}")
|
||||
find_file(GLFW3_H "GLFW/glfw3.h" PATHS ${GLFW_INCLUDE_DIRS})
|
||||
find_library(GLFW3_LIB
|
||||
NAMES glfw3 glfw
|
||||
PATHS "${GLFW_LIB_DIR}"
|
||||
PATH_SUFFIXES lib lib64)
|
||||
if(GLFW3_H AND GLFW3_LIB)
|
||||
message(STATUS "Found GLFW/glfw3.h and GLFW library.")
|
||||
set(HAVE_GLFW3_H 1)
|
||||
@@ -57,9 +61,9 @@ if(${Vulkan_FOUND})
|
||||
${Vulkan_LIBRARIES}
|
||||
OpenGL::GL
|
||||
)
|
||||
if(WIN32)
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
target_include_directories(vulkanImageCUDA PUBLIC
|
||||
${GLFW_INCLUDE_DIR}
|
||||
${GLFW_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(vulkanImageCUDA
|
||||
${GLFW3_LIB}
|
||||
|
||||
@@ -82,7 +82,12 @@ message(STATUS "Using libnvvm library: ${NVVM_LIB}")
|
||||
|
||||
# Set the rpath to libnvvm.
|
||||
find_path(LIBNVVM_RPATH lib lib64 PATHS "$ENV{LIBNVVM_HOME}" "${CUDA_HOME}")
|
||||
get_filename_component(LIBNVVM_RPATH ${NVVM_LIB} DIRECTORY)
|
||||
if(DEFINED RUNTIME_LIBNVVM_PATH)
|
||||
message(STATUS "Using RUNTIME_LIBNVVM_PATH: ${RUNTIME_LIBNVVM_PATH}")
|
||||
set(LIBNVVM_RPATH ${RUNTIME_LIBNVVM_PATH})
|
||||
else()
|
||||
get_filename_component(LIBNVVM_RPATH ${NVVM_LIB} DIRECTORY)
|
||||
endif()
|
||||
set(CMAKE_INSTALL_RPATH "${LIBNVVM_RPATH}")
|
||||
message(STATUS "Using rpath: ${CMAKE_INSTALL_RPATH}")
|
||||
|
||||
|
||||
@@ -33,12 +33,18 @@ set_tests_properties(ptxgenTest PROPERTIES FIXTURES_SETUP PTXGENTEST)
|
||||
|
||||
target_link_libraries(ptxgen ${NVVM_LIB})
|
||||
|
||||
if (DEFINED RUNTIME_LIBNVVM_PATH)
|
||||
get_filename_component(_LIBNVVM_HOME "${RUNTIME_LIBNVVM_PATH}" DIRECTORY)
|
||||
else ()
|
||||
set(_LIBNVVM_HOME "${LIBNVVM_HOME}")
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
set_target_properties(ptxgen PROPERTIES
|
||||
COMPILE_FLAGS "/wd4996 -DLIBNVVM_HOME=\"${LIBNVVM_HOME}\"")
|
||||
else (WIN32)
|
||||
set_target_properties(ptxgen PROPERTIES
|
||||
COMPILE_FLAGS "-DLIBNVVM_HOME=\"${LIBNVVM_HOME}\""
|
||||
COMPILE_FLAGS "-DLIBNVVM_HOME=\"${_LIBNVVM_HOME}\""
|
||||
LINK_FLAGS "-Wl,-rpath,${LIBNVVM_RPATH}")
|
||||
endif (WIN32)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ endif()
|
||||
# Include directories and libraries
|
||||
include_directories(../../../../Common)
|
||||
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if(CUDLA_LIB)
|
||||
|
||||
@@ -18,7 +18,7 @@ endif()
|
||||
# Include directories and libraries
|
||||
include_directories(../../../../Common)
|
||||
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if(CUDLA_LIB)
|
||||
|
||||
@@ -18,7 +18,7 @@ endif()
|
||||
# Include directories and libraries
|
||||
include_directories(../../../../Common)
|
||||
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if(CUDLA_LIB)
|
||||
|
||||
@@ -18,34 +18,12 @@ endif()
|
||||
# Include directories and libraries
|
||||
include_directories(../../../../Common)
|
||||
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
|
||||
find_package(NVSCI)
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if(CUDLA_LIB)
|
||||
# Find the NVSCI libraries
|
||||
# use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command
|
||||
set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH})
|
||||
foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH})
|
||||
file(GLOB_RECURSE NVSCIBUF_LIB
|
||||
${LIBRARY_PATH}/libnvscibuf.so
|
||||
${LIBRARY_PATH}/*/libnvscibuf.so
|
||||
)
|
||||
file(GLOB_RECURSE NVSCISYNC_LIB
|
||||
${LIBRARY_PATH}/libnvscisync.so
|
||||
${LIBRARY_PATH}/*/libnvscisync.so
|
||||
)
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Find the NVSCI header files
|
||||
# use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command
|
||||
set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH})
|
||||
find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR)
|
||||
if(NVSCI_FOUND)
|
||||
# Source file
|
||||
# Add target for cuDLALayerwiseStatsStandalone
|
||||
add_executable(cuDLALayerwiseStatsStandalone main.cpp)
|
||||
@@ -58,14 +36,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
||||
target_include_directories(cuDLALayerwiseStatsStandalone PUBLIC
|
||||
${CUDAToolkit_INCLUDE_DIRS}
|
||||
${NVSCIBUF_INCLUDE_DIR}
|
||||
${NVSCISYNC_INCLUDE_DIR}
|
||||
${NVSCI_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(cuDLALayerwiseStatsStandalone
|
||||
${CUDLA_LIB}
|
||||
${NVSCIBUF_LIB}
|
||||
${NVSCISYNC_LIB}
|
||||
${NVSCI_LIBRARIES}
|
||||
)
|
||||
else()
|
||||
message(STATUS "NvSCI not found - will not build sample 'cuDLALayerwiseStatsStandalone'")
|
||||
|
||||
@@ -18,34 +18,12 @@ endif()
|
||||
# Include directories and libraries
|
||||
include_directories(../../../../Common)
|
||||
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
|
||||
find_package(NVSCI)
|
||||
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if(CUDLA_LIB)
|
||||
# Find the NVSCI libraries
|
||||
# use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command
|
||||
set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH})
|
||||
foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH})
|
||||
file(GLOB_RECURSE NVSCIBUF_LIB
|
||||
${LIBRARY_PATH}/libnvscibuf.so
|
||||
${LIBRARY_PATH}/*/libnvscibuf.so
|
||||
)
|
||||
file(GLOB_RECURSE NVSCISYNC_LIB
|
||||
${LIBRARY_PATH}/libnvscisync.so
|
||||
${LIBRARY_PATH}/*/libnvscisync.so
|
||||
)
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Find the NVSCI header files
|
||||
# use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command
|
||||
set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH})
|
||||
find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR)
|
||||
if(NVSCI_FOUND)
|
||||
# Source file
|
||||
# Add target for cuDLAStandaloneMode
|
||||
add_executable(cuDLAStandaloneMode main.cpp)
|
||||
@@ -58,14 +36,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
||||
target_include_directories(cuDLAStandaloneMode PUBLIC
|
||||
${CUDAToolkit_INCLUDE_DIRS}
|
||||
${NVSCIBUF_INCLUDE_DIR}
|
||||
${NVSCISYNC_INCLUDE_DIR}
|
||||
${NVSCI_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(cuDLAStandaloneMode
|
||||
${CUDLA_LIB}
|
||||
${NVSCIBUF_LIB}
|
||||
${NVSCISYNC_LIB}
|
||||
${NVSCI_LIBRARIES}
|
||||
)
|
||||
else()
|
||||
message(STATUS "NvSCI not found - will not build sample 'cuDLAStandaloneMode'")
|
||||
|
||||
@@ -18,33 +18,10 @@ endif()
|
||||
# Include directories and libraries
|
||||
include_directories(../../../../Common)
|
||||
|
||||
find_package(NVSCI)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# Find the NVSCI libraries
|
||||
# use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command
|
||||
set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH})
|
||||
foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH})
|
||||
file(GLOB_RECURSE NVSCIBUF_LIB
|
||||
${LIBRARY_PATH}/libnvscibuf.so
|
||||
${LIBRARY_PATH}/*/libnvscibuf.so
|
||||
)
|
||||
file(GLOB_RECURSE NVSCISYNC_LIB
|
||||
${LIBRARY_PATH}/libnvscisync.so
|
||||
${LIBRARY_PATH}/*/libnvscisync.so
|
||||
)
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Find the NVSCI header files
|
||||
# use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command
|
||||
set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH})
|
||||
find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR)
|
||||
message(STATUS "FOUND NVSCI libs: ${NVSCIBUF_LIB} ${NVSCISYNC_LIB}")
|
||||
message(STATUS "Using NVSCI headers path: ${NVSCIBUF_INCLUDE_DIR} ${NVSCIBUF_INCLUDE_DIR}")
|
||||
if(NVSCI_FOUND)
|
||||
# Source file
|
||||
# Add target for cudaNvSciBufMultiplanar
|
||||
add_executable(cudaNvSciBufMultiplanar imageKernels.cu cudaNvSciBufMultiplanar.cpp main.cpp)
|
||||
@@ -57,14 +34,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
||||
target_include_directories(cudaNvSciBufMultiplanar PUBLIC
|
||||
${CUDAToolkit_INCLUDE_DIRS}
|
||||
${NVSCIBUF_INCLUDE_DIR}
|
||||
${NVSCISYNC_INCLUDE_DIR}
|
||||
${NVSCI_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(cudaNvSciBufMultiplanar
|
||||
CUDA::cuda_driver
|
||||
${NVSCIBUF_LIB}
|
||||
${NVSCISYNC_LIB}
|
||||
${NVSCI_LIBRARIES}
|
||||
)
|
||||
# Copy yuv_planar_img1.yuv to the output directory
|
||||
add_custom_command(TARGET cudaNvSciBufMultiplanar POST_BUILD
|
||||
|
||||
@@ -18,24 +18,18 @@ endif()
|
||||
# Include directories and libraries
|
||||
include_directories(../../../../Common)
|
||||
|
||||
find_package(NVSCI)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# Find the NVSCI/NVMEDIA libraries
|
||||
# use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command
|
||||
set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH})
|
||||
foreach(LIBRARY_PATH ${CMAKE_LIBRARY_PATH})
|
||||
file(GLOB_RECURSE NVSCIBUF_LIB
|
||||
${LIBRARY_PATH}/libnvscibuf.so
|
||||
${LIBRARY_PATH}/*/libnvscibuf.so
|
||||
)
|
||||
file(GLOB_RECURSE NVSCISYNC_LIB
|
||||
${LIBRARY_PATH}/libnvscisync.so
|
||||
${LIBRARY_PATH}/*/libnvscisync.so
|
||||
)
|
||||
file(GLOB_RECURSE NVMEDIA_LIB
|
||||
${LIBRARY_PATH}/libnvmedia.so
|
||||
${LIBRARY_PATH}/*/libnvmedia.so
|
||||
)
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVMEDIA_LIB)
|
||||
if(NVMEDIA_LIB)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -47,13 +41,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
"/usr/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/include"
|
||||
${CMAKE_LIBRARY_PATH}
|
||||
)
|
||||
find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
find_path(NVMEDIA_INCLUDE_DIR nvmedia_core.h PATHS ${CMAKE_INCLUDE_PATH})
|
||||
|
||||
if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR)
|
||||
message(STATUS "FOUND NVSCI libs: ${NVSCIBUF_LIB} ${NVSCISYNC_LIB}")
|
||||
message(STATUS "Using NVSCI headers path: ${NVSCIBUF_INCLUDE_DIR} ${NVSCIBUF_INCLUDE_DIR}")
|
||||
if(NVSCI_FOUND)
|
||||
if(NVMEDIA_LIB AND NVMEDIA_INCLUDE_DIR)
|
||||
message(STATUS "FOUND NVMEDIA libs: ${NVMEDIA_LIB}")
|
||||
message(STATUS "Using NVMEDIA headers path: ${NVMEDIA_INCLUDE_DIR}")
|
||||
@@ -69,15 +59,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
||||
target_include_directories(cudaNvSciNvMedia PUBLIC
|
||||
${CUDAToolkit_INCLUDE_DIRS}
|
||||
${NVSCIBUF_INCLUDE_DIR}
|
||||
${NVSCISYNC_INCLUDE_DIR}
|
||||
${NVSCI_INCLUDE_DIRS}
|
||||
${NVMEDIA_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(cudaNvSciNvMedia
|
||||
CUDA::cuda_driver
|
||||
${NVSCIBUF_LIB}
|
||||
${NVSCISYNC_LIB}
|
||||
${NVSCI_LIBRARIES}
|
||||
${NVMEDIA_LIB}
|
||||
)
|
||||
# Copy teapot.rgba to the output directory
|
||||
|
||||
@@ -26,7 +26,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if(${OpenGL_FOUND})
|
||||
if(${EGL_FOUND})
|
||||
if(${X11_FOUND})
|
||||
set(DRM_INCLUDE_PATH "/usr/include/drm" "/usr/include/libdrm")
|
||||
set(DRM_INCLUDE_PATH "/usr/include/drm" "/usr/include/libdrm" ${CMAKE_INCLUDE_PATH})
|
||||
|
||||
# use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command
|
||||
set(CMAKE_LIBRARY_PATH "/usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu" ${CMAKE_LIBRARY_PATH})
|
||||
|
||||
Reference in New Issue
Block a user