diff options
author | Ingo Klöcker <[email protected]> | 2024-07-17 12:06:52 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2024-07-18 12:41:52 +0000 |
commit | e6830b58b6de6d4fa02f1055cd0e992c9310b51a (patch) | |
tree | 84dbabaae40290917547381a08e4b28f9128362b /m4 | |
parent | build,qt: Remove include directories on uninstall (diff) | |
download | gpgme-e6830b58b6de6d4fa02f1055cd0e992c9310b51a.tar.gz gpgme-e6830b58b6de6d4fa02f1055cd0e992c9310b51a.zip |
build,qt: Decouple generation of moc files
* m4/qt5.m4: Export moc for Qt 5 in variable MOC5. Unset temporary MOC2.
* m4/qt6.m4: Export moc for Qt 6 in variable MOC6.
* lang/qt/src/Makefile.am: Generate .moc5 files from .h files. Generate
.moc forwarding headers in moc5 subfolder. Add moc5 subfolder to include
paths for Qt 5-based qgpgme library. Ditto for Qt 6. Clean up moc5 and
moc6 subfolders.
* lang/qt/tests/Makefile.am: List tests and test runners for Qt 5 and
Qt 6. Generate .moc5 files from .cpp files of tests. Generate .moc
forwarding headers in moc5 subfolder. Generate .hmoc file from
t-support.h directly in moc5 subfolder. Add moc5 subfolder to include
paths for all Qt 5-based tests and runners. Ditto for Qt 6. Specify
sources, LDADD and CPPFLAGS for all tests and test runners for Qt 5 and
Qt 6. Clean up moc5 and moc6 subfolders.
--
The output of Qt 5's moc and Qt 6's moc is incompatible. Therefore, we
need to generate different .moc files for Qt 5 and Qt 6 to support
co-building of the Qt 5 and Qt 6 bindings. The duplication of the
listing of the tests couldn't be avoided because automake doesn't
understand `the_tests5 = $(the_tests:%=%5)` and couldn't match the
tests with their _SOURCES. Maybe some m4 programming would have helped,
but that would have made the Makefiles even more unreadable.
GnuPG-bug-id: 7205
Diffstat (limited to 'm4')
-rw-r--r-- | m4/qt5.m4 | 11 | ||||
-rw-r--r-- | m4/qt6.m4 | 6 |
2 files changed, 9 insertions, 8 deletions
@@ -5,7 +5,7 @@ dnl This file is part of gpgme and is provided under the same license as gpgme dnl Autoconf macro to find Qt5 dnl -dnl sets GPGME_QT5_LIBS and GPGME_QT5_CFLAGS +dnl sets GPGME_QT5_LIBS, GPGME_QT5_CFLAGS, and MOC5 dnl dnl if QT5 was found have_qt5_libs is set to yes @@ -29,9 +29,9 @@ AC_DEFUN([FIND_QT5], fi fi if test "$have_qt5_libs" = "yes"; then - AC_CHECK_TOOL(MOC, moc) + AC_CHECK_TOOL(MOC5, moc) AC_MSG_CHECKING([moc version]) - mocversion=`$MOC -v 2>&1` + mocversion=`$MOC5 -v 2>&1` mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"` if test x"$mocversiongrep" != x"$mocversion"; then AC_MSG_RESULT([no]) @@ -48,11 +48,12 @@ AC_DEFUN([FIND_QT5], # no valid moc found have_qt5_libs="no"; else - MOC=$qt5tooldir/moc + MOC5=$qt5tooldir/moc fi else - MOC=$MOC2 + MOC5=$MOC2 fi + unset MOC2 fi AC_MSG_RESULT([$mocversion]) fi @@ -5,7 +5,7 @@ dnl This file is part of gpgme and is provided under the same license as gpgme dnl Autoconf macro to find Qt6 dnl -dnl sets GPGME_QT6_LIBS and GPGME_QT6_CFLAGS +dnl sets GPGME_QT6_LIBS, GPGME_QT6_CFLAGS, and MOC6 dnl dnl if QT6 was found have_qt6_libs is set to yes @@ -26,8 +26,8 @@ AC_DEFUN([FIND_QT6], if test "$have_qt6_libs" = "yes"; then # Qt6 moved moc to libexec qt6libexecdir=$($PKG_CONFIG --variable=libexecdir 'Qt6Core >= 6.4.0') - AC_PATH_TOOL(MOC, moc, [], [$qt6libexecdir]) - if test -z "$MOC"; then + AC_PATH_TOOL(MOC6, moc, [], [$qt6libexecdir]) + if test -z "$MOC6"; then AC_MSG_WARN([moc not found - Qt 6 binding will not be built.]) have_qt6_libs="no"; fi |