aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2024-07-18 09:43:24 +0000
committerIngo Klöcker <[email protected]>2024-07-18 12:42:30 +0000
commit42e151b34ba1e8c07b1ed2e4e1f6299466e499a1 (patch)
treeadd3288f95c8004ab37f3e0e537f8d4133a31b81
parentbuild,qt: Decouple generation of moc files (diff)
downloadgpgme-42e151b34ba1e8c07b1ed2e4e1f6299466e499a1.tar.gz
gpgme-42e151b34ba1e8c07b1ed2e4e1f6299466e499a1.zip
build,qt: Allow building Qt 5 bindings and Qt 6 bindings
* configure.ac: Remove "qt" from default_languages. Add "qt5 qt6" to default_languages. Remove "qt" from help for --enable-languages. Don't fail anymore if "qt5" and "qt6" are enabled. Warn that "qt" is deprecated if it was enabled. * lang/qt/src/Makefile.am (libqgpgme_la, libqgpgmeqt6_la): New. (lib_LTLIBRARIES): Set Qt 5 and/or Qt 6 variant of libqgpgme. (AM_CPPFLAGS): Replace with libqgpgme_la_CPPFLAGS for Qt 5 and libqgpgmeqt6_la_CPPFLAGS for Qt 6. -- This makes it possible to build QGpgME simultaneously for Qt 5 and Qt 6. By default, QGpgME is now built for all versions of Qt that are found. Specifying "qt" as language is deprecated. GnuPG-bug-id: 7205
-rw-r--r--NEWS2
-rw-r--r--configure.ac106
-rw-r--r--lang/qt/src/Makefile.am9
3 files changed, 70 insertions, 47 deletions
diff --git a/NEWS b/NEWS
index d0a77df1..2c4bb158 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,8 @@ Noteworthy changes in version 1.24.0 (unrelease)
* cpp: Add safer member function returning text describing an error.
[T5960]
+ * qt: Build QGpgME for Qt 5 and Qt 6 simultaneously. [T7205]
+
* qt: Install headers for Qt 5 and Qt 6 in separate folders. [T7161]
* qt: Allow reading the data to decrypt/encrypt/sign/verify directly from
diff --git a/configure.ac b/configure.ac
index c446ce77..84b993aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -257,7 +257,7 @@ have_macos_system=no
build_w32_glib=no
build_w32_qt=no
available_languages="cl cpp python qt qt5 qt6"
-default_languages="cl cpp python qt"
+default_languages="cl cpp python qt5 qt6"
case "${host}" in
x86_64-*mingw32*)
have_w64_system=yes
@@ -375,8 +375,7 @@ AC_ARG_ENABLE([no-direct-extern-access],
AC_ARG_ENABLE([languages],
AS_HELP_STRING([--enable-languages=languages],
[enable only specific language bindings:
- cl cpp python qt qt5 qt6 (qt selects qt5 or qt6,
- and qt5 and qt6 exclude each other)]),
+ cl cpp python qt5 qt6]),
[enabled_languages=`echo $enableval | \
tr ',:' ' ' | tr '[A-Z]' '[a-z]' | \
sed 's/c++/cpp/'`],
@@ -402,76 +401,95 @@ for language in $enabled_languages; do
fi
done
-# Check whether Qt5 and/or Qt6 are enabled explicitly
-want_qt5="no";
+# Check whether qt5 and/or qt6 are enabled
+want_qt5="no"
LIST_MEMBER("qt5", $enabled_languages)
if test "$found" = "1"; then
- want_qt5="yes";
+ if test "$explicit_languages" = "1"; then
+ want_qt5="yes"
+ else
+ want_qt5="maybe"
+ fi
# Remove qt5; further down qt will be added
enabled_languages=$(echo $enabled_languages | sed 's/qt5//')
fi
-want_qt6="no";
+want_qt6="no"
LIST_MEMBER("qt6", $enabled_languages)
if test "$found" = "1"; then
- want_qt6="yes";
+ if test "$explicit_languages" = "1"; then
+ want_qt6="yes"
+ else
+ want_qt6="maybe"
+ fi
# Remove qt6; further down qt will be added
enabled_languages=$(echo $enabled_languages | sed 's/qt6//')
fi
-if test "$want_qt5" = "yes" -a "$want_qt6" = "yes"; then
- AC_MSG_ERROR([[
+
+# Check whether qt is enabled; if yes then it has been enabled explicitly
+want_qt="no"
+LIST_MEMBER("qt", $enabled_languages)
+if test "$found" = "1"; then
+ # Ignore qt if specified together with qt5 or qt6
+ if test "$want_qt5" = "no" -a "$want_qt6" = "no"; then
+ want_qt="yes"
+ fi
+ # Remove qt
+ enabled_languages=$(echo $enabled_languages | sed 's/qt//')
+ AC_MSG_WARN([[
***
-*** The bindings for Qt5 and Qt6 cannot be built simultaneously.
+*** Language binding "qt" is deprecated and will be removed in a future version.
+*** Use "qt5" and/or "qt6" instead.
***]])
fi
# Ensure that pkg-config is available for all calls of FIND_QT5/FIND_QT6
PKG_PROG_PKG_CONFIG
-# If the generic qt is enabled, then check for Qt5 or Qt6 (in this order)
-LIST_MEMBER("qt", $enabled_languages)
-if test "$found" = "1"; then
- # Remove the generic qt (qt5 and qt6 have already been removed)
- enabled_languages=$(echo $enabled_languages | sed 's/qt//')
+# Check for Qt 5 (if qt5 or qt is enabled)
+if test "$want_qt" = "yes"; then
+ want_qt5="maybe"
+fi
+if test "$want_qt5" != "no"; then
FIND_QT5
if test "$have_qt5_libs" = "yes"; then
- want_qt5="yes";
- else
- FIND_QT6
- if test "$have_qt6_libs" = "yes"; then
- want_qt6="yes";
- else
- if test "$explicit_languages" = "1"; then
- AC_MSG_ERROR([[
-***
-*** Qt5 (Qt5Core) or Qt6 (Qt6Core) is required for the Qt binding.
-***]])
- else
- AC_MSG_WARN([[
-***
-*** Qt5 (Qt5Core) and Qt6 (Qt6Core) not found. Qt Binding will be disabled.
-***]])
- fi
- fi
- fi
-elif test "$want_qt5" = "yes"; then
- FIND_QT5
- if test "$have_qt5_libs" != "yes"; then
+ want_qt5="yes"
+ elif test "$want_qt5" = "yes"; then
AC_MSG_ERROR([[
***
*** Qt5 (Qt5Core) is required for the Qt 5 binding.
***]])
+ else
+ want_qt5="no"
fi
-elif test "$want_qt6" = "yes"; then
+fi
+
+# Check for Qt 6 (if qt6 is enabled or if qt is enabled and Qt 5 wasn't found)
+if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes"; then
+ want_qt6="maybe"
+fi
+if test "$want_qt6" != "no"; then
FIND_QT6
- if test "$have_qt6_libs" != "yes"; then
+ if test "$have_qt6_libs" = "yes"; then
+ want_qt6="yes";
+ elif test "$want_qt6" = "yes"; then
AC_MSG_ERROR([[
***
*** Qt6 (Qt6Core) is required for the Qt 6 binding.
***]])
+ else
+ want_qt6="no"
fi
fi
-# Check that cpp is enabled if qt5 or qt6 is enabled
+# Check if any Qt was found (if qt is enabled)
+if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes" -a "$have_qt6_libs" != "yes"; then
+ AC_MSG_ERROR([[
+***
+*** Qt5 (Qt5Core) or Qt6 (Qt6Core) is required for the Qt bindings.
+***]])
+fi
+
+# Check that cpp is enabled if qt5 or qt6 is enabled and was found
if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
LIST_MEMBER("cpp", $enabled_languages)
if test "$found" = "0"; then
@@ -522,7 +540,7 @@ if test "$found" = "1" -a "$HAVE_CXX17" != "1"; then
fi
fi
-# Now append qt to the list of language bindings
+# Now append qt to the list of language bindings (to enable the subdir in lang)
if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
enabled_languages=$(echo $enabled_languages qt)
fi
@@ -1145,7 +1163,9 @@ AC_CONFIG_FILES([lang/python/Makefile
AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py])
AC_OUTPUT
-if test "$want_qt5" = "yes"; then
+if test "$want_qt5" = "yes" -a "$want_qt6" = "yes"; then
+ enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5, Qt 6)/")
+elif test "$want_qt5" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5)/")
elif test "$want_qt6" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 6)/")
diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am
index e98e31e4..eb7ff948 100644
--- a/lang/qt/src/Makefile.am
+++ b/lang/qt/src/Makefile.am
@@ -20,11 +20,12 @@
# 02111-1307, USA
if WANT_QT5
-lib_LTLIBRARIES = libqgpgme.la
+libqgpgme_la = libqgpgme.la
endif
if WANT_QT6
-lib_LTLIBRARIES = libqgpgmeqt6.la
+libqgpgmeqt6_la = libqgpgmeqt6.la
endif
+lib_LTLIBRARIES = $(libqgpgme_la) $(libqgpgmeqt6_la)
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
qgpgme_debug.h qgpgme_version.h.in \
@@ -373,7 +374,7 @@ $(qgpgme_moc6_forward_headers): Makefile.am | $(moc6_dir)
endif
if WANT_QT5
-AM_CPPFLAGS = -I./$(moc5_dir) -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
+libqgpgme_la_CPPFLAGS = -I./moc5 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
@GPGME_QT5_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_QGPGME -Wsuggest-override \
-Wzero-as-null-pointer-constant
@@ -388,7 +389,7 @@ libqgpgme_la_LDFLAGS = -no-undefined -version-info \
@LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
endif
if WANT_QT6
-AM_CPPFLAGS = -I./$(moc6_dir) -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
+libqgpgmeqt6_la_CPPFLAGS = -I./moc6 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
@GPGME_QT6_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_QGPGME -Wsuggest-override \
-Wzero-as-null-pointer-constant