Adapt build system to also support building against Qt6

wilder-5.25
Volker Krause 4 years ago
parent 9d7ed1d3d5
commit a8006e8b0b
  1. 28
      CMakeLists.txt
  2. 4
      appmenu/CMakeLists.txt
  3. 4
      kcms/formats/CMakeLists.txt
  4. 3
      kcms/kfontinst/dbus/CMakeLists.txt
  5. 3
      kcms/kfontinst/lib/CMakeLists.txt
  6. 2
      kcms/lookandfeel/CMakeLists.txt
  7. 13
      libtaskmanager/declarative/CMakeLists.txt
  8. 2
      phonon/platform_kde/CMakeLists.txt
  9. 2
      runners/bookmarks/CMakeLists.txt
  10. 19
      shell/CMakeLists.txt
  11. 52
      shell/autotests/mockserver/CMakeLists.txt
  12. 10
      shell/tests/CMakeLists.txt

@ -13,7 +13,6 @@ option(INSTALL_SDDM_WAYLAND_SESSION OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Svg Widgets Quick QuickWidgets Concurrent Test Network)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
@ -36,6 +35,7 @@ include(ECMGenerateDBusServiceFile)
include(ECMFindQmlModule)
include(ECMGenerateExportHeader)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Svg Widgets Quick QuickWidgets Concurrent Test Network)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Plasma Runner Notifications NotifyConfig NewStuff Wallet IdleTime
Declarative I18n KCMUtils TextWidgets Crash GlobalAccel DBusAddons Wayland
@ -89,8 +89,8 @@ set_package_properties(KF5Holidays PROPERTIES DESCRIPTION "Holidays provider for
PURPOSE "Needed to for holidays plugin for Plasma Calendar."
)
find_package(Phonon4Qt5 4.6.60 REQUIRED NO_MODULE)
set_package_properties(Phonon4Qt5 PROPERTIES
find_package(Phonon4Qt${QT_MAJOR_VERSION} 4.6.60 REQUIRED NO_MODULE)
set_package_properties(Phonon4Qt${QT_MAJOR_VERSION} PROPERTIES
DESCRIPTION "Qt-based audio library"
TYPE REQUIRED)
@ -127,15 +127,19 @@ if(PipeWire_FOUND)
find_package(Libdrm REQUIRED)
endif()
find_package(QtWaylandScanner REQUIRED)
find_package(Qt5WaylandClient)
find_package(Qt5XkbCommonSupport)
if(QT_MAJOR_VERSION EQUAL "5")
find_package(QtWaylandScanner REQUIRED)
find_package(Qt5XkbCommonSupport)
else()
find_package(Qt6 REQUIRED CONFIG COMPONENTS WaylandCompositor)
endif()
find_package(Qt${QT_MAJOR_VERSION}WaylandClient)
find_package(PlasmaWaylandProtocols 1.6 REQUIRED)
find_package(Wayland REQUIRED COMPONENTS Client Server) # Server is used in autotests
if(FONTCONFIG_FOUND)
# kfontinst
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS PrintSupport)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS PrintSupport)
endif()
if(X11_FOUND)
@ -145,7 +149,9 @@ if(X11_FOUND)
message(FATAL_ERROR "\nThe X11 Session Management (SM) development package could not be found.\nPlease install libSM.\n")
endif(NOT X11_SM_FOUND)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS X11Extras)
if (QT_MAJOR_VERSION EQUAL "5")
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS X11Extras)
endif()
endif()
if(X11_FOUND AND XCB_XCB_FOUND)
@ -161,13 +167,13 @@ if(${AppStreamQt_FOUND})
set(HAVE_APPSTREAMQT true)
endif()
find_package(PackageKitQt5)
set_package_properties(PackageKitQt5
find_package(PackageKitQt${QT_MAJOR_VERSION})
set_package_properties(PackageKitQt${QT_MAJOR_VERSION}
PROPERTIES DESCRIPTION "Software Manager integration"
TYPE OPTIONAL
PURPOSE "Used to install additional language packages on demand"
)
if(PackageKitQt5_FOUND)
if(PackageKitQt${QT_MAJOR_VERSION}_FOUND)
set(HAVE_PACKAGEKIT TRUE)
endif()

@ -20,7 +20,6 @@ pkg_check_modules(XKBCommon REQUIRED IMPORTED_TARGET xkbcommon)
target_link_libraries(appmenu
Qt::DBus
Qt::WaylandClientPrivate
Qt::XkbCommonSupportPrivate
KF5::DBusAddons
KF5::KIOCore
KF5::WaylandClient
@ -29,6 +28,9 @@ target_link_libraries(appmenu
PkgConfig::XKBCommon
dbusmenuqt
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(appmenu Qt::XkbCommonSupportPrivate)
endif()
if (HAVE_X11)
target_link_libraries(appmenu Qt::X11Extras XCB::XCB)

@ -20,7 +20,9 @@ target_link_libraries(kcm_formats
KF5::CoreAddons
KF5::I18n
KF5::QuickAddons)
if (QT_MAJOR_VERSION EQUAL "6")
target_link_libraries(kcm_formats Qt::Core5Compat) # for QTextCodec
endif()
########### install files ###############
install(TARGETS kcm_formats DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/kcms/systemsettings)

@ -15,6 +15,9 @@ target_link_libraries(fontinst_bin
set_target_properties(fontinst_helper PROPERTIES OUTPUT_NAME fontinst_helper)
target_link_libraries(fontinst_helper
Qt::DBus Qt::Xml KF5::AuthCore KF5::KIOCore kfontinst)
if (QT_MAJOR_VERSION EQUAL "6")
target_link_libraries(fontinst_helper Qt::Core5Compat) # for QTextCodec
endif()
ecm_qt_declare_logging_category(fontinst_bin
HEADER kfontinst_debug.h

@ -14,6 +14,9 @@ target_link_libraries(kfontinst
Qt::Gui
XCB::IMAGE
)
if (QT_MAJOR_VERSION EQUAL "6")
target_link_libraries(kfontinst PRIVATE Qt::Core5Compat) # for QTextCodec
endif()
set_target_properties(kfontinst PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} )

@ -78,7 +78,7 @@ install(FILES kcm_lookandfeel.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES lookandfeel.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
if(BUILD_TESTING)
find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED)
find_package(Qt${QT_MAJOR_VERSION}Test ${QT_MIN_VERSION} CONFIG REQUIRED)
add_subdirectory(autotests)
endif()

@ -20,10 +20,15 @@ if(TARGET PkgConfig::PipeWire)
DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}"
)
ecm_add_qtwayland_client_protocol(SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/screencast.xml
BASENAME zkde-screencast-unstable-v1
)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/screencast.xml
BASENAME zkde-screencast-unstable-v1
)
else()
qt6_generate_wayland_protocol_client_sources(taskmanagerplugin FILES
${PLASMA_WAYLAND_PROTOCOLS_DIR}/screencast.xml)
endif()
target_include_directories(taskmanagerplugin PRIVATE ${Libdrm_INCLUDE_DIR})
target_compile_definitions(taskmanagerplugin PRIVATE -DWITH_PIPEWIRE)

@ -5,7 +5,7 @@ set(kde_PART_SRCS
)
kcoreaddons_add_plugin(kde SOURCES ${kde_PART_SRCS} INSTALL_NAMESPACE "phonon_platform")
target_link_libraries(kde ${PHONON_LIBRARY} KF5::CoreAddons KF5::ConfigCore KF5::WidgetsAddons KF5::I18n KF5::KIOCore KF5::Notifications)
target_link_libraries(kde Phonon::phonon4qt${QT_MAJOR_VERSION} KF5::CoreAddons KF5::ConfigCore KF5::WidgetsAddons KF5::I18n KF5::KIOCore KF5::Notifications)
install(FILES phonon.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})
install(FILES phononbackend.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPESDIR})

