[cogl] build: fix building introspection data



commit e0b2255876c1cf11d124d5ae37cbe9a6e43777f1
Author: Robert Bragg <robert linux intel com>
Date:   Thu Nov 28 12:34:45 2013 +0000

    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>

 cogl/Makefile.am                      |    2 +-
 cogl/cogl-gles2.h                     |   20 ++++++++++++++++++++
 cogl/cogl-wayland-client.h            |   19 +++++++++++++++++++
 cogl/cogl-wayland-server.h            |   20 ++++++++++++++++++++
 cogl/cogl-xlib-renderer.h             |   21 +++++++++++++++++++++
 cogl/cogl-xlib.h                      |   25 +++++++++++++++++++++++++
 cogl/cogl.h                           |   16 ++++++++++++++++
 cogl/winsys/cogl-texture-pixmap-x11.h |   20 ++++++++++++++++++++
 8 files changed, 142 insertions(+), 1 deletions(-)
---
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 6d6280f..90b832c 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -623,7 +623,7 @@ if UNIT_TESTS
 Cogl_2_0_gir_LIBS += $(top_builddir)/test-fixtures/libtest-fixtures.la
 endif
 Cogl_2_0_gir_FILES = $(cogl_public_h) cogl-enum-types.h
-Cogl_2_0_gir_CFLAGS = $(AM_CPPFLAGS) $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_ENABLE_EXPERIMENTAL_API 
-UCOGL_ENABLE_EXPERIMENTAL_2_0_API
+Cogl_2_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_ENABLE_EXPERIMENTAL_API 
-UCOGL_ENABLE_EXPERIMENTAL_2_0_API -UCOGL_COMPILATION -D__COGL_H_INSIDE__ -D__COGL_XLIB_H_INSIDE__
 Cogl_2_0_gir_INCLUDES = GL-1.0 GObject-2.0
 Cogl_2_0_gir_EXPORT_PACKAGES = cogl2
 Cogl_2_0_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h'
diff --git a/cogl/cogl-gles2.h b/cogl/cogl-gles2.h
index 75d37f6..9c551ad 100644
--- a/cogl/cogl-gles2.h
+++ b/cogl/cogl-gles2.h
@@ -36,9 +36,16 @@
  * api definitions
  */
 #ifndef COGL_COMPILATION
+
+/* Note: When building Cogl .gir we explicitly define
+ * __COGL_H_INSIDE__ */
+#ifndef __COGL_H_INSIDE__
 #define __COGL_H_INSIDE__
+#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
 #endif
 
+#endif /* COGL_COMPILATION */
+
 #include <cogl/cogl-defines.h>
 #include <cogl/cogl-context.h>
 #include <cogl/cogl-framebuffer.h>
@@ -379,5 +386,18 @@ cogl_is_gles2_context (void *object);
 
 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_MUST_UNDEF_COGL_H_INSIDE__
+#undef __COGL_H_INSIDE__
+#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__
+#endif
+
 #endif /* __COGL_GLES2_H__ */
 
diff --git a/cogl/cogl-wayland-client.h b/cogl/cogl-wayland-client.h
index a211a1f..095d829 100644
--- a/cogl/cogl-wayland-client.h
+++ b/cogl/cogl-wayland-client.h
@@ -31,9 +31,28 @@
  * definitions
  */
 #ifndef COGL_COMPILATION
+
+/* Note: When building Cogl .gir we explicitly define
+ * __COGL_H_INSIDE__ */
+#ifndef __COGL_H_INSIDE__
 #define __COGL_H_INSIDE__
+#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
 #endif
+#endif /* COGL_COMPILATION */
 
 #include <cogl/cogl-wayland-renderer.h>
 
+/* 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_MUST_UNDEF_COGL_H_INSIDE__
+#undef __COGL_H_INSIDE__
+#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__
+#endif
+
 #endif /* __COGL_WAYLAND_CLIENT_H */
diff --git a/cogl/cogl-wayland-server.h b/cogl/cogl-wayland-server.h
index a28f6a3..26561c3 100644
--- a/cogl/cogl-wayland-server.h
+++ b/cogl/cogl-wayland-server.h
@@ -33,9 +33,16 @@
  * definitions
  */
 #ifndef COGL_COMPILATION
+
+/* Note: When building Cogl .gir we explicitly define
+ * __COGL_H_INSIDE__ */
+#ifndef __COGL_H_INSIDE__
 #define __COGL_H_INSIDE__
