mirror-kde-plasma-desktop/kcms/keyboard/CMakeLists.txt
Alexander Lohnau e170f15429 kcm/runners: Allow simpler installation of DBus runners
While the install.sh script that is part of the python templates worked
great, it still is visually annoying to have a terminal window open when we
just need to copy/generate two files.

With a krunner-plugininstallerrc file, consumers can provide instructions on
how to generate the dbus service and where to find the desktop file for
the runner.

This is intended for python runners, but can work with any other
language or even prebuild binaries.
In the future, we might want to add the possibility to add dependencies.
But for now, the current state should suffice.

Also, we could adjust the installation without having to edit the
KRunner template and lots of existing KRunner plugins that are already
published.

Since there are a few moving parts involved, an autotest was added to
ensure the files end up in the correct destination.
This also checks the dynamically generated content of the service and
tests the one given line of the desktop file
2023-07-12 18:12:10 +00:00

153 lines
3.7 KiB
CMake

add_definitions(-DTRANSLATION_DOMAIN=\"kcmkeyboard\")
add_subdirectory(tastenbrett)
option(HAVE_XINPUT "X11 XInput" OFF)
option(HAVE_UDEV "UDev" OFF)
if (X11_Xinput_FOUND)
set(HAVE_XINPUT ON)
elseif (UDEV_FOUND)
set(HAVE_UDEV ON)
else()
message(STATUS "X11 XInput and UDev is not found, either is required to keep layouts with keyboard hotplugging")
endif()
### kded daemon ###
set( kded_keyboard_SRCS
${CMAKE_CURRENT_BINARY_DIR}/debug.cpp
keyboard_daemon.cpp
layout_memory.cpp
layout_memory_persister.cpp
udev_helper.cpp
x11_helper.cpp
xinput_helper.cpp
xkb_helper.cpp
keyboard_config.cpp
keyboard_hardware.cpp
bindings.cpp
flags.cpp
xkb_rules.cpp
layoutnames.cpp
)
kconfig_add_kcfg_files(kded_keyboard_SRCS keyboardsettings.kcfgc)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
kcoreaddons_add_plugin(kded_keyboard SOURCES ${kded_keyboard_SRCS} INSTALL_NAMESPACE kf6/kded)
set_target_properties(kded_keyboard PROPERTIES OUTPUT_NAME keyboard)
target_link_libraries(kded_keyboard
Qt::Concurrent
Qt::Widgets
Qt::Xml
KF6::ConfigCore
KF6::CoreAddons
KF6::KCMUtils
KF6::DBusAddons
KF6::GlobalAccel
KF6::I18n
KF6::Notifications
KF6::WindowSystem
KF6::Plasma
KF6::XmlGui
KF6::GuiAddons
XCB::XCB
XCB::XKB
X11::X11
X11::xkbfile
)
target_link_libraries(kded_keyboard Qt::GuiPrivate)
if (HAVE_XINPUT)
target_link_libraries(kded_keyboard X11::Xi)
endif()
if (HAVE_UDEV)
target_link_libraries(kded_keyboard UDev::UDev)
endif()
### kcm keyboard ###
set(kcm_keyboard_PART_SRCS
kcm_keyboard.cpp
kcm_keyboard_widget.cpp
kcm_view_models.cpp
kcm_add_layout_dialog.cpp
keyboard_config.cpp
keyboardsettingsdata.cpp
x11_helper.cpp
xkb_helper.cpp
xkb_rules.cpp
flags.cpp
iso_codes.cpp
kcmmisc.cpp
bindings.cpp
tastenbrett.cpp)
install(FILES kcminputrc_repeat.upd
DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
install(PROGRAMS kcminputrc_migrate_repeat_value.py
DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
install(FILES kcminputrc_fix_botched_5_21_0.upd
DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
install(PROGRAMS kcminputrc_fix_botched_5_21_0.py
DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
ecm_qt_declare_logging_category(kcm_keyboard_PART_SRCS
HEADER debug.h
IDENTIFIER KCM_KEYBOARD
CATEGORY_NAME org.kde.kcm_keyboard
DEFAULT_SEVERITY Warning
DESCRIPTION "KCM and KDED for keyboard layouts"
EXPORT kcm_keyboard)
ecm_qt_install_logging_categories(
EXPORT kcm_keyboard
DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}"
)
kconfig_add_kcfg_files(kcm_keyboard_PART_SRCS workspace_options.kcfgc keyboardsettings.kcfgc keyboardmiscsettings.kcfgc)
ki18n_wrap_ui(kcm_keyboard_PART_SRCS kcm_keyboard.ui kcm_add_layout_dialog.ui kcmmiscwidget.ui)
add_library(kcm_keyboard_static STATIC ${kcm_keyboard_PART_SRCS})
set_property(TARGET kcm_keyboard_static PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(kcm_keyboard_static
Qt::Concurrent
Qt::Widgets
Qt::Xml
Qt::GuiPrivate
KF6::KCMUtils
KF6::GlobalAccel
KF6::I18n
KF6::WindowSystem
KF6::Plasma
KF6::XmlGui
KF6::GuiAddons
XCB::XCB
XCB::XKB
X11::X11
X11::xkbfile
)
kcoreaddons_add_plugin(kcm_keyboard SOURCES kcmmain.cpp INSTALL_NAMESPACE "plasma/kcms/systemsettings")
kcmutils_generate_desktop_file(kcm_keyboard)
target_link_libraries(kcm_keyboard kcm_keyboard_static)
add_subdirectory(kconf_update)
configure_file(config-keyboard.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keyboard.h)
# Unit tests
if(BUILD_TESTING)
add_subdirectory( tests )
endif()
add_dependencies(kcm_keyboard tastenbrett)
add_subdirectory(qml)