### WSI Support Build Options
-By default, the Vulkan Tools are built with support for all 4 Vulkan-defined WSI display servers: Xcb, Xlib, Wayland, and Mir.
+By default, the Vulkan Tools cube and cubepp are built with support for all 4 Vulkan-defined WSI display servers: Xcb, Xlib, Wayland, and Mir.
It is recommended to build the repository components with support for these display servers to maximize their usability across Linux platforms.
If it is necessary to build these modules without support for one of the display servers, the appropriate CMake option of the form `BUILD_WSI_xxx_SUPPORT` can be set to `OFF`.
-See the top-level CMakeLists.txt file for more info.
+See the CMakeLists.txt file in `Vulkan-Tools/cube` for more info.
+
+Note vulkaninfo currently only supports Xcb and Xlib WSI display servers. See the CMakeLists.txt file in `Vulkan-Tools/vulkaninfo` for more info.
### Linux Install to System Directories
add_executable(vulkaninfo vulkaninfo.c)
endif()
-if(APPLE)
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ include(FindPkgConfig)
+ option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
+ option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
+ set(VULKANINFO_WSI_SELECTION "XCB" CACHE STRING "Select WSI target for vulkaninfo (XCB, XLIB)")
+
+ if (BUILD_WSI_XCB_SUPPORT)
+ find_package(XCB REQUIRED)
+ endif()
+
+ if (BUILD_WSI_XLIB_SUPPORT)
+ find_package(X11 REQUIRED)
+ endif()
+
+ if (VULKANINFO_WSI_SELECTION STREQUAL "XCB")
+ if (NOT BUILD_WSI_XCB_SUPPORT)
+ message( FATAL_ERROR "Selected XCB for vulkaninfo build but not building Xcb support" )
+ endif()
+ target_include_directories(vulkaninfo PRIVATE ${XCB_INCLUDE_DIRS})
+ target_link_libraries(vulkaninfo ${XCB_LIBRARIES})
+ target_compile_definitions(vulkaninfo PRIVATE -DVK_USE_PLATFORM_XCB_KHR)
+ elseif (VULKANINFO_WSI_SELECTION STREQUAL "XLIB")
+ if (NOT BUILD_WSI_XLIB_SUPPORT)
+ message( FATAL_ERROR "Selected XLIB for vulkaninfo build but not building Xlib support" )
+ endif()
+ target_include_directories(vulkaninfo PRIVATE ${X11_INCLUDE_DIR})
+ target_link_libraries(vulkaninfo ${X11_LIBRARIES})
+ target_compile_definitions(vulkaninfo PRIVATE -DVK_USE_PLATFORM_XLIB_KHR)
+ endif()
endif()
# Predefine loader root as a cmake cache variable for cmake-gui