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

@@ -18,39 +18,43 @@ find_package(EGL)
find_package(X11)
find_package(OpenGL)
# Source file
if(${OpenGL_FOUND})
if(${EGL_FOUND})
if(${X11_FOUND})
# Add target for EGLSync_CUDAEvent_Interop
add_executable(EGLSync_CUDAEvent_Interop EGLSync_CUDAEvent_Interop.cu)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Source file
if(${OpenGL_FOUND})
if(${EGL_FOUND})
if(${X11_FOUND})
# Add target for EGLSync_CUDAEvent_Interop
add_executable(EGLSync_CUDAEvent_Interop EGLSync_CUDAEvent_Interop.cu)
target_compile_options(EGLSync_CUDAEvent_Interop PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_options(EGLSync_CUDAEvent_Interop PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(EGLSync_CUDAEvent_Interop PRIVATE cxx_std_17 cuda_std_17)
target_compile_features(EGLSync_CUDAEvent_Interop PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(EGLSync_CUDAEvent_Interop PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties(EGLSync_CUDAEvent_Interop PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_include_directories(EGLSync_CUDAEvent_Interop PUBLIC
${CUDAToolkit_INCLUDE_DIRS}
${EGL_INCLUDE_DIR}
${X11_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR}
)
target_include_directories(EGLSync_CUDAEvent_Interop PUBLIC
${CUDAToolkit_INCLUDE_DIRS}
${EGL_INCLUDE_DIR}
${X11_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR}
)
target_link_libraries(EGLSync_CUDAEvent_Interop
CUDA::cuda_driver
#CUDA::cudart
${EGL_LIBRARY}
${X11_LIBRARIES}
${OPENGL_LIBRARIES}
)
target_link_libraries(EGLSync_CUDAEvent_Interop
CUDA::cuda_driver
#CUDA::cudart
${EGL_LIBRARY}
${X11_LIBRARIES}
${OPENGL_LIBRARIES}
)
else()
message(STATUS "X11 libraries not found - will not build sample 'EGLSyncCUDAEvent_Interop'")
endif()
else()
message(STATUS "X11 libraries not found - will not build sample 'EGLSyncCUDAEvent_Interop'")
message(STATUS "EGL not found - will not build sample 'EGLSync_CUDAEvent_Interop'")
endif()
else()
message(STATUS "EGL not found - will not build sample 'EGLSync_CUDAEvent_Interop'")
message(STATUS "OpenGL not found - will not build sample 'EGLSync_CUDAEvent_Interop'")
endif()
else()
message(STATUS "OpenGL not found - will not build sample 'EGLSync_CUDAEvent_Interop'")
endif()
message(STATUS "Will not build sample streamOrderedAllocationIPC - requires Linux OS")
endif()