a-la-karte/CMakeLists.txt

188 lines
5.6 KiB
Text
Raw Normal View History

# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2026 A-La-Karte Contributors
cmake_minimum_required(VERSION 3.20)
project(alakarte VERSION 0.1.1)
set(PROJECT_DEP_VERSION "6.0.0")
set(QT_MIN_VERSION "6.6.0")
set(KF_MIN_VERSION "6.0.0")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDEClangFormat)
include(KDEGitCommitHooks)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMPoQmTools)
include(ECMDeprecationSettings)
include(ECMQmlModule)
include(ECMAddAppIcon)
include(CTest)
include(FeatureSummary)
ecm_setup_version(${PROJECT_VERSION}
VARIABLE_PREFIX ALAKARTE
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/src/alakarte-version.h"
)
ecm_set_disabled_deprecation_versions(
QT 6.7
KF 6.4
)
find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS
Core
Quick
QuickControls2
Gui
Add Plasma tray, notification inhibition, session control, and flatpak runner Expand TrayController with daemon health polling every 10 seconds via D-Bus Ping calls to org.kde.GameCenter1, org.kde.ALaKarte.Runner1, and org.kde.ALaKarte.Input1. Add menu actions to toggle console behaviors, notification mirroring, and to restart each daemon via systemctl --user. Add NotificationInhibitor, owned by App, which calls org.freedesktop.Notifications Inhibit/UnInhibit on the session bus whenever the consoleBehaviors config setting changes. The cookie is released on application quit. Add consoleBehaviors and mirrorNotifications properties to Config with KConfig persistence under the [Console] group. Ship org.kde.alakarte.notifyrc defining GameLaunched, GameExited, and LaunchFailed notification events so Plasma attributes them correctly in the notification history. Extend RunnerManagerDaemon::ResolveLaunch with a flatpak runner branch that constructs a flatpak run command, translates environment overrides to --env= arguments, and respects flatpakAppId, flatpakBranch, flatpakArch, and flatpakArgs from the launch spec. Add activate_session, switch_to_vt, and terminate_session actions to the gamecenter KAuth helper and its polkit policy. Each action calls the corresponding method on org.freedesktop.login1 over the system bus. Add CouchSidebar.qml, a horizontal source tab bar shown in couch mode above the library view, exposing the same sourceSelected, settingsRequested, importRequested, and aboutRequested signals as SidebarView. Fix duplicate adaptiveFocusRingWidth property in GameCard.qml.
2026-03-22 15:53:09 +00:00
Widgets
Network
Concurrent
DBus
2026-02-15 12:55:09 +00:00
DBusTools
Svg
Sql
)
set(ALAKARTE_SDL3_SOURCE_DIR "" CACHE PATH "Path to an SDL3 source tree to build instead of using the system SDL3 package")
if (ALAKARTE_SDL3_SOURCE_DIR)
if (EXISTS "${ALAKARTE_SDL3_SOURCE_DIR}/CMakeLists.txt")
set(SDL_TESTS OFF CACHE BOOL "" FORCE)
set(SDL_TEST_LIBRARY OFF CACHE BOOL "" FORCE)
set(SDL_DISABLE_INSTALL ON CACHE BOOL "" FORCE)
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
set(SDL_STATIC ON CACHE BOOL "" FORCE)
set(SDL_X11_XSCRNSAVER OFF CACHE BOOL "" FORCE)
add_subdirectory("${ALAKARTE_SDL3_SOURCE_DIR}" third_party/SDL-build EXCLUDE_FROM_ALL)
# SDL built from source is treated as a third-party dependency. Silence its
# warnings so they don't drown out warnings from A-La-Karte itself.
foreach(_alakarte_sdl_target IN ITEMS SDL3-static SDL3-static_a SDL3-shared SDL_uclibc)
if (TARGET ${_alakarte_sdl_target})
target_compile_options(${_alakarte_sdl_target} PRIVATE
$<$<COMPILE_LANG_AND_ID:C,GNU,Clang,AppleClang>:-w>
$<$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>:-w>
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/w>
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/w>
)
endif()
endforeach()
else()
message(FATAL_ERROR "ALAKARTE_SDL3_SOURCE_DIR does not contain a CMakeLists.txt: ${ALAKARTE_SDL3_SOURCE_DIR}")
endif()
else()
find_package(SDL3 REQUIRED)
endif()
if (NOT TARGET SDL3::SDL3)
if (TARGET SDL3::SDL3-static)
add_library(SDL3::SDL3 ALIAS SDL3::SDL3-static)
elseif (TARGET SDL3::SDL3-shared)
add_library(SDL3::SDL3 ALIAS SDL3::SDL3-shared)
elseif (TARGET SDL3::SDL3::SDL3)
add_library(SDL3::SDL3 ALIAS SDL3::SDL3::SDL3)
else()
message(FATAL_ERROR "SDL3 was found/built, but no usable CMake target was provided (expected SDL3::SDL3 or a compatible variant)")
endif()
endif()
find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS
Kirigami
I18n
CoreAddons
Config
Crash
DBusAddons
WindowSystem
)
find_package(Qt6 COMPONENTS Multimedia QUIET)
find_package(KF6Auth ${KF_MIN_VERSION} QUIET)
Add Plasma tray, notification inhibition, session control, and flatpak runner Expand TrayController with daemon health polling every 10 seconds via D-Bus Ping calls to org.kde.GameCenter1, org.kde.ALaKarte.Runner1, and org.kde.ALaKarte.Input1. Add menu actions to toggle console behaviors, notification mirroring, and to restart each daemon via systemctl --user. Add NotificationInhibitor, owned by App, which calls org.freedesktop.Notifications Inhibit/UnInhibit on the session bus whenever the consoleBehaviors config setting changes. The cookie is released on application quit. Add consoleBehaviors and mirrorNotifications properties to Config with KConfig persistence under the [Console] group. Ship org.kde.alakarte.notifyrc defining GameLaunched, GameExited, and LaunchFailed notification events so Plasma attributes them correctly in the notification history. Extend RunnerManagerDaemon::ResolveLaunch with a flatpak runner branch that constructs a flatpak run command, translates environment overrides to --env= arguments, and respects flatpakAppId, flatpakBranch, flatpakArch, and flatpakArgs from the launch spec. Add activate_session, switch_to_vt, and terminate_session actions to the gamecenter KAuth helper and its polkit policy. Each action calls the corresponding method on org.freedesktop.login1 over the system bus. Add CouchSidebar.qml, a horizontal source tab bar shown in couch mode above the library view, exposing the same sourceSelected, settingsRequested, importRequested, and aboutRequested signals as SidebarView. Fix duplicate adaptiveFocusRingWidth property in GameCard.qml.
2026-03-22 15:53:09 +00:00
find_package(KF6StatusNotifierItem ${KF_MIN_VERSION} QUIET)
find_package(KF6KirigamiAddons 1.0.0 REQUIRED)
qt_policy(SET QTP0001 NEW)
set(MAUI_MAJOR_VERSION 4)
set(MAUIMAN_VERSION 4.0.2)
set(MAUIKIT_VERSION 4.0.2)
set(CMAKE_FIND_PACKAGE_REDIRECTS_DIR "${CMAKE_BINARY_DIR}/package_redirects")
file(MAKE_DIRECTORY "${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}")
set(BUILD_DEMO OFF CACHE BOOL "" FORCE)
set(BUNDLE_LUV_ICONS OFF CACHE BOOL "" FORCE)
add_subdirectory(third-party/mauiman EXCLUDE_FROM_ALL)
set(_mauiman_shim "${CMAKE_BINARY_DIR}/mauiman_include")
file(MAKE_DIRECTORY "${_mauiman_shim}/MauiMan4")
file(COPY "${CMAKE_SOURCE_DIR}/third-party/mauiman/lib/src/modules/"
DESTINATION "${_mauiman_shim}/MauiMan4/"
FILES_MATCHING PATTERN "*.h")
file(COPY "${CMAKE_SOURCE_DIR}/third-party/mauiman/lib/src/mauimanutils.h"
DESTINATION "${_mauiman_shim}/MauiMan4/")
target_include_directories(MauiMan4 PUBLIC
"$<BUILD_INTERFACE:${_mauiman_shim}>")
file(WRITE "${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/MauiMan4Config.cmake" [=[
set(MauiMan4_FOUND TRUE)
if(NOT TARGET MauiMan4::MauiMan4)
add_library(MauiMan4::MauiMan4 ALIAS MauiMan4)
endif()
]=])
file(WRITE "${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/MauiMan4ConfigVersion.cmake" [=[
set(PACKAGE_VERSION "4.0.2")
set(PACKAGE_VERSION_EXACT TRUE)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
set(PACKAGE_VERSION_UNSUITABLE FALSE)
]=])
add_subdirectory(third-party/mauikit EXCLUDE_FROM_ALL)
foreach(_mauikit_target MauiKit4 MauiKit4plugin)
if(TARGET ${_mauikit_target})
target_compile_options(${_mauikit_target} PRIVATE
"-UQT_NO_CAST_FROM_ASCII"
"-UQT_NO_CAST_TO_ASCII"
"-UQT_NO_CAST_FROM_BYTEARRAY"
"-UQT_NO_URL_CAST_FROM_STRING"
"-UQT_NO_FOREACH"
"-UQT_NO_KEYWORDS")
endif()
endforeach()
add_subdirectory(src)
add_subdirectory(src/krunner)
add_subdirectory(icons)
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
ki18n_install(po)
install(FILES org.kde.alakarte.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES org.kde.alakarte.metainfo.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)