mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-01-08 10:27:49 +08:00
Bug 5454390: Add specific glfw3/X11 link for vulkan samples
This commit is contained in:
parent
6e23a98575
commit
cbc075ef59
@ -29,8 +29,17 @@ include(CheckIncludeFile)
|
||||
# Check for the GLFW/glfw3.h header
|
||||
check_include_file("GLFW/glfw3.h" HAVE_GLFW3_H)
|
||||
|
||||
# Find GLFW header and lib for Windows
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
# Check for SUSE Linux
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
file(READ "/etc/os-release" OS_RELEASE_CONTENTS)
|
||||
if(OS_RELEASE_CONTENTS MATCHES "ID=[^ ]*suse[^ ]*")
|
||||
message(STATUS "SUSE Linux detected")
|
||||
set(SUSE_LINUX TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find GLFW header and lib for Windows and SUSE Linux
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING OR SUSE_LINUX)
|
||||
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
|
||||
@ -64,7 +73,7 @@ if(${Vulkan_FOUND})
|
||||
${Vulkan_LIBRARIES}
|
||||
OpenGL::GL
|
||||
)
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING OR SUSE_LINUX)
|
||||
target_include_directories(simpleVulkan PUBLIC
|
||||
${GLFW_INCLUDE_DIRS}
|
||||
)
|
||||
@ -76,6 +85,12 @@ if(${Vulkan_FOUND})
|
||||
glfw
|
||||
)
|
||||
endif()
|
||||
# Need to add X11 for SUSE Linux explicitly
|
||||
if(SUSE_LINUX)
|
||||
target_link_libraries(simpleVulkan
|
||||
X11
|
||||
)
|
||||
endif()
|
||||
add_custom_command(TARGET simpleVulkan POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sinewave.frag
|
||||
|
||||
@ -28,8 +28,17 @@ include(CheckIncludeFile)
|
||||
# Check for the GLFW/glfw3.h header
|
||||
check_include_file("GLFW/glfw3.h" HAVE_GLFW3_H)
|
||||
|
||||
# Find GLFW header and lib for Windows
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
# Check for SUSE Linux
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
file(READ "/etc/os-release" OS_RELEASE_CONTENTS)
|
||||
if(OS_RELEASE_CONTENTS MATCHES "ID=[^ ]*suse[^ ]*")
|
||||
message(STATUS "SUSE Linux detected")
|
||||
set(SUSE_LINUX TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find GLFW header and lib for Windows and SUSE Linux
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING OR SUSE_LINUX)
|
||||
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
|
||||
@ -64,7 +73,7 @@ if(${Vulkan_FOUND})
|
||||
OpenGL::GL
|
||||
CUDA::cuda_driver
|
||||
)
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING OR SUSE_LINUX)
|
||||
target_include_directories(simpleVulkanMMAP PUBLIC
|
||||
${GLFW_INCLUDE_DIRS}
|
||||
)
|
||||
@ -76,6 +85,12 @@ if(${Vulkan_FOUND})
|
||||
glfw
|
||||
)
|
||||
endif()
|
||||
# Need to add X11 for SUSE Linux explicitly
|
||||
if(SUSE_LINUX)
|
||||
target_link_libraries(simpleVulkanMMAP
|
||||
X11
|
||||
)
|
||||
endif()
|
||||
add_custom_command(TARGET simpleVulkanMMAP POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/montecarlo.frag
|
||||
|
||||
@ -28,8 +28,17 @@ include(CheckIncludeFile)
|
||||
# Check for the GLFW/glfw3.h header
|
||||
check_include_file("GLFW/glfw3.h" HAVE_GLFW3_H)
|
||||
|
||||
# Find GLFW header and lib for Windows
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
# Check for SUSE Linux
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
file(READ "/etc/os-release" OS_RELEASE_CONTENTS)
|
||||
if(OS_RELEASE_CONTENTS MATCHES "ID=[^ ]*suse[^ ]*")
|
||||
message(STATUS "SUSE Linux detected")
|
||||
set(SUSE_LINUX TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find GLFW header and lib for Windows and SUSE Linux
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING OR SUSE_LINUX)
|
||||
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
|
||||
@ -63,7 +72,7 @@ if(${Vulkan_FOUND})
|
||||
${Vulkan_LIBRARIES}
|
||||
OpenGL::GL
|
||||
)
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING)
|
||||
if(WIN32 OR CMAKE_CROSSCOMPILING OR SUSE_LINUX)
|
||||
target_include_directories(vulkanImageCUDA PUBLIC
|
||||
${GLFW_INCLUDE_DIRS}
|
||||
)
|
||||
@ -75,6 +84,12 @@ if(${Vulkan_FOUND})
|
||||
glfw
|
||||
)
|
||||
endif()
|
||||
# Need to add X11 for SUSE Linux explicitly
|
||||
if(SUSE_LINUX)
|
||||
target_link_libraries(vulkanImageCUDA
|
||||
X11
|
||||
)
|
||||
endif()
|
||||
add_custom_command(TARGET vulkanImageCUDA POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shader.frag
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user