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)
This commit is contained in:
Robert Bragg 2013-11-28 12:34:45 +00:00
parent 0bf128198d
commit 31a9726506
8 changed files with 143 additions and 2 deletions

View File

@ -673,7 +673,7 @@ Cogl_1_0_gir_FILES += \
$(top_srcdir)/cogl-path/cogl-path-types.h \ $(top_srcdir)/cogl-path/cogl-path-types.h \
$(top_srcdir)/cogl-path/cogl1-path-functions.h $(top_srcdir)/cogl-path/cogl1-path-functions.h
endif endif
Cogl_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_ENABLE_EXPERIMENTAL_API -UCOGL_ENABLE_EXPERIMENTAL_2_0_API Cogl_1_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_1_0_gir_INCLUDES = GL-1.0 GObject-2.0 Cogl_1_0_gir_INCLUDES = GL-1.0 GObject-2.0
Cogl_1_0_gir_EXPORT_PACKAGES = cogl-1.0 Cogl_1_0_gir_EXPORT_PACKAGES = cogl-1.0
Cogl_1_0_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h' Cogl_1_0_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h'

View File

@ -36,9 +36,16 @@
* api definitions * api definitions
*/ */
#ifndef COGL_COMPILATION #ifndef COGL_COMPILATION
/* Note: When building Cogl .gir we explicitly define
* __COGL_H_INSIDE__ */
#ifndef __COGL_H_INSIDE__
#define __COGL_H_INSIDE__ #define __COGL_H_INSIDE__
#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
#endif #endif
#endif /* COGL_COMPILATION */
#include <cogl/cogl-defines.h> #include <cogl/cogl-defines.h>
#include <cogl/cogl-context.h> #include <cogl/cogl-context.h>
#include <cogl/cogl-framebuffer.h> #include <cogl/cogl-framebuffer.h>
@ -379,5 +386,18 @@ cogl_is_gles2_context (void *object);
COGL_END_DECLS 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__ */ #endif /* __COGL_GLES2_H__ */

View File

@ -31,9 +31,28 @@
* definitions * definitions
*/ */
#ifndef COGL_COMPILATION #ifndef COGL_COMPILATION
/* Note: When building Cogl .gir we explicitly define
* __COGL_H_INSIDE__ */
#ifndef __COGL_H_INSIDE__
#define __COGL_H_INSIDE__ #define __COGL_H_INSIDE__
#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
#endif #endif
#endif /* COGL_COMPILATION */
#include <cogl/cogl-wayland-renderer.h> #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 */ #endif /* __COGL_WAYLAND_CLIENT_H */

View File

@ -33,9 +33,16 @@
* definitions * definitions
*/ */
#ifndef COGL_COMPILATION #ifndef COGL_COMPILATION
/* Note: When building Cogl .gir we explicitly define
* __COGL_H_INSIDE__ */
#ifndef __COGL_H_INSIDE__
#define __COGL_H_INSIDE__ #define __COGL_H_INSIDE__
#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
#endif #endif
#endif /* COGL_COMPILATION */
#include <cogl/cogl-context.h> #include <cogl/cogl-context.h>
#include <cogl/cogl-texture-2d.h> #include <cogl/cogl-texture-2d.h>
@ -98,4 +105,17 @@ cogl_wayland_texture_2d_update_area (CoglTexture2D *texture,
COGL_END_DECLS 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 */ #endif /* __COGL_WAYLAND_SERVER_H */

View File

@ -37,8 +37,16 @@
* definitions * definitions
*/ */
#ifndef COGL_COMPILATION #ifndef COGL_COMPILATION
/* Note: When building Cogl .gir we explicitly define
* __COGL_H_INSIDE__ */
#ifndef __COGL_H_INSIDE__
#define __COGL_H_INSIDE__ #define __COGL_H_INSIDE__
#define __COGL_XLIB_RENDERER_H_MUST_UNDEF_COGL_H_INSIDE__
#endif #endif
#endif /* COGL_COMPILATION */
#include <cogl/cogl-renderer.h> #include <cogl/cogl-renderer.h>
COGL_BEGIN_DECLS COGL_BEGIN_DECLS
@ -158,4 +166,17 @@ cogl_xlib_renderer_get_display (CoglRenderer *renderer);
COGL_END_DECLS 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_RENDERER_H_MUST_UNDEF_COGL_H_INSIDE__
#undef __COGL_H_INSIDE__
#undef __COGL_XLIB_RENDERER_H_MUST_UNDEF_COGL_H_INSIDE__
#endif
#endif /* __COGL_XLIB_RENDERER_H__ */ #endif /* __COGL_XLIB_RENDERER_H__ */

View File

@ -33,10 +33,22 @@
* definitions * definitions
*/ */
#ifndef COGL_COMPILATION #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__ #define __COGL_XLIB_H_INSIDE__
#define __COGL_H_INSIDE__
#endif #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/cogl-types.h>
#include <cogl/deprecated/cogl-clutter-xlib.h> #include <cogl/deprecated/cogl-clutter-xlib.h>
#include <cogl/cogl-xlib-renderer.h> #include <cogl/cogl-xlib-renderer.h>
@ -97,6 +109,19 @@ cogl_xlib_handle_event (XEvent *xevent);
COGL_END_DECLS 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_INSIDE__
#undef __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__
#endif
#endif /* __COGL_XLIB_H__ */ #endif /* __COGL_XLIB_H__ */

View File

@ -29,7 +29,12 @@
#error "<cogl/cogl.h> shouldn't be included internally" #error "<cogl/cogl.h> shouldn't be included internally"
#endif #endif
/* Note: When building Cogl .gir we explicitly define
* __COGL_H_INSIDE__ */
#ifndef __COGL_H_INSIDE__
#define __COGL_H_INSIDE__ #define __COGL_H_INSIDE__
#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
#endif
#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API #ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
#ifndef COGL_ENABLE_EXPERIMENTAL_API #ifndef COGL_ENABLE_EXPERIMENTAL_API
@ -159,6 +164,17 @@
* General utility functions for COGL. * General utility functions for COGL.
*/ */
/* 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_H_INSIDE__
#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__
#endif
#endif /* __COGL_H__ */ #endif /* __COGL_H__ */

View File

@ -31,9 +31,16 @@
* definitions * definitions
*/ */
#ifndef COGL_COMPILATION #ifndef COGL_COMPILATION
/* Note: When building Cogl .gir we explicitly define
* __COGL_H_INSIDE__ */
#ifndef __COGL_H_INSIDE__
#define __COGL_H_INSIDE__ #define __COGL_H_INSIDE__
#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
#endif #endif
#endif /* COGL_COMPILATION */
#include <cogl/cogl-context.h> #include <cogl/cogl-context.h>
COGL_BEGIN_DECLS COGL_BEGIN_DECLS
@ -195,4 +202,17 @@ cogl_is_texture_pixmap_x11 (void *object);
COGL_END_DECLS 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 */ #endif /* __COGL_TEXTURE_PIXMAP_X11_H */