# SPDX-License-Identifier: MIT cmake_minimum_required(VERSION 3.16) project(plasma-panel-actions VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(ECM 6.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(CTest) find_package(Qt6 6.8 REQUIRED COMPONENTS Quick Widgets DBus Test QuickTest) find_package(KF6 REQUIRED COMPONENTS Config I18n Service KIO) add_library(panelactionsplugin MODULE src/plugin.cpp src/panelcontroller.cpp src/settings.cpp) target_link_libraries(panelactionsplugin PRIVATE Qt6::Quick Qt6::DBus KF6::ConfigCore KF6::Service KF6::KIOGui) set_target_properties(panelactionsplugin PROPERTIES PREFIX "lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml/se/ajpanton/panelactions") configure_file(data/qmldir qml/se/ajpanton/panelactions/qmldir COPYONLY) add_executable(plasma-panel-actions src/main.cpp src/settings.cpp) target_link_libraries(plasma-panel-actions PRIVATE Qt6::Quick Qt6::Widgets Qt6::DBus KF6::ConfigCore KF6::I18n KF6::I18nQml KF6::Service KF6::KIOGui) # RPM normalizes file timestamps. A content-specific URL prevents Qt from # reusing an older settings page's disk cache after a same-day upgrade. set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS src/SettingsWindow.qml src/ConfigGeneral.qml) file(SHA256 src/SettingsWindow.qml window_hash) file(SHA256 src/ConfigGeneral.qml form_hash) string(SHA256 ui_hash "${window_hash}${form_hash}") set(settings_ui_dir "plasma-panel-actions/${ui_hash}") target_compile_definitions(plasma-panel-actions PRIVATE SETTINGS_UI_DIR="${settings_ui_dir}") install(TARGETS plasma-panel-actions DESTINATION ${KDE_INSTALL_BINDIR}) install(FILES src/SettingsWindow.qml src/ConfigGeneral.qml DESTINATION ${KDE_INSTALL_DATADIR}/${settings_ui_dir}) install(FILES data/se.ajpanton.plasma-panel-actions.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install(FILES data/se.ajpanton.plasma-panel-actions-autostart.desktop DESTINATION ${KDE_INSTALL_AUTOSTARTDIR}) install(FILES data/plasma-panel-actions.json DESTINATION ${KDE_INSTALL_DATADIR}/fedora-tools/settings) install(TARGETS panelactionsplugin DESTINATION ${KDE_INSTALL_QMLDIR}/se/ajpanton/panelactions) install(FILES data/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/se/ajpanton/panelactions) install(DIRECTORY package/ DESTINATION ${KDE_INSTALL_DATADIR}/plasma/plasmoids/se.ajpanton.panelactions) install(DIRECTORY controller/ DESTINATION ${KDE_INSTALL_DATADIR}/plasma/plasmoids/se.ajpanton.panelactions.controller) if(BUILD_TESTING) add_executable(test-panelsettings tests/test-settings.cpp src/settings.cpp) target_link_libraries(test-panelsettings PRIVATE Qt6::Test KF6::ConfigCore KF6::Service KF6::KIOGui) target_include_directories(test-panelsettings PRIVATE src) add_test(NAME panelsettings COMMAND test-panelsettings) add_executable(test-panelcontroller tests/test-panelcontroller.cpp src/panelcontroller.cpp) target_link_libraries(test-panelcontroller PRIVATE Qt6::Quick Qt6::DBus Qt6::Test) target_include_directories(test-panelcontroller PRIVATE src) add_test(NAME panelcontroller COMMAND test-panelcontroller) set_tests_properties(panelcontroller PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=offscreen") add_executable(test-panelareas tests/quicktest.cpp) target_link_libraries(test-panelareas PRIVATE Qt6::QuickTest Qt6::Qml) add_test(NAME panelareas COMMAND test-panelareas -input ${CMAKE_CURRENT_SOURCE_DIR}/tests) set_tests_properties(panelareas PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=offscreen;QT_QUICK_BACKEND=software;QML_IMPORT_PATH=${CMAKE_BINARY_DIR}/qml") endif()