qtgl: Handle OPENGL header guard changes

In 2018 khronos changed the gl header guards. If we don't detect
this properly we would end up with plenty of symbol redifinition
(since we would be importing twice the "same" header).

Instead detect if the "newer" header was already included and if
so define the "old" define to avoid this situation

Fixes #523
This commit is contained in:
Edward Hervey 2018-12-17 09:33:39 +01:00 committed by Edward Hervey
parent 4f7ef56c53
commit 3d708a5bfa

View file

@ -30,6 +30,21 @@
#include <QtGui/qtgui-config.h> #include <QtGui/qtgui-config.h>
#endif #endif
/* The glext.h guard was renamed in 2018, but some software which
* includes their own copy of the GL headers (such as qt) might have
* older version which use the old guard. This would result in the
* header being included again (and symbols redefined).
*
* To avoid this, we define the "old" guard if the "new" guard is
* defined.*/
#if GST_GL_HAVE_OPENGL
#ifdef __gl_glext_h_
#ifndef __glext_h_
#define __glext_h_ 1
#endif
#endif
#endif
#if defined(QT_OPENGL_ES_2) #if defined(QT_OPENGL_ES_2)
#define GLsync gst_qt_GLsync #define GLsync gst_qt_GLsync
#include <QOpenGLContext> #include <QOpenGLContext>