mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-10-25 22:28:17 +08:00
adding code to Linux-only samples to guard against building on Windows
This commit is contained in:
@@ -16,27 +16,30 @@ include_directories(../../../Common)
|
||||
|
||||
find_package(EGL)
|
||||
|
||||
# Source file
|
||||
if(${EGL_FOUND})
|
||||
# Add target for EGLStream_CUDA_CrossGPU
|
||||
add_executable(EGLStream_CUDA_CrossGPU cuda_consumer.cpp cuda_producer.cpp eglstrm_common.cpp kernel.cu main.cpp)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# Source file
|
||||
if(${EGL_FOUND})
|
||||
# Add target for EGLStream_CUDA_CrossGPU
|
||||
add_executable(EGLStream_CUDA_CrossGPU cuda_consumer.cpp cuda_producer.cpp eglstrm_common.cpp kernel.cu main.cpp)
|
||||
|
||||
target_compile_options(EGLStream_CUDA_CrossGPU PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
|
||||
target_compile_options(EGLStream_CUDA_CrossGPU PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
|
||||
|
||||
target_compile_features(EGLStream_CUDA_CrossGPU PRIVATE cxx_std_17 cuda_std_17)
|
||||
target_compile_features(EGLStream_CUDA_CrossGPU PRIVATE cxx_std_17 cuda_std_17)
|
||||
|
||||
set_target_properties(EGLStream_CUDA_CrossGPU PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||
set_target_properties(EGLStream_CUDA_CrossGPU PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||
|
||||
target_include_directories(EGLStream_CUDA_CrossGPU PUBLIC
|
||||
${EGL_INCLUDE_DIR}
|
||||
${CUDAToolkit_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(EGLStream_CUDA_CrossGPU
|
||||
${EGL_LIBRARY}
|
||||
CUDA::cuda_driver
|
||||
)
|
||||
target_include_directories(EGLStream_CUDA_CrossGPU PUBLIC
|
||||
${EGL_INCLUDE_DIR}
|
||||
${CUDAToolkit_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(EGLStream_CUDA_CrossGPU
|
||||
${EGL_LIBRARY}
|
||||
CUDA::cuda_driver
|
||||
)
|
||||
else()
|
||||
message(STATUS "EGL not found - will not build sample 'EGLStream_CUDA_CrossGPU'")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "EGL not found - will not build sample 'EGLStream_CUDA_CrossGPU'")
|
||||
message(STATUS "Will not build sample EGLStream_CUDA_CrossGPU - requires Linux OS")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user