summaryrefslogtreecommitdiff
path: root/cogl/cogl-xlib.h
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-11-28 12:34:45 +0000
committerRobert Bragg <robert@linux.intel.com>2013-11-28 16:59:55 +0000
commit31a9726506668184e0a3b0044cf74a08fe219c0e (patch)
treebcd44d720ae4929433b83ef09bceccd2b5aa2620 /cogl/cogl-xlib.h
parent0bf128198d18a62c981e68d87c1d42f951efa7c1 (diff)
downloadcogl-31a9726506668184e0a3b0044cf74a08fe219c0e.tar.gz
build: fix building introspection data
This fixes the build with --enable-introspection. I'm not sure why g-ir-scanner seems to parse all public headers in isolation instead of being able take a more limited list of top-level public headers and automatically parse all necessary #include directives but this means we have to special case how we define and undefine __COGL_H_INSIDE__ to subvert the guards we have in place for detecting misuse of the headers. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit e0b2255876c1cf11d124d5ae37cbe9a6e43777f1)
Diffstat (limited to 'cogl/cogl-xlib.h')
-rw-r--r--cogl/cogl-xlib.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/cogl/cogl-xlib.h b/cogl/cogl-xlib.h
index 53f4b5f5..d94a0e08 100644
--- a/cogl/cogl-xlib.h
+++ b/cogl/cogl-xlib.h
@@ -33,10 +33,22 @@
* definitions
*/
#ifndef COGL_COMPILATION
+
+/* Note: When building Cogl .gir we explicitly define
+ * __COGL_XLIB_H_INSIDE__ */
+#ifndef __COGL_XLIB_H_INSIDE__
#define __COGL_XLIB_H_INSIDE__
+#endif
+
+/* Note: When building Cogl .gir we explicitly define
+ * __COGL_H_INSIDE__ */
+#ifndef __COGL_H_INSIDE__
#define __COGL_H_INSIDE__
+#define __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__
#endif
+#endif /* COGL_COMPILATION */
+
#include <cogl/cogl-types.h>
#include <cogl/deprecated/cogl-clutter-xlib.h>
#include <cogl/cogl-xlib-renderer.h>
@@ -97,6 +109,19 @@ cogl_xlib_handle_event (XEvent *xevent);
COGL_END_DECLS
+
+/* The gobject introspection scanner seems to parse public headers in
+ * isolation which means we need to be extra careful about how we
+ * define and undefine __COGL_H_INSIDE__ used to detect when internal
+ * headers are incorrectly included by developers. In the gobject
+ * introspection case we have to manually define __COGL_H_INSIDE__ as
+ * a commandline argument for the scanner which means we must be
+ * careful not to undefine it in a header...
+ */
+#ifdef __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__
+#undef __COGL_H_INSIDE__
#undef __COGL_XLIB_H_INSIDE__
+#undef __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__
+#endif
#endif /* __COGL_XLIB_H__ */