cmake: Make sure we have XRANDR if we have XLIB

This commit is contained in:
Jakob Bornecrantz 2020-12-06 23:57:26 +00:00
parent b85a44a1ef
commit 23f8991fb8

View file

@ -84,6 +84,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(udev REQUIRED)
set(XRT_HAVE_V4L2 TRUE)
if(PKGCONFIG_FOUND)
pkg_check_modules(XRANDR xrandr)
pkg_check_modules(XCB xcb xcb-randr x11-xcb)
pkg_search_module(WAYLAND wayland-client)
@ -116,6 +118,7 @@ option(BUILD_TESTING "Enable building of the test suite?" ON)
cmake_dependent_option(CMAKE_INTERPROCEDURAL_OPTIMIZATION "Enable inter-procedural (link-time) optimization" OFF "HAS_IPO" OFF)
cmake_dependent_option(XRT_HAVE_WAYLAND "Enable Wayland support" ON "WAYLAND_FOUND AND WAYLAND_SCANNER_FOUND AND WAYLAND_PROTOCOLS_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_XLIB "Enable xlib support" ON "X11_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_XRANDR "Enable xlib-xrandr support" ON "XRANDR_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_XCB "Enable xcb support" ON "XCB_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_VULKAN "Enable Vulkan Graphics API support (also needed for compositor)" ON "VULKAN_FOUND" OFF)
@ -207,6 +210,10 @@ endif()
# Flags
###
if(XRT_HAVE_XLIB AND NOT XRT_HAVE_XRANDR)
message(FATAL_ERROR "XRT_HAVE_XLIB requires XRT_HAVE_XRANDR but XRT_HAVE_XRANDR is disabled")
endif()
if(XRT_HAVE_OPENGLES AND NOT XRT_HAVE_EGL)
message(FATAL_ERROR "XRT_HAVE_OPENGLES requires XRT_HAVE_EGL but XRT_HAVE_EGL is disabled")
endif()
@ -225,7 +232,7 @@ endif()
if(XRT_HAVE_XCB)
set(VK_USE_PLATFORM_XCB_KHR TRUE)
endif()
if(XRT_HAVE_XCB AND XRT_HAVE_XLIB)
if(XRT_HAVE_XCB AND XRT_HAVE_XLIB AND XRT_HAVE_XRANDR)
set(VK_USE_PLATFORM_XLIB_XRANDR_EXT TRUE)
endif()
if(XRT_HAVE_WAYLAND)
@ -274,6 +281,7 @@ message(STATUS "# GIT_DESC: ${GIT_DESC}")
message(STATUS "#")
message(STATUS "# WAYLAND: ${XRT_HAVE_WAYLAND}")
message(STATUS "# XLIB: ${XRT_HAVE_XLIB}")
message(STATUS "# XRANDR: ${XRT_HAVE_XRANDR}")
message(STATUS "# XCB: ${XRT_HAVE_XCB}")
message(STATUS "# OPENGL: ${XRT_HAVE_OPENGL}")
message(STATUS "# OPENGLES: ${XRT_HAVE_OPENGLES}")