From 3a8f9de12c591a9e7f565b3b35475d3b1ff80a0b Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Thu, 18 Jan 2024 20:34:59 +0100 Subject: [PATCH] Update to Qt 6 and ECM --- CMakeLists.txt | 71 +++++++++++------- README.md | 9 ++- features.cmake | 21 ++++++ src/imports/pulseaudio/CMakeLists.txt | 97 ++++++++++--------------- src/imports/pulseaudio/plugins.qmltypes | 0 5 files changed, 110 insertions(+), 88 deletions(-) create mode 100644 features.cmake delete mode 100644 src/imports/pulseaudio/plugins.qmltypes diff --git a/CMakeLists.txt b/CMakeLists.txt index 40da0b8..6c17d4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.0) +cmake_minimum_required(VERSION 3.19) project("PulseAudio" VERSION "0.9.0" @@ -6,37 +6,58 @@ project("PulseAudio" LANGUAGES CXX C ) -## Shared macros and functions: -if(NOT LIRI_LOCAL_ECM) - find_package(LiriCMakeShared "2.0.0" REQUIRED NO_MODULE) - list(APPEND CMAKE_MODULE_PATH "${LCS_MODULE_PATH}") +## Only build on the appropriate platforms. +if(NOT (UNIX OR NOT CMAKE_SYSTEM_NAME MATCHES "Android")) + message(NOTICE "Skipping the build as the condition \"UNIX OR NOT Android\" is not met.") + return() endif() -## Add some paths to check for CMake modules: -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +## ECM: +find_package(ECM 5.245.0 REQUIRED NO_MODULE) +list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) -## Set minimum versions required: -set(QT_MIN_VERSION "5.15.0") +## Installation directories: +include(KDEInstallDirs) -## Liri specific setup common for all modules: -include(LiriSetup) +## Compiler settings: +set(KDE_SKIP_NULLPTR_WARNINGS_SETTINGS TRUE) +include(KDECompilerSettings NO_POLICY_SCOPE) -## Only build on the appropriate platforms. -if(NOT UNIX OR ANDROID) - message(NOTICE "Skipping the build as the condition \"UNIX OR ANDROID\" is not met.") - return() +## Enable keywords such as emit: +# TODO: Replace keywords such as emit with Q_EMIT +remove_definitions(-DQT_NO_KEYWORDS) + +## CMake settings: +include(KDECMakeSettings) + +## QML module: +include(ECMQmlModule) + +## ECM: +include(ECMQtDeclareLoggingCategory) + +## Disable use of C++ API deprecated in Qt 5.15 +add_compile_definitions(QT_DISABLE_DEPRECATED_UP_TO=0x050F00) + +## QML import path: +if(NOT QML_IMPORT_PATH) + set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/bin CACHE STRING "" FORCE) endif() -## Find Qt 5: -find_package(Qt5 "${QT_MIN_VERSION}" - CONFIG REQUIRED - COMPONENTS - Core - Gui - Qml - Quick - LinguistTools -) +## Shared macros and functions: +#if(NOT LIRI_LOCAL_ECM) + #find_package(LiriCMakeShared "2.0.0" REQUIRED NO_MODULE) + #list(APPEND CMAKE_MODULE_PATH "${LCS_MODULE_PATH}") +#endif() + +## Add some paths to check for CMake modules: +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +## Liri specific setup common for all modules: +#include(LiriSetup) + +## Features: +include(features.cmake) ## Add subdirectories: add_subdirectory(src/imports/pulseaudio) diff --git a/README.md b/README.md index b1cdba4..0841630 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,17 @@ This repository contains: ## Dependencies -Qt >= 5.15.0 with at least the following modules is required: +Qt >= 6.6.0 with at least the following modules is required: * [qtbase](http://code.qt.io/cgit/qt/qtbase.git) * [qtdeclarative](http://code.qt.io/cgit/qt/qtdeclarative.git) The following modules and their dependencies are required: - * [cmake](https://gitlab.kitware.com/cmake/cmake) >= 3.10.0 - * [cmake-shared](https://github.com/lirios/cmake-shared.git) >= 2.0.0 - * [fluid](https://github.com/lirios/fluid) >= 1.0.0 + * [cmake](https://gitlab.kitware.com/cmake/cmake) >= 3.19.0 + * [liri-settings](https://github.com/lirios/settings) + * [liri-shell](https://github.com/lirios/shell) + * [fluid](https://github.com/lirios/fluid) >= 2.0.0 * [pulseadio](https://cgit.freedesktop.org/pulseaudio/pulseaudio/) >= 5.0.0 ## Installation diff --git a/features.cmake b/features.cmake new file mode 100644 index 0000000..4fe6438 --- /dev/null +++ b/features.cmake @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: 2024 Pier Luigi Fiorini +# SPDX-License-Identifier: BSD-3-Clause + +## Find Qt: +find_package(Qt6 "6.6.0" + REQUIRED + COMPONENTS + Core + Gui + Qml + Quick + LinguistTools +) + +## Find pulse: +find_package(Libpulse REQUIRED) + +## Features summary: +if(NOT LIRI_SUPERBUILD) + feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) +endif() diff --git a/src/imports/pulseaudio/CMakeLists.txt b/src/imports/pulseaudio/CMakeLists.txt index 867c1d7..81ed750 100644 --- a/src/imports/pulseaudio/CMakeLists.txt +++ b/src/imports/pulseaudio/CMakeLists.txt @@ -1,64 +1,43 @@ -find_package(Libpulse REQUIRED) +ecm_add_qml_module(PulseAudioQmlPlugin + URI Liri.PulseAudio + VERSION 1.0 + CLASS_NAME PulseAudioPlugin + NO_GENERATE_PLUGIN_SOURCE + DEPENDENCIES QtQuick +) -liri_add_qml_plugin(PulseAudioQmlPlugin - MODULE_PATH - "Liri/PulseAudio" - VERSION - "1.0" - OUTPUT_NAME - "pulseaudioplugin" - SOURCES +target_sources(PulseAudioQmlPlugin + PRIVATE + qpulseaudio/card.cpp qpulseaudio/card.h + qpulseaudio/client.cpp qpulseaudio/client.h + qpulseaudio/context.cpp qpulseaudio/context.h + qpulseaudio/debug.cpp qpulseaudio/debug.h + qpulseaudio/device.cpp qpulseaudio/device.h + qpulseaudio/maps.cpp qpulseaudio/maps.h + qpulseaudio/operation.cpp qpulseaudio/operation.h + qpulseaudio/port.cpp qpulseaudio/port.h + qpulseaudio/profile.cpp qpulseaudio/profile.h + qpulseaudio/pulseaudio.cpp qpulseaudio/pulseaudio.h + qpulseaudio/pulseobject.cpp qpulseaudio/pulseobject.h + qpulseaudio/ref.cpp qpulseaudio/ref.h + qpulseaudio/server.cpp qpulseaudio/server.h + qpulseaudio/sink.cpp qpulseaudio/sink.h + qpulseaudio/sinkinput.cpp qpulseaudio/sinkinput.h + qpulseaudio/source.cpp qpulseaudio/source.h + qpulseaudio/sourceoutput.cpp qpulseaudio/sourceoutput.h + qpulseaudio/stream.cpp qpulseaudio/stream.h + qpulseaudio/streamrestore.cpp qpulseaudio/streamrestore.h + qpulseaudio/volumeobject.cpp qpulseaudio/volumeobject.h plugin.cpp - qpulseaudio/card.cpp - qpulseaudio/card.h - qpulseaudio/client.cpp - qpulseaudio/client.h - qpulseaudio/context.cpp - qpulseaudio/context.h - qpulseaudio/debug.cpp - qpulseaudio/debug.h - qpulseaudio/device.cpp - qpulseaudio/device.h - qpulseaudio/maps.cpp - qpulseaudio/maps.h - qpulseaudio/operation.cpp - qpulseaudio/operation.h - qpulseaudio/port.cpp - qpulseaudio/port.h - qpulseaudio/profile.cpp - qpulseaudio/profile.h - qpulseaudio/pulseaudio.cpp - qpulseaudio/pulseaudio.h - qpulseaudio/pulseobject.cpp - qpulseaudio/pulseobject.h - qpulseaudio/ref.cpp - qpulseaudio/ref.h - qpulseaudio/server.cpp - qpulseaudio/server.h - qpulseaudio/sink.cpp - qpulseaudio/sink.h - qpulseaudio/sinkinput.cpp - qpulseaudio/sinkinput.h - qpulseaudio/source.cpp - qpulseaudio/source.h - qpulseaudio/sourceoutput.cpp - qpulseaudio/sourceoutput.h - qpulseaudio/stream.cpp - qpulseaudio/stream.h - qpulseaudio/streamrestore.cpp - qpulseaudio/streamrestore.h - qpulseaudio/volumeobject.cpp - qpulseaudio/volumeobject.h - INCLUDE_DIRECTORIES - "${CMAKE_CURRENT_SOURCE_DIR}/qpulseaudio" - QML_FILES +) + +ecm_target_qml_sources(PulseAudioQmlPlugin + SOURCES VolumeControl.qml - qmldir - #DEFINES - #QT_NO_CAST_FROM_ASCII - #QT_NO_FOREACH - LIBRARIES - PkgConfig::Libpulse ) -liri_finalize_qml_plugin(PulseAudioQmlPlugin) +target_include_directories(PulseAudioQmlPlugin PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/qpulseaudio") + +target_link_libraries(PulseAudioQmlPlugin PRIVATE Qt6::Qml PkgConfig::Libpulse) + +ecm_finalize_qml_module(PulseAudioQmlPlugin) diff --git a/src/imports/pulseaudio/plugins.qmltypes b/src/imports/pulseaudio/plugins.qmltypes deleted file mode 100644 index e69de29..0000000