changeset 32004:c5b57a82a17c

build: Initial changes to enable building with Qt6. * configure.ac: Check for Qt5 (preferred) and Qt6. * m4/acinclude.ac (OCTAVE_CHECK_QSCINTILLA): Add potential library names for QScintilla that is built for Qt6. (OCTAVE_CHECK_QT): Adapt comment. Add HAVE_QT6 preprocessor macro when building with Qt6. (OCTAVE_CHECK_QT_VERSION): Add list of used Qt6 modules.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 13 Apr 2023 09:11:48 +0200
parents 81de46cd091b
children 8f9de7cb4e02
files configure.ac m4/acinclude.m4
diffstat 2 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Thu Apr 13 09:04:29 2023 +0200
+++ b/configure.ac	Thu Apr 13 09:11:48 2023 +0200
@@ -1858,7 +1858,7 @@
 
 ### GUI/Qt related tests.
 
-QT_VERSIONS="5"
+QT_VERSIONS="5 6"
 
 AC_ARG_WITH([qt],
   [AS_HELP_STRING([--with-qt=VER], [use the Qt major version VER])
--- a/m4/acinclude.m4	Thu Apr 13 09:04:29 2023 +0200
+++ b/m4/acinclude.m4	Thu Apr 13 09:11:48 2023 +0200
@@ -1542,6 +1542,9 @@
     5)
       octave_qscintilla_libnames="qscintilla2-qt5 qscintilla2_qt5 qt5scintilla2"
     ;;
+    6)
+      octave_qscintilla_libnames="qscintilla2-qt6 qscintilla2_qt6 qt6scintilla2"
+    ;;
     *)
       AC_MSG_ERROR([Unrecognized Qt version $qt_version])
     ;;
@@ -1650,18 +1653,12 @@
       have_qt_version=$ver
       break
     elif test -n "$QT_MODULES_AVAILABLE"; then
-      ## We currently only support Qt5, but previously, when it was
-      ## possible to build Octave with either qt4 or Qt5 and we detected
-      ## only some modules available for a particular version $ver, then
-      ## we warned about a possible incomplete or broken Qt installation
-      ## instead of checking for next version in the list.  We did not
-      ## attempt a similar check for tools here because version-specific
-      ## Qt tools may be installed with the same name so determining
-      ## whether there is a mix of versions requires more work than just
-      ## looking which tools are installed.
-      ##
-      ## NOTE: Leave this logic in place because it may be needed again
-      ## if/when we begin supporting both Qt5 and Qt6
+      ## If some modules were found for $ver, then warn about possible
+      ## incomplete or broken Qt installation instead of checking for
+      ## next version in the list.  Don't attempt a similar check for
+      ## tools here because Qt5 and Qt6 tools may be installed with
+      ## the same name so determining whether there is a mix of versions
+      ## will require more work than just looking which tools are installed.
       warn_qt_modules="Your installation of Qt version $ver appears incomplete or broken in some way.  Fix that or use --with-qt=VER to use another version."
       break
     fi
@@ -1672,6 +1669,9 @@
     if test x"$have_qt_version" = x5; then
       AC_DEFINE(HAVE_QT5, 1, [Define to 1 if using Qt version 5.])
     fi
+    if test x"$have_qt_version" = x6; then
+      AC_DEFINE(HAVE_QT6, 1, [Define to 1 if using Qt version 6.])
+    fi
   else
     if test -n "$QT_MODULES_MISSING" || test -n "$QT_TOOLS_MISSING"; then
       qt_missing=`echo $QT_MODULES_MISSING$QT_TOOLS_MISSING | sed 's/  *$//'`
@@ -1822,6 +1822,12 @@
     5)
       QT_MODULES="Qt5Core Qt5Gui Qt5Help Qt5Network Qt5OpenGL Qt5PrintSupport Qt5Xml"
     ;;
+    6)
+      # FIXME: Remove Qt6Core5Compat when we no longer rely on classes that
+      #        have been removed in Qt6:
+      #        https://www.qt.io/blog/porting-from-qt-5-to-qt-6-using-qt5compat-library
+      QT_MODULES="Qt6Core Qt6Core5Compat Qt6Gui Qt6Help Qt6Network Qt6OpenGL Qt6OpenGLWidgets Qt6PrintSupport Qt6Xml"
+    ;;
     *)
       AC_MSG_ERROR([Unrecognized Qt version $qt_version])
     ;;