• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(VULKAN_WRAPPER_SOURCES
2    vulkan_wrapper.cpp
3    opencl_vulkan_wrapper.cpp
4    vulkan_utility.cpp
5    vulkan_list_map.cpp
6)
7
8# needed by Vulkan wrapper to compile
9add_cxx_flag_if_supported(-Wmisleading-indentation)
10add_cxx_flag_if_supported(-Wno-narrowing)
11add_cxx_flag_if_supported(-Wno-format)
12add_cxx_flag_if_supported(-Wno-error)
13add_cxx_flag_if_supported(-Wno-error=cpp) # Allow #warning directive
14add_cxx_flag_if_supported(-Wno-error=unknown-pragmas) # Issue #785
15add_cxx_flag_if_supported(-Wno-error=asm-operand-widths) # Issue #784
16add_cxx_flag_if_supported(-Wno-unused-variable)
17add_cxx_flag_if_supported(-Wno-error=terminate)
18add_cxx_flag_if_supported(-Wno-error=unused-function)
19add_cxx_flag_if_supported(-Wno-error=return-type)
20
21link_directories(${CLConform_VULKAN_LIBRARIES_DIR})
22
23list(APPEND CLConform_INCLUDE_DIR ${VULKAN_INCLUDE_DIR})
24
25add_library(vulkan_wrapper STATIC ${VULKAN_WRAPPER_SOURCES})
26
27if(ANDROID)
28    target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_ANDROID_KHR)
29elseif(WIN32)
30    target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_WIN32_KHR)
31elseif(APPLE)
32    target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_METAL_EXT)
33elseif(UNIX)
34    # Variable taken from Vulkan samples, commented out due to lack of WSI
35    # Choose WSI based on VKB_WSI_SELECTION
36    #if (VKB_WSI_SELECTION STREQUAL XCB OR VKB_WSI_SELECTION STREQUAL XLIB OR VKB_WSI_SELECTION STREQUAL WAYLAND)
37    #    find_package(PkgConfig REQUIRED)
38    #endif()
39    #if (VKB_WSI_SELECTION STREQUAL XCB)
40    #    pkg_check_modules(XCB xcb REQUIRED)
41    #    if (XCB_FOUND)
42    #        target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_XCB_KHR)
43    #    endif()
44    #elseif (VKB_WSI_SELECTION STREQUAL XLIB)
45    #    pkg_check_modules(X11 x11 REQUIRED)
46    #    if (X11_FOUND)
47    #        target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_XLIB_KHR)
48    #    endif()
49    #elseif (VKB_WSI_SELECTION STREQUAL WAYLAND)
50    #    pkg_check_modules(WAYLAND wayland-client REQUIRED)
51    #    if (WAYLAND_FOUND)
52    #        target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_WAYLAND_KHR)
53    #    endif()
54    #elseif (VKB_WSI_SELECTION STREQUAL D2D)
55    #    set(DIRECT_TO_DISPLAY TRUE)
56    #    set(DIRECT_TO_DISPLAY TRUE PARENT_SCOPE)
57    #    target_compile_definitions(vulkan_wrapper PUBLIC VK_USE_PLATFORM_DISPLAY_KHR)
58    #else()
59    #    message(FATAL_ERROR "Unknown WSI")
60    #endif()
61endif()
62
63include_directories(${CMAKE_CURRENT_SOURCE_DIR})
64
65include_directories (${CLConform_INCLUDE_DIR})
66
67if (NOT WIN32)
68target_link_libraries(vulkan_wrapper dl)
69endif()
70