From 0ddb6383aa5c6a4ac98dd34bca239a7cfe71dfed Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 1 Mar 2023 20:44:02 +0200 Subject: [PATCH 26/26] Add support for qt6x value for qtver configure option To make a build that does not use anything deprecated in a recent Qt6 version (initially 6.3) See osdn #44911 Signed-off-by: Marko Lindqvist --- configure.ac | 3 +++ doc/INSTALL.meson | 4 ++-- doc/README.packaging | 2 ++ m4/qt.m4 | 7 ++++++- m4/qt6.m4 | 18 +++++++++--------- meson.build | 17 +++++++++++------ meson_options.txt | 4 ++-- 7 files changed, 35 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 1f05fe0241..ab8c74a5c3 100644 --- a/configure.ac +++ b/configure.ac @@ -752,11 +752,14 @@ AC_ARG_WITH([qtver], [case "${withval}" in qt5|Qt5) qt_ver="Qt5" ;; qt6|Qt6) qt_ver="Qt6" ;; + qt6x|Qt6x) qt_ver="Qt6x" ;; *) AC_MSG_ERROR([bad value ${enableval} for --with-qtver]) ;; esac], [qt_ver="$qt_default"]) if test "x$qt_ver" = "xQt5" ; then AC_DEFINE([FC_QT5_MODE], [1], [this is Qt5 based build]) +elif test "x$qt_ver" = "xQt6x" ; then + AC_DEFINE([FC_QT6X_MODE], [1], [this is build based on current Qt6 version]) fi FC_WORKING_CXX diff --git a/doc/INSTALL.meson b/doc/INSTALL.meson index c163717598..12bff32fd6 100644 --- a/doc/INSTALL.meson +++ b/doc/INSTALL.meson @@ -155,8 +155,8 @@ freeciv-web (boolean): gen-packets-args (array): Aditional packet generator arguments passed to common/generate_packets.py. -qtver ('qt5'/'qt6'): - Whether to build Qt5 or Qt6 versions of the binaries. +qtver ('qt5'/'qt6'/'qt6x'): + Whether to build Qt5, Qt6, or experimental Qt6 versions of the binaries. project-definition (string): Filename of the project definition to use. See below for contents of diff --git a/doc/README.packaging b/doc/README.packaging index fc61e8b9d2..e67ec82d1f 100644 --- a/doc/README.packaging +++ b/doc/README.packaging @@ -20,6 +20,8 @@ Updating from 3.2 to 3.3 * Minimum version of Qt is Qt-5.15, when building in Qt5-mode * Configuring source directory is no longer allowed in autotools builds. You have to use separate build dir(s) +* New 'qt6x' mode for building Qt based components linked against + relatively new Qt6 versions ---------------------------------------------------------------------- Compatibility of modified versions diff --git a/m4/qt.m4 b/m4/qt.m4 index 384767d02f..f4a304b99a 100644 --- a/m4/qt.m4 +++ b/m4/qt.m4 @@ -3,7 +3,12 @@ AC_DEFUN([FC_QT], [ case "x$1" in - xqt6|xQt6|x) FC_QT6 + xqt6|xQt6|x) FC_QT6([0x060000], [6.0]) + FC_QT_CPPFLAGS="$FC_QT6_CPPFLAGS" + FC_QT_CXXFLAGS="$FC_QT6_CXXFLAGS" + FC_QT_LIBS="$FC_QT6_LIBS" + fc_qt_usable="$fc_qt6_usable" ;; + xqt6x|xQt6x) FC_QT6([0x060300], [6.3]) FC_QT_CPPFLAGS="$FC_QT6_CPPFLAGS" FC_QT_CXXFLAGS="$FC_QT6_CXXFLAGS" FC_QT_LIBS="$FC_QT6_LIBS" diff --git a/m4/qt6.m4 b/m4/qt6.m4 index 76c924c72f..72ac79d361 100644 --- a/m4/qt6.m4 +++ b/m4/qt6.m4 @@ -3,10 +3,10 @@ AC_DEFUN([FC_QT6], [ if test "x$fc_qt6_usable" = "x" ; then - FC_QT6_CPPFLAGS="-DQT_DISABLE_DEPRECATED_BEFORE=0x060000" + FC_QT6_CPPFLAGS="-DQT_DISABLE_DEPRECATED_BEFORE=$1" case $host_os in darwin*) FC_QT6_DARWIN;; - *) FC_QT6_GENERIC;; + *) FC_QT6_GENERIC([$1], [$2]);; esac fi ]) @@ -22,7 +22,7 @@ AC_DEFUN([FC_QT6_GENERIC], [FC_QT6_COMPILETEST([$withval])], [POTENTIAL_PATHS="/usr/include /usr/include/qt6 /usr/include/qt" - # search multiarch paths too (if the multiarch tuple can be found) + # Search multiarch paths too (if the multiarch tuple can be found) FC_MULTIARCH_TUPLE() AS_IF(test "x$MULTIARCH_TUPLE" != "x", POTENTIAL_PATHS="$POTENTIAL_PATHS /usr/include/$MULTIARCH_TUPLE/qt6") @@ -45,7 +45,7 @@ AC_DEFUN([FC_QT6_GENERIC], [FC_QT6_LINKTEST([$withval])], [POTENTIAL_PATHS="/usr/lib/qt6 /usr/lib/qt" - # search multiarch paths too (if the multiarch tuple can be found) + # Search multiarch paths too (if the multiarch tuple can be found) FC_MULTIARCH_TUPLE() AS_IF(test "x$MULTIARCH_TUPLE" != "x", POTENTIAL_PATHS="$POTENTIAL_PATHS /usr/lib/$MULTIARCH_TUPLE/qt6") @@ -62,8 +62,8 @@ AC_DEFUN([FC_QT6_GENERIC], if test "x$qt6_libs" = "xyes" ; then AC_MSG_RESULT([found]) - AC_MSG_CHECKING([for Qt6 >= 6.0]) - FC_QT6_VERSION_CHECK + AC_MSG_CHECKING([for Qt6 >= $2]) + FC_QT6_VERSION_CHECK([$1]) fi AC_LANG_POP([C++]) @@ -103,7 +103,8 @@ AC_DEFUN([FC_QT6_COMPILETEST], CPPFLAGS="$CPPFLAGS_SAVE" ]) -dnl Check if the included version of Qt is at least Qt-6.0 +dnl Check if the included version of Qt is at least requested version +dnl $1: Version number if the Qt macro form dnl Output: fc_qt6_min_ver=yes|no AC_DEFUN([FC_QT6_VERSION_CHECK], [ @@ -115,7 +116,7 @@ AC_DEFUN([FC_QT6_VERSION_CHECK], LIBS="${LIBS}${LIBSADD}" AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include ]],[[ - #if QT_VERSION < 0x060000 + #if QT_VERSION < $1 fail #endif ]])], @@ -126,7 +127,6 @@ AC_DEFUN([FC_QT6_VERSION_CHECK], CXXFLAGS="${CXXFLAGS_SAVE}" ]) - dnl Test Qt application linking with current flags AC_DEFUN([FC_QT6_LINKTEST], [ diff --git a/meson.build b/meson.build index 8b6125791d..6f7af4bed8 100644 --- a/meson.build +++ b/meson.build @@ -157,6 +157,8 @@ else crosser = false endif +qtver = get_option('qtver') + # From this, at least the _WIN32_WINNT must be set before # trying to find the functions. if host_system == 'windows' @@ -186,7 +188,7 @@ if host_system == 'windows' endif endif if min_win_ver == '' - if get_option('qtver') == 'qt6' + if qtver == 'qt6' or qtver == 'qt6x' add_global_arguments('-D_WIN32_WINNT=0x0A00', language : ['c', 'cpp']) else add_global_arguments('-D_WIN32_WINNT=0x0603', language : ['c', 'cpp']) @@ -596,10 +598,13 @@ if get_option('audio') or get_option('clients').contains('sdl2') endif endif -if get_option('qtver') == 'qt5' +if qtver == 'qt5' add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00', language : 'cpp') priv_conf_data.set('FC_QT5_MODE', 1) qt_opts = [] +elif qtver == 'qt6x' + add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=0x060300', language : 'cpp') + qt_opts = 'cpp_std=c++17' else add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=0x060000', language : 'cpp') qt_opts = 'cpp_std=c++17' @@ -2924,7 +2929,7 @@ custom_target('mi_gtk4', endif -if get_option('qtver') == 'qt6' +if qtver == 'qt6' or qtver == 'qt6x' qt_mod = import('qt6') qt_dep = dependency('Qt6', modules: ['Core', 'Gui', 'Widgets'], required: false) @@ -2937,7 +2942,7 @@ endif if get_option('clients').contains('qt') if not qt_dep.found() - if get_option('qtver') == 'qt6' + if qtver == 'qt6' or qtver == 'qt6x' error('Qt6 >= 6.0 required for qt-client in Qt6 mode, but not found') else error('Qt5 >= 5.15 required for qt-client in Qt5 mode, but not found') @@ -3450,7 +3455,7 @@ endif if get_option('fcmp').contains('qt') if not qt_dep.found() - if get_option('qtver') == 'qt6' + if qtver == 'qt6' or qtver == 'qt6x' error('Qt6 >= 6.0 required for qt-modpack-installer in Qt6 mode, but not found') else error('Qt5 >= 5.15 required for qt-modpack-installer in Qt5 mode, but not found') @@ -3522,7 +3527,7 @@ executable('freeciv-ruleup', if get_option('ruledit') if not qt_dep.found() - if get_option('qtver') == 'qt6' + if qtver == 'qt6' or qtver == 'qt6x' error('Qt6 >= 6.0 required for ruledit in Qt6 mode, but not found') else error('Qt5 >= 5.15 required for ruledit in Qt5 mode, but not found') diff --git a/meson_options.txt b/meson_options.txt index db171b8f38..818fd8c8ca 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -72,9 +72,9 @@ option('gen-packets-args', option('qtver', type: 'combo', - choices: ['qt5', 'qt6'], + choices: ['qt5', 'qt6', 'qt6x'], value: 'qt6', - description: 'Whether to build Qt5 or Qt6 versions of the binaries') + description: 'Whether to build Qt5, Qt6, or experimental Qt6 versions of the binaries') option('project-definition', type: 'string', -- 2.39.2