Enable X11 on other platforms than just Linux

Set CMake variable X11_SUPPORTED for all systems that have X11.
Adjust _adjust_library_map() in util/cmake/helper.py to apply X11_SUPPORTED
condition around X11 related packages instead of just LINUX.
Adjust configure.cmake in src/gui based on this change.
Why, because X11 is not just Linux.

Change-Id: Ic3c04eaa55301d1237c7e74281eccd4f8e27e9ce
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Niclas Rosenvik 2021-02-26 10:25:37 +00:00
parent 0bd705d91b
commit 05e4c8f2e9
2 changed files with 27 additions and 23 deletions

View File

@ -25,7 +25,7 @@ set_property(CACHE INPUT_libpng PROPERTY STRINGS undefined no qt system)
#### Libraries
qt_set01(X11_SUPPORTED LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD) # special case
qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2 MODULE_NAME gui QMAKE_LIB atspi)
qt_find_package(DirectFB PROVIDED_TARGETS PkgConfig::DirectFB MODULE_NAME gui QMAKE_LIB directfb)
qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm)
@ -53,78 +53,78 @@ qt_find_package(Vulkan PROVIDED_TARGETS Vulkan::Vulkan MODULE_NAME gui QMAKE_LIB
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(Wayland PROVIDED_TARGETS Wayland::Server MODULE_NAME gui QMAKE_LIB wayland_server)
endif()
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib)
endif()
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(X11 PROVIDED_TARGETS ${X11_SM_LIB} ${X11_ICE_LIB} MODULE_NAME gui QMAKE_LIB x11sm)
endif()
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB 1.11 PROVIDED_TARGETS XCB::XCB MODULE_NAME gui QMAKE_LIB xcb)
endif()
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB 0.3.9 COMPONENTS ICCCM PROVIDED_TARGETS XCB::ICCCM MODULE_NAME gui QMAKE_LIB xcb_icccm)
endif()
qt_add_qmake_lib_dependency(xcb_icccm xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB 0.3.9 COMPONENTS IMAGE PROVIDED_TARGETS XCB::IMAGE MODULE_NAME gui QMAKE_LIB xcb_image)
endif()
qt_add_qmake_lib_dependency(xcb_image xcb_shm xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB 0.3.9 COMPONENTS KEYSYMS PROVIDED_TARGETS XCB::KEYSYMS MODULE_NAME gui QMAKE_LIB xcb_keysyms)
endif()
qt_add_qmake_lib_dependency(xcb_keysyms xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB 0.3.9 COMPONENTS RENDERUTIL PROVIDED_TARGETS XCB::RENDERUTIL MODULE_NAME gui QMAKE_LIB xcb_renderutil)
endif()
qt_add_qmake_lib_dependency(xcb_renderutil xcb xcb_render)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB COMPONENTS RANDR PROVIDED_TARGETS XCB::RANDR MODULE_NAME gui QMAKE_LIB xcb_randr)
endif()
qt_add_qmake_lib_dependency(xcb_randr xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB COMPONENTS SHAPE PROVIDED_TARGETS XCB::SHAPE MODULE_NAME gui QMAKE_LIB xcb_shape)
endif()
qt_add_qmake_lib_dependency(xcb_shape xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB COMPONENTS SHM PROVIDED_TARGETS XCB::SHM MODULE_NAME gui QMAKE_LIB xcb_shm)
endif()
qt_add_qmake_lib_dependency(xcb_shm xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB COMPONENTS SYNC PROVIDED_TARGETS XCB::SYNC MODULE_NAME gui QMAKE_LIB xcb_sync)
endif()
qt_add_qmake_lib_dependency(xcb_sync xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB COMPONENTS XFIXES PROVIDED_TARGETS XCB::XFIXES MODULE_NAME gui QMAKE_LIB xcb_xfixes)
endif()
qt_add_qmake_lib_dependency(xcb_xfixes xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(X11_XCB PROVIDED_TARGETS X11::XCB MODULE_NAME gui QMAKE_LIB xcb_xlib)
endif()
qt_add_qmake_lib_dependency(xcb_xlib xcb xlib)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB COMPONENTS XKB PROVIDED_TARGETS XCB::XKB MODULE_NAME gui QMAKE_LIB xcb_xkb)
endif()
qt_add_qmake_lib_dependency(xcb_xkb xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB COMPONENTS RENDER PROVIDED_TARGETS XCB::RENDER MODULE_NAME gui QMAKE_LIB xcb_render)
endif()
qt_add_qmake_lib_dependency(xcb_render xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB COMPONENTS GLX PROVIDED_TARGETS XCB::GLX MODULE_NAME gui QMAKE_LIB xcb_glx)
endif()
qt_add_qmake_lib_dependency(xcb_glx xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XCB 1.12 COMPONENTS XINPUT PROVIDED_TARGETS XCB::XINPUT MODULE_NAME gui QMAKE_LIB xcb_xinput)
endif()
qt_add_qmake_lib_dependency(xcb_xinput xcb)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XKB 0.5.0 PROVIDED_TARGETS XKB::XKB MODULE_NAME gui QMAKE_LIB xkbcommon)
endif()
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XKB_COMMON_X11 0.5.0 PROVIDED_TARGETS PkgConfig::XKB_COMMON_X11 MODULE_NAME gui QMAKE_LIB xkbcommon_x11)
endif()
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XRender 0.6 PROVIDED_TARGETS PkgConfig::XRender MODULE_NAME gui QMAKE_LIB xrender)
endif()
qt_add_qmake_lib_dependency(xrender xlib)

View File

@ -630,14 +630,18 @@ _library_map = [
def _adjust_library_map():
# Assign a Linux condition on all x and wayland related packages.
# Assign a Linux condition on all wayland related packages.
# Assign platforms that have X11 condition on all X11 related packages.
# We don't want to get pages of package not found messages on
# Windows and macOS, and this also improves configure time on
# those platforms.
linux_package_prefixes = ["xcb", "x11", "xkb", "xrender", "xlib", "wayland"]
linux_package_prefixes = ["wayland"]
x11_package_prefixes = ["xcb", "x11", "xkb", "xrender", "xlib"]
for i, _ in enumerate(_library_map):
if any([_library_map[i].soName.startswith(p) for p in linux_package_prefixes]):
_library_map[i].emit_if = "config.linux"
if any([_library_map[i].soName.startswith(p) for p in x11_package_prefixes]):
_library_map[i].emit_if = "X11_SUPPORTED"
_adjust_library_map()