@ -3,7 +3,7 @@
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_runner_bookmarksrunner\")
find_package(Qt5 CONFIG REQUIRED COMPONENTS Sql)
find_package(Qt${QT_MAJOR_VERSION} CONFIG REQUIRED COMPONENTS Sql)
set(krunner_bookmarks_common_SRCS
bookmarkmatch.cpp

@ -57,18 +57,23 @@ if (TARGET KUserFeedbackCore)
)
endif()
ecm_add_qtwayland_client_protocol(plasma_shell_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
BASENAME kde-primary-output-v1
)
add_executable(plasmashell)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(plasma_shell_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
BASENAME kde-primary-output-v1
)
else()
qt6_generate_wayland_protocol_client_sources(plasmashell FILES
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
)
endif()
set(krunner_xml ${plasma-workspace_SOURCE_DIR}/krunner/dbus/org.kde.krunner.App.xml)
qt_add_dbus_interface(plasma_shell_SRCS ${krunner_xml} krunner_interface)
add_executable(plasmashell
${plasma_shell_SRCS}
)
target_sources(plasmashell PRIVATE ${plasma_shell_SRCS})
target_link_libraries(plasmashell
Qt::Quick

@ -14,26 +14,38 @@ set(SharedClientTest_LIB_SRCS
primaryoutput.cpp primaryoutput.h
)
ecm_add_qtwayland_server_protocol(SharedClientTest_LIB_SRCS
PROTOCOL ${Wayland_DATADIR}/wayland.xml
BASENAME wayland
)
ecm_add_qtwayland_server_protocol(SharedClientTest_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-output/xdg-output-unstable-v1.xml
BASENAME xdg-output-unstable-v1
)
ecm_add_qtwayland_client_protocol(SharedClientTest_LIB_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
BASENAME kde-primary-output-v1
)
ecm_add_qtwayland_server_protocol(SharedClientTest_LIB_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
BASENAME kde-primary-output-v1
)
add_library(SharedClientTest OBJECT ${SharedClientTest_LIB_SRCS})
add_library(SharedClientTest OBJECT)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_server_protocol(SharedClientTest_LIB_SRCS
PROTOCOL ${Wayland_DATADIR}/wayland.xml
BASENAME wayland
)
ecm_add_qtwayland_server_protocol(SharedClientTest_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-output/xdg-output-unstable-v1.xml
BASENAME xdg-output-unstable-v1
)
ecm_add_qtwayland_client_protocol(SharedClientTest_LIB_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
BASENAME kde-primary-output-v1
)
ecm_add_qtwayland_server_protocol(SharedClientTest_LIB_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
BASENAME kde-primary-output-v1
)
else()
qt6_generate_wayland_protocol_client_sources(SharedClientTest FILES
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
)
qt6_generate_wayland_protocol_server_sources(SharedClientTest FILES
${Wayland_DATADIR}/wayland.xml
${WaylandProtocols_DATADIR}/unstable/xdg-output/xdg-output-unstable-v1.xml
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
)
endif()
target_sources(SharedClientTest PRIVATE ${SharedClientTest_LIB_SRCS})
target_link_libraries(SharedClientTest
PUBLIC

@ -7,11 +7,17 @@ set(screenpoolmanualtest_SRCS
${CMAKE_CURRENT_BINARY_DIR}/../screenpool-debug.cpp
../primaryoutputwatcher.cpp
)
ecm_add_qtwayland_client_protocol(screenpoolmanualtest_SRCS
add_executable(screenpoolmanualtest)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(screenpoolmanualtest_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
BASENAME kde-primary-output-v1
)
add_executable(screenpoolmanualtest ${screenpoolmanualtest_SRCS})
else()
qt6_generate_wayland_protocol_client_sources(screenpoolmanualtest FILES
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml)
endif()
target_sources(screenpoolmanualtest PRIVATE ${screenpoolmanualtest_SRCS})
target_link_libraries(screenpoolmanualtest
Qt::Test
Qt::Gui

Loading…
Cancel
Save