Skip to content

Commit

Permalink
Make Xrandr not implicitly required when x11 is used
Browse files Browse the repository at this point in the history
The previous logic made xrandr a required header whenever x11 was
available which doesn't honestly convey build requirements to users.

This commit add BUILD_WSI_XLIB_XRANDR_SUPPORT as a build option
that defaults to ON (for platforms which support x11) so the xrandr
requirement can be configured by users directly.
  • Loading branch information
charles-lunarg committed Dec 2, 2024
1 parent d0c68e4 commit 6a1712f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ elseif(APPLE)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU")
option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
option(BUILD_WSI_XLIB_XRANDR_SUPPORT "Build X11 Xrandr WSI support" ON)
option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON)
option(BUILD_WSI_DIRECTFB_SUPPORT "Build DirectFB WSI support" OFF)

Expand All @@ -125,8 +126,14 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU")
if(BUILD_WSI_XLIB_SUPPORT)
pkg_check_modules(X11 REQUIRED QUIET IMPORTED_TARGET x11)
pkg_get_variable(XLIB_INCLUDE_DIRS x11 includedir)
target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_XLIB_KHR VK_USE_PLATFORM_XLIB_XRANDR_EXT)
target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_XLIB_KHR)
target_include_directories(platform_wsi INTERFACE ${XLIB_INCLUDE_DIRS})
if(BUILD_WSI_XLIB_XRANDR_SUPPORT)
pkg_check_modules(XRANDR REQUIRED QUIET IMPORTED_TARGET xrandr)
pkg_get_variable(XLIB_XRANDR_INCLUDE_DIRS xrandr includedir)
target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_XLIB_XRANDR_EXT)
target_include_directories(platform_wsi INTERFACE ${XLIB_XRANDR_INCLUDE_DIRS})
endif()
endif()
if(BUILD_WSI_WAYLAND_SUPPORT)
target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_WAYLAND_KHR)
Expand Down

0 comments on commit 6a1712f

Please sign in to comment.