Add Framework laptop controls and monitoring with hardware-aware discovery

This commit is contained in:
ajp_anton
2026-09-11 10:29:27 +00:00
parent 787231cb03
commit 8719402d97
50 changed files with 3611 additions and 9 deletions
+45
View File
@@ -0,0 +1,45 @@
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.16)
project(framework-laptop-tools 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(CTest)
find_package(Qt6 6.8 REQUIRED COMPONENTS Core Widgets DBus Test)
find_package(KF6Auth REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(Systemd REQUIRED IMPORTED_TARGET libsystemd)
add_library(framework-hardware STATIC src/hardware.cpp src/fan.cpp src/cpu.cpp)
target_include_directories(framework-hardware PUBLIC src)
target_link_libraries(framework-hardware PUBLIC Qt6::Core)
set(gui_sources src/window.cpp src/chart.cpp src/legend.cpp src/tray.cpp src/traypage.cpp src/colorbutton.cpp src/cpupage.cpp src/valuecontrol.cpp)
add_executable(framework-laptop-tools src/main.cpp ${gui_sources})
target_link_libraries(framework-laptop-tools PRIVATE framework-hardware Qt6::Widgets Qt6::DBus KF6::AuthCore)
add_executable(framework-laptop-tools-helper src/helper.cpp)
target_link_libraries(framework-laptop-tools-helper PRIVATE framework-hardware KF6::AuthCore Qt6::DBus)
add_executable(framework-laptop-tools-fan src/fanservice.cpp)
target_link_libraries(framework-laptop-tools-fan PRIVATE framework-hardware PkgConfig::Systemd)
add_executable(framework-laptop-tools-cpu src/cpuservice.cpp)
target_link_libraries(framework-laptop-tools-cpu PRIVATE framework-hardware Qt6::DBus PkgConfig::Systemd)
install(TARGETS framework-laptop-tools DESTINATION ${KDE_INSTALL_BINDIR})
install(TARGETS framework-laptop-tools-helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
install(TARGETS framework-laptop-tools-fan DESTINATION libexec)
install(TARGETS framework-laptop-tools-cpu DESTINATION libexec)
kauth_install_helper_files(framework-laptop-tools-helper se.ajpanton.frameworktools root)
kauth_install_actions(se.ajpanton.frameworktools data/se.ajpanton.frameworktools.actions)
install(FILES data/se.ajpanton.framework-laptop-tools.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES data/framework-laptop-tools.json DESTINATION ${KDE_INSTALL_DATADIR}/fedora-tools/settings)
install(FILES data/framework-laptop-tools-fan.service data/framework-laptop-tools-fan-resume.service DESTINATION /usr/lib/systemd/system)
install(FILES data/framework-laptop-tools-cpu.service DESTINATION /usr/lib/systemd/system)
if(BUILD_TESTING)
add_executable(test-hardware tests/test-hardware.cpp)
target_link_libraries(test-hardware PRIVATE framework-hardware Qt6::Test)
add_test(NAME hardware COMMAND test-hardware)
add_executable(test-window tests/test-window.cpp ${gui_sources})
target_link_libraries(test-window PRIVATE framework-hardware Qt6::Widgets Qt6::DBus Qt6::Test KF6::AuthCore)
add_test(NAME window COMMAND test-window)
set_tests_properties(window PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
endif()