Warning, /plasma/plasma-workspace/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 3.16)
0002 
0003 project(plasma-workspace)
0004 set(PROJECT_VERSION "6.0.80")
0005 string(REPLACE "." ";" VERSION_LIST ${PROJECT_VERSION})
0006 list(GET VERSION_LIST 0 PROJECT_VERSION_MAJOR)
0007 list(GET VERSION_LIST 1 PROJECT_VERSION_MINOR)
0008 list(GET VERSION_LIST 2 PROJECT_VERSION_PATCH)
0009 
0010 set(PROJECT_DEP_VERSION "6.0.80")
0011 set(QT_MIN_VERSION "6.6.0")
0012 set(KF6_MIN_VERSION "5.240.0")
0013 set(KDE_COMPILERSETTINGS_LEVEL "5.82")
0014 set(INSTALL_SDDM_THEME TRUE)
0015 option(PLASMA_X11_DEFAULT_SESSION "Use X11 session by default for Plasma" OFF)
0016 option(INSTALL_SDDM_WAYLAND_SESSION OFF)
0017 option(WITH_X11 "Build with X11 support. Building without is experimental" ON)
0018 
0019 set(CMAKE_CXX_STANDARD 20)
0020 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0021 
0022 find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE)
0023 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
0024 
0025 include(KDEInstallDirs)
0026 include(KDECMakeSettings)
0027 include(KDECompilerSettings NO_POLICY_SCOPE)
0028 include(ECMMarkNonGuiExecutable)
0029 include(CMakePackageConfigHelpers)
0030 include(WriteBasicConfigVersionFile)
0031 include(CheckIncludeFiles)
0032 include(FeatureSummary)
0033 include(ECMOptionalAddSubdirectory)
0034 include(ECMQtDeclareLoggingCategory)
0035 include(ECMQueryQt)
0036 include(ECMInstallIcons)
0037 include(KDEClangFormat)
0038 include(KDEGitCommitHooks)
0039 include(ECMConfiguredInstall)
0040 include(ECMGenerateDBusServiceFile)
0041 include(ECMFindQmlModule)
0042 include(ECMGenerateExportHeader)
0043 include(ECMGenerateQmlTypes)
0044 include(ECMDeprecationSettings)
0045 include(ECMQmlModule)
0046 
0047 find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Svg Widgets Quick QuickWidgets Concurrent Network Core5Compat DBus ShaderTools)
0048 find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
0049                     Auth Parts Runner Notifications NotifyConfig NewStuff Wallet IdleTime
0050                     Svg Declarative I18n KCMUtils TextWidgets Crash GlobalAccel DBusAddons
0051                     CoreAddons KIO Prison Package
0052                     GuiAddons Archive ItemModels IconThemes UnitConversion TextEditor StatusNotifierItem
0053                     OPTIONAL_COMPONENTS DocTools)
0054 find_package(Plasma5Support ${PROJECT_DEP_VERSION} REQUIRED)
0055 find_package(Plasma ${PROJECT_DEP_VERSION} REQUIRED)
0056 find_package(PlasmaQuick ${PROJECT_DEP_VERSION} REQUIRED)
0057 find_package(KWayland ${PROJECT_DEP_VERSION} REQUIRED)
0058 find_package(PlasmaActivities ${PROJECT_DEP_VERSION} REQUIRED)
0059 find_package(PlasmaActivitiesStats ${PROJECT_DEP_VERSION} REQUIRED)
0060 
0061 if (BUILD_TESTING)
0062     include(ECMAddTests)
0063     find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Test QuickTest)
0064     find_package(Qt6 REQUIRED CONFIG COMPONENTS WaylandCompositor)
0065 endif()
0066 
0067 find_package(KF6KDED CONFIG REQUIRED)
0068 find_package(KPipeWire CONFIG)
0069 
0070 find_package(KF6NetworkManagerQt ${KF6_MIN_VERSION})
0071 set_package_properties(KF6NetworkManagerQt PROPERTIES DESCRIPTION "Qt wrapper for NetworkManager API"
0072                        TYPE OPTIONAL
0073                        PURPOSE "Needed by geolocation data engine."
0074                       )
0075 
0076 find_package(KF6Kirigami2 ${KF6_MIN_VERSION} CONFIG)
0077 set_package_properties(KF6Kirigami2 PROPERTIES
0078     DESCRIPTION "A QtQuick based components set"
0079     TYPE RUNTIME
0080 )
0081 
0082 find_package(KF6KirigamiAddons2 0.10.0 CONFIG)
0083 set_package_properties(KF6KirigamiAddons2 PROPERTIES
0084     DESCRIPTION "Extra controls for Kirigami applications"
0085     PURPOSE "Required at runtime for the User KCM"
0086     TYPE RUNTIME
0087 )
0088 
0089 find_package(KF6QuickCharts ${KF6_MIN_VERSION} CONFIG)
0090 set_package_properties(KF6QuickCharts PROPERTIES
0091     DESCRIPTION "Used for rendering charts"
0092     TYPE RUNTIME
0093 )
0094 
0095 find_package(KF6UserFeedback)
0096 find_package(KSysGuard CONFIG REQUIRED)
0097 
0098 find_package(KF6Baloo)
0099 set_package_properties(KF6Baloo PROPERTIES DESCRIPTION "File Searching"
0100                        TYPE RECOMMENDED
0101                        PURPOSE "Needed for the File Search runner."
0102                       )
0103 
0104 find_package(PkgConfig REQUIRED)
0105 pkg_check_modules(QALCULATE libqalculate>2.0 REQUIRED IMPORTED_TARGET)
0106 
0107 find_package(KWinDBusInterface CONFIG REQUIRED)
0108 
0109 find_package(KF6Screen CONFIG REQUIRED)
0110 find_package(KScreenLocker 5.13.80 REQUIRED)
0111 find_package(ScreenSaverDBusInterface CONFIG REQUIRED)
0112 find_package(LayerShellQt CONFIG REQUIRED)
0113 find_package(KF6Holidays)
0114 set_package_properties(KF6Holidays PROPERTIES DESCRIPTION "Holidays provider for Plasma calendar"
0115                        TYPE OPTIONAL
0116                        PURPOSE "Needed to for holidays plugin for Plasma Calendar."
0117                       )
0118 # Used in kcm_autostart
0119 pkg_check_modules(SYSTEMD "systemd")
0120 
0121 find_package(Phonon4Qt6 4.6.60 REQUIRED NO_MODULE)
0122 set_package_properties(Phonon4Qt6 PROPERTIES
0123    DESCRIPTION "Qt-based audio library"
0124    TYPE REQUIRED)
0125 
0126 find_package(Canberra)
0127 set_package_properties(Canberra PROPERTIES
0128     PURPOSE "Needed to preview notification sounds"
0129     TYPE REQUIRED)
0130 
0131 find_package(Breeze ${PROJECT_DEP_VERSION} CONFIG)
0132 set_package_properties(Breeze PROPERTIES
0133                        TYPE OPTIONAL
0134                        PURPOSE "For setting the default window decoration plugin")
0135 
0136 find_package(ZLIB)
0137 set_package_properties(ZLIB PROPERTIES DESCRIPTION "Support for gzip compressed files and data streams"
0138                        URL "https://www.zlib.net"
0139                        TYPE REQUIRED
0140                       )
0141 
0142 find_package(Fontconfig)
0143 set_package_properties(Fontconfig PROPERTIES DESCRIPTION "Font access configuration library"
0144                        URL "https://www.freedesktop.org/wiki/Software/fontconfig"
0145                        TYPE OPTIONAL
0146                        PURPOSE "Needed to build font configuration and installation tools"
0147                       )
0148 
0149 if(PLASMA_X11_DEFAULT_SESSION)
0150     set(WITH_X11 1)
0151 endif()
0152 
0153 if(WITH_X11)
0154     find_package(X11)
0155     set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
0156                             URL "https://www.x.org"
0157                             TYPE REQUIRED
0158                             PURPOSE "Required for building the X11 based workspace")
0159     function(check_X11_lib _lib)
0160         if (NOT TARGET X11::${_lib})
0161             message(SEND_ERROR "Required component ${_lib} of X11 was not found")
0162         endif()
0163     endfunction()
0164     check_X11_lib(ICE)
0165     check_X11_lib(SM)
0166     check_X11_lib(X11)
0167     check_X11_lib(Xau)
0168     check_X11_lib(Xcursor)
0169     check_X11_lib(Xfixes)
0170     check_X11_lib(Xft)
0171     check_X11_lib(Xrender)
0172     check_X11_lib(Xtst)
0173 
0174     set(HAVE_X11 1)
0175     set(HAVE_XCURSOR 1)
0176     set(HAVE_XFIXES 1)
0177 
0178     find_package(XCB MODULE REQUIRED COMPONENTS XCB RANDR IMAGE)
0179     set_package_properties(XCB PROPERTIES TYPE REQUIRED)
0180 
0181 else()
0182     set(HAVE_X11 0)
0183     set(HAVE_XCURSOR 0)
0184     set(HAVE_XFIXES 0)
0185 endif()
0186 
0187 pkg_check_modules(PipeWire IMPORTED_TARGET libpipewire-0.3)
0188 add_feature_info(PipeWire PipeWire_FOUND "Required for Wayland screencasting")
0189 
0190 if(PipeWire_FOUND)
0191   find_package(Libdrm REQUIRED)
0192 endif()
0193 
0194 # FreeBSD systems might have libxcrypt but their shadow equivalent doesn't use it
0195 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
0196     pkg_check_modules(libxcrypt libxcrypt>=4)
0197     if(libxcrypt_FOUND)
0198         set(HAVE_CRYPT_GENSALT true)
0199     endif()
0200 endif()
0201 
0202 find_package(Qt6WaylandClient COMPONENTS Private)
0203 find_package(PlasmaWaylandProtocols 1.6 REQUIRED)
0204 find_package(Wayland REQUIRED COMPONENTS Client Server) # Server is used in autotests
0205 
0206 if(FONTCONFIG_FOUND)
0207   # kfontinst
0208   find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS PrintSupport)
0209 endif()
0210 
0211 find_package(AppStreamQt 1.0) # 1.0 will be the first release to support Qt6
0212 set_package_properties(AppStreamQt PROPERTIES DESCRIPTION "Access metadata for listing available software"
0213                        URL "https://www.freedesktop.org/wiki/Distributions/AppStream/"
0214                        TYPE OPTIONAL)
0215 
0216 if(${AppStreamQt_FOUND})
0217     set(HAVE_APPSTREAMQT true)
0218 endif()
0219 
0220 find_package(UDev REQUIRED)
0221 set_package_properties(UDev PROPERTIES
0222     PURPOSE "Allows to play notification sounds when (un)plugging devices"
0223     TYPE OPTIONAL
0224 )
0225 
0226 # Region & Language KCM
0227 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
0228     # notes for packager:
0229     # This is the macro definition part of Region & Language KCM
0230     # Depending on your distributions, the KCM behaves differently
0231     # For Ubuntu based systems, this KCM uses "check-language-support" and PackageKit
0232     # to install relevant fonts and packages
0233     # You should enable option UBUNTU_PACKAGEKIT (it's auto detected though)
0234     #
0235     # For Glibc systems that don't come with pre-generated locales, such as ArchLinux
0236     # This KCM uses "/etc/locale.gen" and "locale-gen" to generate configured locales
0237     # and display a note to let user install fonts themselves if required
0238     # You shouldn't required to do anything in this case
0239     #
0240     # For Glibc systems that come with pre-generated locales, such as Fedora and openSUSE
0241     # a note to let user install fonts themselves if required is displayed
0242     # You should enable GLIBC_LOCALE_PREGENERATED option
0243     #
0244     # For non-glibc systems such as VoidLinux and *BSD
0245     # A warning of configure locale manually is displayed (although the relevant ENVs are set by Plasma)
0246     # You should disable GLIBC_LOCALE_GEN option
0247 
0248 
0249     # find out if the build system is Ubuntu based
0250     if (${CMAKE_VERSION} VERSION_LESS 3.22)
0251         find_program(LSB_RELEASE_EXEC lsb_release)
0252         execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
0253             OUTPUT_VARIABLE DISTRO_NAME
0254             OUTPUT_STRIP_TRAILING_WHITESPACE
0255         )
0256         string(TOLOWER "${DISTRO_NAME}" DISTRO_NAME)
0257     else()
0258         cmake_host_system_information(RESULT DISTRO_NAME QUERY DISTRIB_ID)
0259         cmake_host_system_information(RESULT DISTRO_ID_LIKE QUERY DISTRIB_ID_LIKE)
0260     endif()
0261 
0262     string(COMPARE EQUAL "ubuntu" "${DISTRO_NAME}" SYSTEM_UBUNTU_BASED)
0263     string(FIND "${DISTRO_ID_LIKE}" "ubuntu" FINDINDEX)
0264     if(NOT (FINDINDEX EQUAL -1))
0265         set(SYSTEM_UBUNTU_BASED ON)
0266         find_program(LANGUAGE_SELECTOR_COMMON "check-language-support" DOC "Required for ubuntu-based distros to generate locale")
0267     endif()
0268 
0269     set(UBUNTU_LOCALE FALSE)
0270     option(UBUNTU_PACKAGEKIT "Install required package for language on Ubuntu Based systems, PackageKitQt6 required" ${SYSTEM_UBUNTU_BASED})
0271     if(UBUNTU_PACKAGEKIT)
0272         find_package(PackageKitQt6)
0273         set_package_properties(PackageKitQt6
0274                 PROPERTIES DESCRIPTION "Software Manager integration"
0275                 TYPE OPTIONAL
0276                 PURPOSE "Used to install additional language packages on demand"
0277                 )
0278         set(UBUNTU_LOCALE ${PackageKitQt6_FOUND})
0279     endif()
0280 
0281     set(GLIBC_LOCALE_GEN_DEFAULT ON)
0282     if(UBUNTU_LOCALE)
0283         set(GLIBC_LOCALE_GEN_DEFAULT OFF)
0284     endif()
0285 
0286     option(GLIBC_LOCALE_GEN "Auto generate Glibc locale with locale-gen and /etc/locale.gen" ${GLIBC_LOCALE_GEN_DEFAULT})
0287     if(GLIBC_LOCALE_GEN AND UBUNTU_LOCALE)
0288         message(FATAL_ERROR "UBUNTU_PACKAGEKIT and GLIBC_LOCALE_GEN both enabled, only UBUNTU_PACKEGKIT will be used")
0289     endif()
0290     if(GLIBC_LOCALE_GEN)
0291         set(GLIBC_LOCALE_AUTO TRUE)
0292     endif()
0293     set(REGION_LANG_GENERATE_LOCALE_HELPER FALSE)
0294     if(UBUNTU_LOCALE OR GLIBC_LOCALE_GEN)
0295         set(REGION_LANG_GENERATE_LOCALE_HELPER TRUE)
0296     endif()
0297 
0298     option(GLIBC_LOCALE_PREGENERATED "Systems that don't require locale generation. Such as openSUSE or Fedora" OFF)
0299     if(GLIBC_LOCALE_PREGENERATED)
0300         set(GLIBC_LOCALE_GENERATED TRUE)
0301     endif()
0302     if(REGION_LANG_GENERATE_LOCALE_HELPER AND GLIBC_LOCALE_PREGENERATED)
0303         message(FATAL_ERROR "(UBUNTU_PACKAGEKIT || GLIBC_LOCALE_GEN) and GLIBC_LOCALE_PREGENERATED both enabled")
0304     endif()
0305 
0306     option(GLIBC_LOCALE "Build with glibc-compatible locale infrastructure" ON)
0307     add_feature_info(GLIBC_LOCALE GLIBC_LOCALE "Locale support is glibc based")
0308     add_feature_info(UBUNTU_LOCALE UBUNTU_LOCALE "Install language packages on Ubuntu-like systems")
0309     add_feature_info(GLIBC_LOCALE_GEN GLIBC_LOCALE_GEN "Generate glibc locales")
0310     add_feature_info(GLIBC_LOCALE_PREGENERATED GLIBC_LOCALE_PREGENERATED "glibc locales are pregenerated")
0311     ################## Find libraries ###################
0312     if(REGION_LANG_GENERATE_LOCALE_HELPER)
0313         find_package(PolkitQt6-1)
0314         set_package_properties(PolkitQt6-1
0315                 PROPERTIES DESCRIPTION "DBus interface wrapper for Polkit"
0316                 PURPOSE "Communicate with localegen helper in region & lang kcm"
0317                 TYPE REQUIRED
0318         )
0319     endif()
0320 endif()
0321 
0322 find_package(ICU COMPONENTS i18n uc)
0323 set_package_properties(ICU
0324         PROPERTIES DESCRIPTION "Unicode and Globalization support for software applications"
0325         TYPE REQUIRED
0326         PURPOSE "Better application groups in Kicker, timezone support"
0327         )
0328 if(${ICU_FOUND})
0329     set(HAVE_ICU TRUE)
0330 endif()
0331 
0332 find_package(KExiv2Qt6)
0333 set_package_properties(KExiv2Qt6
0334         PROPERTIES URL "https://commits.kde.org/libkexiv2"
0335         DESCRIPTION "Image metadata support"
0336         TYPE OPTIONAL
0337         PURPOSE "Provides metadata for image wallpaper plugin"
0338         )
0339 if(${KExiv2Qt6_FOUND})
0340     set(HAVE_KExiv2 TRUE)
0341 endif()
0342 
0343 find_package(KIOExtras)
0344 set_package_properties(KIOExtras PROPERTIES DESCRIPTION "Common KIO slaves for operations."
0345                                        PURPOSE "Show thumbnails in wallpaper selection."
0346                                        TYPE RUNTIME
0347                                         )
0348 
0349 find_package(KIOFuse)
0350 set_package_properties(KIOFuse PROPERTIES DESCRIPTION "Provide KIO support to legacy applications. "
0351                                       TYPE RUNTIME
0352                                       )
0353 
0354 if(Qt6WaylandClient_VERSION VERSION_LESS "6.6.0")
0355     pkg_check_modules(XKBCOMMON xkbcommon REQUIRED IMPORTED_TARGET)
0356 endif()
0357 
0358 # Clipboard applet
0359 ecm_find_qmlmodule(org.kde.prison 1.0)
0360 
0361 # Is building in KDE CI
0362 if(DEFINED ENV{KDECI_BUILD})
0363     set(KDECI_BUILD true)
0364 endif()
0365 
0366 include(ConfigureChecks.cmake)
0367 
0368 include_directories("${CMAKE_CURRENT_BINARY_DIR}")
0369 
0370 ecm_set_disabled_deprecation_versions(
0371     QT 5.15.2
0372     KF 5.98.0
0373     KDECLARATIVE 5.88.0
0374     KRUNNER 5.103.0
0375 )
0376 
0377 configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h)
0378 configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h)
0379 configure_file(config-appstream.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-appstream.h )
0380 configure_file(config-KDECI_BUILD.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-KDECI_BUILD.h )
0381 add_subdirectory(login-sessions)
0382 add_subdirectory(lookandfeel)
0383 
0384 if (INSTALL_SDDM_WAYLAND_SESSION)
0385     install(FILES sddm-wayland-session/plasma-wayland.conf DESTINATION /etc/sddm.conf.d)
0386 else()
0387     message(STATUS "INSTALL_SDDM_WAYLAND_SESSION is disabled. As soon as it's installed, SDDM will default to use Wayland and KWin for its greeter session (BETA, do not deploy to final users yet).")
0388 endif()
0389 
0390 add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
0391 
0392 # locate qdbus in the Qt path because not every distro makes a symlink at /usr/bin/qdbus
0393 ecm_query_qt(QtBinariesDir QT_INSTALL_BINS)
0394 
0395 if(KF6DocTools_FOUND)
0396   add_subdirectory(doc)
0397   kdoctools_install(po)
0398 endif()
0399 add_subdirectory(libkworkspace)
0400 add_subdirectory(libdbusmenuqt)
0401 add_subdirectory(appmenu)
0402 
0403 add_subdirectory(libtaskmanager)
0404 add_subdirectory(libkmpris)
0405 add_subdirectory(libnotificationmanager)
0406 add_subdirectory(libcolorcorrect)
0407 add_subdirectory(components)
0408 
0409 add_subdirectory(plasma-windowed)
0410 add_subdirectory(shell)
0411 add_subdirectory(freespacenotifier)
0412 add_subdirectory(klipper)
0413 add_subdirectory(krunner)
0414 add_subdirectory(ksmserver)
0415 add_subdirectory(logout-greeter)
0416 add_subdirectory(ksplash)
0417 add_subdirectory(statusnotifierwatcher)
0418 add_subdirectory(startkde)
0419 add_subdirectory(themes)
0420 
0421 add_subdirectory(kcms)
0422 
0423 add_subdirectory(containmentactions)
0424 add_subdirectory(runners)
0425 add_subdirectory(applets)
0426 add_subdirectory(dataengines)
0427 add_subdirectory(wallpapers)
0428 
0429 add_subdirectory(kioworkers)
0430 add_subdirectory(ktimezoned)
0431 add_subdirectory(menu)
0432 add_subdirectory(phonon)
0433 
0434 add_subdirectory(interactiveconsole)
0435 
0436 # This ensures pressing the eject button on a CD drive ejects the disc
0437 # It listens to the Solid::OpticalDrive::ejectPressed signal that is only
0438 # supported by Solid in the HAL backend and does nothing with UDev
0439 if(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
0440 add_subdirectory(solidautoeject)
0441 endif()
0442 
0443 ecm_optional_add_subdirectory(xembed-sni-proxy)
0444 
0445 ecm_optional_add_subdirectory(gmenu-dbusmenu-proxy)
0446 
0447 add_subdirectory(soliduiserver)
0448 
0449 if(KF6Holidays_FOUND)
0450     add_subdirectory(plasmacalendarintegration)
0451 endif()
0452 
0453 add_subdirectory(appiumtests)
0454 
0455 if (TARGET UDev::UDev)
0456     add_subdirectory(devicenotifications)
0457 endif()
0458 
0459 ki18n_install(po)
0460 
0461 install(FILES completions/plasmashell.zsh RENAME _plasmashell DESTINATION ${KDE_INSTALL_ZSHAUTOCOMPLETEDIR})
0462 
0463 ecm_qt_install_logging_categories(
0464         EXPORT PLASMAWORKSPACE
0465         FILE plasma-workspace.categories
0466         DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
0467         )
0468 
0469 
0470 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
0471 
0472 # add clang-format target for all our real source files
0473 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
0474 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
0475 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)