From a2e9daf4ddfadc6735b72f8f08563dc4f83a22d5 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Thu, 30 Nov 2023 22:45:53 +0100 Subject: [PATCH] Update to Qt 6 and ECM --- .github/workflows/build.yml | 4 +-- CMakeLists.txt | 52 ++++++++++++++++++++----------- README.md | 5 ++- src/waylandscanner/CMakeLists.txt | 28 ++++++++++------- 4 files changed, 53 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af0da02..5cdc7ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,5 +17,5 @@ on: - develop jobs: - build-qt5: - uses: lirios/.github/.github/workflows/build-linux-qt5.yml@master + build-qt6: + uses: lirios/.github/.github/workflows/build-linux-qt6.yml@master diff --git a/CMakeLists.txt b/CMakeLists.txt index 156373c..3de4817 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10.0) +cmake_minimum_required(VERSION 3.19) project("AuroraScanner" VERSION "0.0.0" @@ -10,32 +10,46 @@ project("AuroraScanner" 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}") -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) - ## Only build on the appropriate platforms. -if(NOT (LINUX OR APPLE OR QNX)) - message(NOTICE "Skipping the build as the condition \"LINUX OR APPLE OR QNX\" is not met.") +if(NOT (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "QNX")) + message(NOTICE "Skipping the build as the condition \"Linux OR Darwin OR QNX\" is not met.") return() endif() -## Find Qt 5: -set(QT_MIN_VERSION "5.15.0") -find_package(Qt5 "${QT_MIN_VERSION}" - CONFIG REQUIRED +## Enable feature summary at the end of the configure run: +include(FeatureSummary) + +## Find Qt: +find_package(Qt6 + REQUIRED COMPONENTS Core Xml ) +## ECM: +find_package(ECM 5.245.0 REQUIRED NO_MODULE) +list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) + +## Installation directories: +include(KDEInstallDirs) + +## Compiler settings: +set(KDE_SKIP_NULLPTR_WARNINGS_SETTINGS TRUE) +include(KDECompilerSettings NO_POLICY_SCOPE) + +## Enable keywords such as emit: +# TODO: Replace keywords such as emit with Q_EMIT +remove_definitions(-DQT_NO_KEYWORDS) + +## CMake settings: +include(KDECMakeSettings) + +## Project setup: +qt_standard_project_setup(REQUIRES 6.6) + +## Disable use of C++ API deprecated in Qt 5.15 +add_compile_definitions(QT_DISABLE_DEPRECATED_UP_TO=0x050F00) + ## Add subdirectories: add_subdirectory(src/waylandscanner) diff --git a/README.md b/README.md index 71aa7ee..a9ed970 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,13 @@ Converts Wayland protocol definition to C++ code. ## 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) 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 + * [cmake](https://gitlab.kitware.com/cmake/cmake) >= 3.19.0 ## Installation diff --git a/src/waylandscanner/CMakeLists.txt b/src/waylandscanner/CMakeLists.txt index bb2ecc3..dd8f551 100644 --- a/src/waylandscanner/CMakeLists.txt +++ b/src/waylandscanner/CMakeLists.txt @@ -2,19 +2,23 @@ # # SPDX-License-Identifier: BSD-3-Clause -liri_add_executable(waylandscanner - SOURCES - waylandscanner.cpp - OUTPUT_NAME - aurora-wayland-scanner - DEFINES - QT_NO_CAST_FROM_ASCII - QT_NO_FOREACH - LIBRARIES - Qt::Core - Qt::Xml +qt_add_executable(waylandscanner + MANUAL_FINALIZATION + waylandscanner.cpp ) -liri_finalize_executable(waylandscanner) +set_target_properties(waylandscanner PROPERTIES OUTPUT_NAME aurora-wayland-scanner) + +qt_finalize_target(waylandscanner) + +target_link_libraries(waylandscanner PUBLIC + Qt6::Core + Qt6::Xml +) add_executable(Liri::waylandscanner ALIAS waylandscanner) + +install( + TARGETS waylandscanner + DESTINATION ${KDE_INSTALL_BINDIR} +)