From c47fd4ff2b30c7940fb070eca185823337bfc5ee Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sun, 10 Mar 2024 20:58:38 +0100 Subject: [PATCH] meson: Change default Qt version to 6 Qt 5 is no longer supported upstream and KDE has migrated as well. Note that our Autotools build does not support Qt 6. See also: https://doc.qt.io/qt-6/supported-platforms.html#supported-qt-versions --- .../actions/install-dependencies/action.yml | 2 +- .../install-dependencies.sh | 15 ++++++---- .github/actions/run-action/run-action.sh | 28 +++++++++++++------ meson.build | 14 +++++----- meson_options.txt | 4 +-- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index e027d0dfa..f2bc55d69 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -28,4 +28,4 @@ runs: mingw-w64-x86_64-gtk2 mingw-w64-x86_64-meson mingw-w64-x86_64-pkg-config - mingw-w64-x86_64-qt5-base + mingw-w64-x86_64-qt6-base diff --git a/.github/actions/install-dependencies/install-dependencies.sh b/.github/actions/install-dependencies/install-dependencies.sh index 1c1e7fee6..cfb506b7f 100755 --- a/.github/actions/install-dependencies/install-dependencies.sh +++ b/.github/actions/install-dependencies/install-dependencies.sh @@ -2,11 +2,14 @@ # --- Dependency configuration --- # -# ubuntu-20.04: Qt 5 + GTK2 -# ubuntu-22.04: Qt 5 + GTK3 -# Windows: Qt 5 + GTK2 -# macOS (Autotools): Qt 5 - GTK -# macOS (Meson): Qt 6 - GTK +# ubuntu-20.04 (Autotools): Qt 5 + GTK2 +# ubuntu-20.04 (Meson): Qt 5 + GTK2 +# ubuntu-22.04 (Autotools): Qt 5 + GTK3 +# ubuntu-22.04 (Meson): Qt 6 + GTK3 +# Windows (Autotools): Qt 5 + GTK2 +# Windows (Meson): Qt 6 + GTK2 +# macOS (Autotools): Qt 5 - GTK +# macOS (Meson): Qt 6 - GTK os=$(tr '[:upper:]' '[:lower:]' <<< "$1") build_system=$(tr '[:upper:]' '[:lower:]' <<< "$2") @@ -27,7 +30,7 @@ case "$os" in ubuntu*) if [ "$build_system" = 'meson' ]; then - sudo apt-get -qq update && sudo apt-get install libgtk-3-dev qtbase5-dev gettext meson + sudo apt-get -qq update && sudo apt-get install libgtk-3-dev qt6-base-dev gettext meson else sudo apt-get -qq update && sudo apt-get install libgtk-3-dev qtbase5-dev gettext fi diff --git a/.github/actions/run-action/run-action.sh b/.github/actions/run-action/run-action.sh index d46dd5253..2e28bfc9e 100755 --- a/.github/actions/run-action/run-action.sh +++ b/.github/actions/run-action/run-action.sh @@ -2,11 +2,14 @@ # --- Build configuration --- # -# ubuntu-20.04: Qt 5 + GTK2 -# ubuntu-22.04: Qt 5 + GTK3 -# Windows: Qt 5 + GTK2 -# macOS (Autotools): Qt 5 - GTK -# macOS (Meson): Qt 6 - GTK +# ubuntu-20.04 (Autotools): Qt 5 + GTK2 +# ubuntu-20.04 (Meson): Qt 5 + GTK2 +# ubuntu-22.04 (Autotools): Qt 5 + GTK3 +# ubuntu-22.04 (Meson): Qt 6 + GTK3 +# Windows (Autotools): Qt 5 + GTK2 +# Windows (Meson): Qt 6 + GTK2 +# macOS (Autotools): Qt 5 - GTK +# macOS (Meson): Qt 6 - GTK action=$(tr '[:upper:]' '[:lower:]' <<< "$1") os=$(tr '[:upper:]' '[:lower:]' <<< "$2") @@ -28,9 +31,9 @@ fi case "$action" in configure) case "$os" in - ubuntu-20.04 | windows*) + ubuntu-20.04) if [ "$build_system" = 'meson' ]; then - meson setup build + meson setup build -D qt5=true else ./autogen.sh && ./configure fi @@ -38,6 +41,7 @@ case "$action" in ubuntu*) if [ "$build_system" = 'meson' ]; then + export CMAKE_PREFIX_PATH="/usr/lib/x86_64-linux-gnu/cmake/Qt6" meson setup build -D gtk3=true else ./autogen.sh && ./configure --enable-gtk3 @@ -46,7 +50,7 @@ case "$action" in macos*) if [ "$build_system" = 'meson' ]; then - meson setup build -D qt6=true -D gtk=false + meson setup build -D gtk=false else export PATH="/usr/local/opt/qt@5/bin:$PATH" export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig:$PKG_CONFIG_PATH" @@ -54,6 +58,14 @@ case "$action" in fi ;; + windows*) + if [ "$build_system" = 'meson' ]; then + meson setup build + else + ./autogen.sh && ./configure + fi + ;; + *) echo "Unsupported OS: $os" exit 1 diff --git a/meson.build b/meson.build index e4af229ce..84cd9d9a2 100644 --- a/meson.build +++ b/meson.build @@ -21,7 +21,11 @@ thread_dep = dependency('threads', required: true) if get_option('qt') - if get_option('qt6') + if get_option('qt5') + qt = import('qt5') + qt_req = '>= 5.2' + qt_dep = dependency('qt5', version: qt_req, required: true, modules: ['Core', 'Widgets', 'Gui']) + else if meson.version().version_compare('>= 0.57') qt = import('qt6') else @@ -30,10 +34,6 @@ if get_option('qt') qt_req = '>= 6.0' qt_dep = dependency('qt6', version: qt_req, required: true, modules: ['Core', 'Widgets', 'Gui']) - else - qt = import('qt5') - qt_req = '>= 5.2' - qt_dep = dependency('qt5', version: qt_req, required: true, modules: ['Core', 'Widgets', 'Gui']) endif endif @@ -231,8 +231,8 @@ if meson.version().version_compare('>= 0.53') summary({ 'D-Bus support': get_option('dbus'), - 'Qt 5 support': get_option('qt') and not get_option('qt6'), - 'Qt 6 support': get_option('qt6'), + 'Qt 5 support': get_option('qt5'), + 'Qt 6 support': get_option('qt') and not get_option('qt5'), 'GTK2 support': get_option('gtk') and not get_option('gtk3'), 'GTK3 support': get_option('gtk3'), 'Libarchive support': get_option('libarchive'), diff --git a/meson_options.txt b/meson_options.txt index 2777afda8..55009bb8a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,8 +2,8 @@ option('dbus', type: 'boolean', value: true, description: 'Whether DBus support is enabled') option('qt', type: 'boolean', value: true, description: 'Whether Qt support is enabled') -option('qt6', type: 'boolean', value: false, - description: 'Whether Qt 6 support is enabled') +option('qt5', type: 'boolean', value: false, + description: 'Whether Qt 5 support is enabled') option('gtk', type: 'boolean', value: true, description: 'Whether GTK support is enabled') option('gtk3', type: 'boolean', value: false,