From b0595dd3ca6b812223af8695a87480f54d094523 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Mon, 9 Oct 2023 20:22:03 +0200 Subject: [PATCH] Add build option for KF6 coinstallability When shipping both KF5 and KF6 one wants to disable installing some runtime components We have the BUILD_RUNTIME option, but that disables too much, i.e. the KGlobalAccelPrivate library that is needed to build KWin Add another option for the coinstallability build --- CMakeLists.txt | 2 ++ src/runtime/CMakeLists.txt | 60 ++++++++++++++++++++------------------ 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69171686..37772501 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,8 @@ set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprec option(BUILD_RUNTIME "Build the kglobalacceld runtime" ON) add_feature_info(BUILD_RUNTIME ${BUILD_RUNTIME} "The kglobalacceld runtime") +option(KF6_COMPAT_BUILD "Don't build runtime components that conflict with KF6" OFF) + option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") diff --git a/src/runtime/CMakeLists.txt b/src/runtime/CMakeLists.txt index 5562d0c9..8a2447ca 100644 --- a/src/runtime/CMakeLists.txt +++ b/src/runtime/CMakeLists.txt @@ -52,26 +52,45 @@ if(XCB_XCB_FOUND) endif() endif() -add_executable(kglobalaccel5 main.cpp logging.cpp) -ecm_mark_nongui_executable(kglobalaccel5) +if (NOT KF6_COMPAT_BUILD) + add_executable(kglobalaccel5 main.cpp logging.cpp) + ecm_mark_nongui_executable(kglobalaccel5) -target_include_directories(kglobalaccel5 PRIVATE ${CMAKE_BINARY_DIR}) + target_include_directories(kglobalaccel5 PRIVATE ${CMAKE_BINARY_DIR}) -target_link_libraries(kglobalaccel5 - KF5GlobalAccelPrivate - KF5::DBusAddons # KDBusService - KF5::Crash + target_link_libraries(kglobalaccel5 + KF5GlobalAccelPrivate + KF5::DBusAddons # KDBusService + KF5::Crash + ) + + add_subdirectory(plugins) + + if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.102.0) + install( FILES kglobalaccel.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR} RENAME kglobalaccel5.desktop) + endif() + + install( TARGETS kglobalaccel5 ${KF_INSTALL_TARGETS_DEFAULT_ARGS} ) + + + # D-Bus activation service file, and associated systemd service + include (ECMGenerateDBusServiceFile) + include (ECMConfiguredInstall) + ecm_generate_dbus_service_file( + NAME org.kde.kglobalaccel + EXECUTABLE "${KDE_INSTALL_FULL_BINDIR}/kglobalaccel5" + SYSTEMD_SERVICE plasma-kglobalaccel.service + DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR} ) -add_subdirectory(plugins) + ecm_install_configured_files( + INPUT plasma-kglobalaccel.service.in + DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR} + ) +endif() # Install application and configuration install(TARGETS KF5GlobalAccelPrivate EXPORT KF5GlobalAccelTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) -install( TARGETS kglobalaccel5 ${KF_INSTALL_TARGETS_DEFAULT_ARGS} ) - -if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.102.0) - install( FILES kglobalaccel.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR} RENAME kglobalaccel5.desktop) -endif() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kf5globalaccelprivate_export.h @@ -79,18 +98,3 @@ install(FILES kglobalaccel_interface.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KGlobalAccel/private COMPONENT Devel ) - -# D-Bus activation service file, and associated systemd service -include (ECMGenerateDBusServiceFile) -include (ECMConfiguredInstall) -ecm_generate_dbus_service_file( - NAME org.kde.kglobalaccel - EXECUTABLE "${KDE_INSTALL_FULL_BINDIR}/kglobalaccel5" - SYSTEMD_SERVICE plasma-kglobalaccel.service - DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR} -) - -ecm_install_configured_files( - INPUT plasma-kglobalaccel.service.in - DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR} -) -- GitLab