+#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
 #endif
 
+#endif /* COGL_COMPILATION */
+
 #include <cogl/cogl-context.h>
 #include <cogl/cogl-texture-2d.h>
 
@@ -134,4 +141,17 @@ cogl_wayland_texture_set_region_from_shm_buffer (CoglTexture *texture,
 
 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_MUST_UNDEF_COGL_H_INSIDE__
+#undef __COGL_H_INSIDE__
+#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__
+#endif
+
 #endif /* __COGL_WAYLAND_SERVER_H */
diff --git a/cogl/cogl-xlib-renderer.h b/cogl/cogl-xlib-renderer.h
index 569beaa..1c0634f 100644
--- a/cogl/cogl-xlib-renderer.h
+++ b/cogl/cogl-xlib-renderer.h
@@ -37,8 +37,16 @@
  * definitions
  */
 #ifndef COGL_COMPILATION
+
+/* Note: When building Cogl .gir we explicitly define
+ * __COGL_H_INSIDE__ */
+#ifndef __COGL_H_INSIDE__
 #define __COGL_H_INSIDE__
+#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
 #endif
+
+#endif /* COGL_COMPILATION */
+
 #include <cogl/cogl-renderer.h>
 
 COGL_BEGIN_DECLS
@@ -158,4 +166,17 @@ cogl_xlib_renderer_get_display (CoglRenderer *renderer);
 
 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_MUST_UNDEF_COGL_H_INSIDE__
+#undef __COGL_H_INSIDE__
+#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__
+#endif
+
 #endif /* __COGL_XLIB_RENDERER_H__ */
diff --git a/cogl/cogl-xlib.h b/cogl/cogl-xlib.h
index 87d7fa4..194bec6 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_MUST_UNDEF_COGL_H_INSIDE__
 #endif
 
+#endif /* COGL_COMPILATION */
+
 #include <cogl/cogl-types.h>
 #include <cogl/cogl-clutter-xlib.h>
 #include <cogl/cogl-xlib-renderer.h>
@@ -64,6 +76,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_MUST_UNDEF_COGL_H_INSIDE__
+#undef __COGL_H_INSIDE__
 #undef __COGL_XLIB_H_INSIDE__
+#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__
+#endif
 
 #endif /* __COGL_XLIB_H__ */
diff --git a/cogl/cogl.h b/cogl/cogl.h
index 539a127..fdb68bf 100644
--- a/cogl/cogl.h
+++ b/cogl/cogl.h
@@ -29,7 +29,12 @@
 #error "<cogl/cogl.h> shouldn't be included internally"
 #endif
 
+/* Note: When building Cogl .gir we explicitly define
+ * __COGL_H_INSIDE__ */
+#ifndef __COGL_H_INSIDE__
 #define __COGL_H_INSIDE__
+#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
+#endif
 
 #include <cogl/cogl-defines.h>
 #include <cogl/cogl-error.h>
@@ -99,6 +104,17 @@
 #include <cogl/cogl-sdl.h>
 #endif
 
+/* 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_MUST_UNDEF_COGL_H_INSIDE__
 #undef __COGL_H_INSIDE__
+#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__
+#endif
 
 #endif /* __COGL_H__ */
diff --git a/cogl/winsys/cogl-texture-pixmap-x11.h b/cogl/winsys/cogl-texture-pixmap-x11.h
index 41129a6..1a75e80 100644
--- a/cogl/winsys/cogl-texture-pixmap-x11.h
+++ b/cogl/winsys/cogl-texture-pixmap-x11.h
@@ -31,9 +31,16 @@
  * definitions
  */
 #ifndef COGL_COMPILATION
+
+/* Note: When building Cogl .gir we explicitly define
+ * __COGL_H_INSIDE__ */
+#ifndef __COGL_H_INSIDE__
 #define __COGL_H_INSIDE__
+#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
 #endif
 
+#endif /* COGL_COMPILATION */
+
 #include <cogl/cogl-context.h>
 
 COGL_BEGIN_DECLS
@@ -191,4 +198,17 @@ cogl_is_texture_pixmap_x11 (void *object);
 
 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_MUST_UNDEF_COGL_H_INSIDE__
+#undef __COGL_H_INSIDE__
+#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__
+#endif
+
 #endif /* __COGL_TEXTURE_PIXMAP_X11_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]