Skip to content

Commit

Permalink
Merge pull request #20748 from mmuetzel/qt
Browse files Browse the repository at this point in the history
qt6-base: fix inclusion of OpenGL header after Qt6 header
  • Loading branch information
mmuetzel authored Apr 26, 2024
2 parents f4c1133 + af1a2c9 commit a7bc4f9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
45 changes: 45 additions & 0 deletions mingw-w64-qt6-base/005-qt-6.7.0-opengl-header.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Avoid issue for projects that include <GL/glu.h> after <QOpenGLContext>
on Windows.

diff -urN qtbase-everywhere-src-6.7.0/src/gui/opengl/qopengl.h.orig qtbase-everywhere-src-6.7.0/src/gui/opengl/qopengl.h
+++ qtbase-everywhere-src-6.7.0/src/gui/opengl/qopengl.h 2024-04-22 19:00:32.146776300 +0200
@@ -11,15 +11,21 @@
// On Windows we need to ensure that APIENTRY and WINGDIAPI are defined before
// we can include gl.h. But we do not want to include <windows.h> in this public
// Qt header, as it pollutes the global namespace with macros.
+// We also need to make sure that CALLBACK and GLAPI are defined (and all of
+// these keep being defined) in case <GL/glu.h> is included after this header.
#if defined(Q_OS_WIN)
# ifndef APIENTRY
# define APIENTRY __stdcall
-# define Q_UNDEF_APIENTRY
# endif // APIENTRY
# ifndef WINGDIAPI
# define WINGDIAPI __declspec(dllimport)
-# define Q_UNDEF_WINGDIAPI
# endif // WINGDIAPI
+# ifndef CALLBACK
+# define CALLBACK APIENTRY
+# endif // CALLBACK
+# ifndef GLAPI
+# define GLAPI extern
+# endif // GLAPI
# define QT_APIENTRY __stdcall
#endif

@@ -281,15 +287,6 @@

QT_END_NAMESPACE

-#ifdef Q_UNDEF_WINGDIAPI
-# undef WINGDIAPI
-# undef Q_UNDEF_WINGDIAPI
-#endif
-#ifdef Q_UNDEF_APIENTRY
-# undef APIENTRY
-# undef Q_UNDEF_APIENTRY
-#endif
-
#endif // QT_NO_OPENGL

#endif // QOPENGL_H
5 changes: 4 additions & 1 deletion mingw-w64-qt6-base/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-${_realname}-debug")
_qtver=6.7.0
pkgver=${_qtver/-/}
pkgrel=1
pkgrel=2
pkgdesc="A cross-platform application and UI framework (mingw-w64)"
arch=(any)
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
Expand Down Expand Up @@ -49,6 +49,7 @@ source=("https://download.qt.io/official_releases/qt/${pkgver%.*}/${_qtver}/subm
002-fix-qtdocs-helpers-cmake.patch
003-adjust-qmake-conf-mingw.patch
004-qt-6.2.0-win32-g-Add-QMAKE_EXTENSION_IMPORTLIB-defaulting-to-.patch
005-qt-6.7.0-opengl-header.patch
006-qt-6.2.0-dont-add-resource-files-to-qmake-libs.patch
007-Fix-crashes-in-rasterization-code-using-setjmp.patch
009-qfileinfo-undefine-mingw-stat.patch
Expand All @@ -60,6 +61,7 @@ sha256sums=('11b2e29e2e52fb0e3b453ea13bbe51a10fdff36e1c192d8868c5a40233b8b254'
'3848318bccdfa21a139ccdb70f8226358c4a7ed3943231494aab3df83025d7c7'
'68156b8b7717a0ce19c4b991942469171bfa048cd5c90765115a546e65669a1d'
'ed5b61bcb367bbda459bec903d796ea45604278f577a988d602ade07ec6bf363'
'a2afc74d181864409dc96eca368b647c0f79e25751db88e3263f2d1101edf8e4'
'4085a10b290b8e3d930de535cbad2ba3e643432cba433aa2b28fe664f86d38a3'
'3a256533401a48aff7e3c4b02118d62a0cccc2b3566c6e550e7b467aca3e496f'
'f4261d43a142a24e5fa3b23e25813754839db84078cc8c6dc611139bf531e64a'
Expand Down Expand Up @@ -91,6 +93,7 @@ prepare() {
002-fix-qtdocs-helpers-cmake.patch \
003-adjust-qmake-conf-mingw.patch \
004-qt-6.2.0-win32-g-Add-QMAKE_EXTENSION_IMPORTLIB-defaulting-to-.patch \
005-qt-6.7.0-opengl-header.patch \
006-qt-6.2.0-dont-add-resource-files-to-qmake-libs.patch \
007-Fix-crashes-in-rasterization-code-using-setjmp.patch \
009-qfileinfo-undefine-mingw-stat.patch \
Expand Down

0 comments on commit a7bc4f9

Please sign in to comment.