qtgl: Handle OPENGL header guard changes
authorEdward Hervey <edward@centricular.com>
Mon, 17 Dec 2018 08:33:39 +0000 (09:33 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Mon, 17 Dec 2018 09:51:50 +0000 (10:51 +0100)
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

ext/qt/gstqtgl.h

index fd82b27..13761ae 100644 (file)
 #include <QtGui/qtgui-config.h>
 #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)
 #define GLsync gst_qt_GLsync
 #include <QOpenGLContext>