qt: Don't define GLsync inside gstglfuncs.h
authorNirbheek Chauhan <nirbheek@centricular.com>
Fri, 1 Feb 2019 08:57:11 +0000 (14:27 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Fri, 1 Feb 2019 08:58:18 +0000 (14:28 +0530)
This was originally added for fixing conflicting definitions between
Android and Qt, but times have changed and now this breaks the build
on iOS:

 [...]/OpenGLES.framework/Headers/ES3/gl.h:1006:48: error: unknown type name 'gst_qt_GLsync'
 GL_API void           GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)   OPENGLES_DEPRECATED(ios(7.0, 12.0), tvos(9.0, 12.0));
                                               ^
 ../ext/qt/gstqtgl.h:49:16: note: expanded from macro 'GLsync'
 #define GLsync gst_qt_GLsync
                ^
 6 errors generated.

Instead, we simply avoid defining GLsync ourselves if we're using Qt.

ext/qt/gstqtgl.h

index 339f318..6bf8ea6 100644 (file)
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
-
-/* qt uses the same trick as us to typedef GLsync on gles2 but to a different
- * type which confuses the preprocessor.  As it's never actually used by qt
- * public headers, define it to something else to avoid redefinition
- * warnings/errors */
-
-#include <gst/gl/gstglconfig.h>
-#include <gst/gl/gstglfuncs.h>
 #include <QtCore/qglobal.h>
 #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
 #include <QtGui/qtgui-config.h>
 #endif
 
 #if defined(QT_OPENGL_ES_2)
-#define GLsync gst_qt_GLsync
 #include <QtGui/QOpenGLContext>
 #include <QtGui/QOpenGLFunctions>
-#undef GLsync
 #endif /* defined(QT_OPENGL_ES_2) */
+
+/* qt uses the same trick as us to typedef GLsync on GLES2 but to a different
+ * type which confuses the preprocessor. Instead of trying to reconcile the
+ * two, we instead use the GLsync definition from Qt from above, and ensure
+ * that we don't typedef GLsync in gstglfuncs.h */
+#include <gst/gl/gstglconfig.h>
+#undef GST_GL_HAVE_GLSYNC
+#define GST_GL_HAVE_GLSYNC 1
+#include <gst/gl/gstglfuncs.h>