adding code to Linux-only samples to guard against building on Windows

This commit is contained in:
Jonathan Bentz
2024-12-18 14:36:12 -06:00
parent fcd39008ec
commit f9dd4323af
11 changed files with 158 additions and 117 deletions

View File

@@ -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()