Adapt build system to also support building against Qt6

master
Volker Krause 3 years ago committed by Vlad Zahorodnii
parent fca6ffac7b
commit 2a171e5fa8

@ -18,36 +18,41 @@ include(GenerateExportHeader)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDEClangFormat)
include(ECMInstallIcons)
include(ECMOptionalAddSubdirectory)
include(ECMConfiguredInstall)
include(ECMQtDeclareLoggingCategory)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Concurrent
Core
DBus
Quick
UiTools
Widgets
X11Extras
)
if (QT_MAJOR_VERSION EQUAL "5")
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS X11Extras)
find_package(Qt5XkbCommonSupport REQUIRED)
else()
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient)
endif()
find_package(Qt5Test ${QT_MIN_VERSION} CONFIG QUIET)
set_package_properties(Qt5Test PROPERTIES
find_package(Qt${QT_MAJOR_VERSION}Test ${QT_MIN_VERSION} CONFIG QUIET)
set_package_properties(Qt${QT_MAJOR_VERSION}Test PROPERTIES
PURPOSE "Required for tests"
TYPE OPTIONAL
)
add_feature_info("Qt5Test" Qt5Test_FOUND "Required for building tests")
if (NOT Qt5Test_FOUND)
add_feature_info("Qt${QT_MAJOR_VERSION}Test" Qt${QT_MAJOR_VERSION}Test_FOUND "Required for building tests")
if (NOT Qt${QT_MAJOR_VERSION}Test_FOUND)
set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
endif()
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDEClangFormat)
include(ECMInstallIcons)
include(ECMOptionalAddSubdirectory)
include(ECMConfiguredInstall)
include(ECMQtDeclareLoggingCategory)
add_definitions(
-DQT_DISABLE_DEPRECATED_BEFORE=0
@ -195,8 +200,6 @@ set_package_properties(XKB PROPERTIES
PURPOSE "Required for building KWin with Wayland support"
)
find_package(Qt5XkbCommonSupport REQUIRED)
find_package(Libinput 1.19)
set_package_properties(Libinput PROPERTIES TYPE REQUIRED PURPOSE "Required for input handling on Wayland.")
@ -268,10 +271,12 @@ set_package_properties(X11_XCB PROPERTIES
)
# dependencies for QPA plugin
find_package(Qt5FontDatabaseSupport REQUIRED)
find_package(Qt5ThemeSupport REQUIRED)
find_package(Qt5ServiceSupport REQUIRED)
find_package(Qt5EventDispatcherSupport REQUIRED)
if (QT_MAJOR_VERSION EQUAL "5")
find_package(Qt5FontDatabaseSupport REQUIRED)
find_package(Qt5ThemeSupport REQUIRED)
find_package(Qt5ServiceSupport REQUIRED)
find_package(Qt5EventDispatcherSupport REQUIRED)
endif()
find_package(Freetype REQUIRED)
set_package_properties(Freetype PROPERTIES
@ -411,7 +416,9 @@ add_subdirectory(src)
if (BUILD_TESTING)
find_package(WaylandProtocols 1.19 REQUIRED)
find_package(QtWaylandScanner ${QT_MIN_VERSION} REQUIRED)
if (QT_MAJOR_VERSION EQUAL "5")
find_package(QtWaylandScanner ${QT_MIN_VERSION} REQUIRED)
endif()
find_package(Wayland REQUIRED COMPONENTS Client)
find_package(PlasmaWaylandProtocols CONFIG REQUIRED)

@ -232,8 +232,10 @@ target_link_libraries(testXkb
kwineffects
XKB::XKB
Qt5::XkbCommonSupportPrivate
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(testXkb Qt5::XkbCommonSupportPrivate)
endif()
add_test(NAME kwin-testXkb COMMAND testXkb)
ecm_mark_as_test(testXkb)

@ -7,40 +7,54 @@ set(KWinIntegrationTestFramework_SOURCES
kwin_wayland_test.cpp
test_helpers.cpp
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml
BASENAME input-method-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v3.xml
BASENAME text-input-unstable-v3
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL protocols/wlr-layer-shell-unstable-v1.xml
BASENAME wlr-layer-shell-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
BASENAME xdg-shell
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
BASENAME xdg-decoration-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml
BASENAME idle-inhibit-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-device-v2.xml
BASENAME kde-output-device-v2
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-management-v2.xml
BASENAME kde-output-management-v2
)
add_library(KWinIntegrationTestFramework SHARED)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml
BASENAME input-method-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v3.xml
BASENAME text-input-unstable-v3
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL protocols/wlr-layer-shell-unstable-v1.xml
BASENAME wlr-layer-shell-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
BASENAME xdg-shell
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
BASENAME xdg-decoration-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml
BASENAME idle-inhibit-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-device-v2.xml
BASENAME kde-output-device-v2
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-management-v2.xml
BASENAME kde-output-management-v2
)
else()
qt6_generate_wayland_protocol_client_sources(KWinIntegrationTestFramework FILES
${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml
${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v3.xml
${CMAKE_CURRENT_SOURCE_DIR}/protocols/wlr-layer-shell-unstable-v1.xml
${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
${WaylandProtocols_DATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-device-v2.xml
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-management-v2.xml
)
endif()
add_library(KWinIntegrationTestFramework SHARED ${KWinIntegrationTestFramework_SOURCES})
target_sources(KWinIntegrationTestFramework PRIVATE ${KWinIntegrationTestFramework_SOURCES})
target_link_libraries(KWinIntegrationTestFramework
PUBLIC
Qt::Test

@ -200,11 +200,13 @@ target_link_libraries(kwin
UDev::UDev
XKB::XKB
Qt5::XkbCommonSupportPrivate
epoxy::epoxy
Threads::Threads
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(kwin Qt5::XkbCommonSupportPrivate)
endif()
if (KWIN_BUILD_NOTIFICATIONS)
target_link_libraries(kwin KF5::Notifications)

@ -1,8 +1,8 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Core "@QT_MIN_VERSION@")
find_dependency(Qt5Gui "@QT_MIN_VERSION@")
find_dependency(Qt@QT_MAJOR_VERSION@Core "@QT_MIN_VERSION@")
find_dependency(Qt@QT_MAJOR_VERSION@Gui "@QT_MIN_VERSION@")
find_dependency(KF5Config "@KF5_MIN_VERSION@")
find_dependency(KF5CoreAddons "@KF5_MIN_VERSION@")
find_dependency(KF5WindowSystem "@KF5_MIN_VERSION@")

@ -23,11 +23,15 @@ target_compile_definitions(KWinQpaPlugin PRIVATE QT_STATICPLUGIN)
target_link_libraries(KWinQpaPlugin PRIVATE
Qt::CorePrivate
Qt::GuiPrivate
Qt::FontDatabaseSupportPrivate
Qt::ThemeSupportPrivate
Qt::EventDispatcherSupportPrivate
Qt::ServiceSupportPrivate
Freetype::Freetype # Must be after Qt5 platform support libs
Fontconfig::Fontconfig
kwin
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(KWinQpaPlugin PRIVATE
Qt::FontDatabaseSupportPrivate
Qt::ThemeSupportPrivate
Qt::EventDispatcherSupportPrivate
Qt::ServiceSupportPrivate
)
endif()

Loading…
Cancel
Save