From 90dbfcd78f4d08e37652f832fe69bbeb8e791d4f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 30 Oct 2008 17:04:34 +0000 Subject: [PATCH] 2008-10-30 Emmanuele Bassi Bug 1212 - Allow only a single include file for Clutter * clutter/*.h: Only allow including clutter.h in third party code. * clutter/cogl/cogl-color.h: * clutter/cogl/cogl-fixed.h: * clutter/cogl/cogl.h.in: Only allow including cogl.h in third party code. * clutter/cogl/common/Makefile.am: * clutter/cogl/gl/Makefile.am: * clutter/cogl/gles/Makefile.am: * clutter/eglnative/Makefile.am: * clutter/eglx/Makefile.am: * clutter/fruity/Makefile.am: * clutter/glx/Makefile.am: * clutter/glx/clutter-glx.h: * clutter/osx/Makefile.am: * clutter/pango/Makefile.am: * clutter/sdl/Makefile.am: * clutter/win32/Makefile.am: * clutter/x11/Makefile.am: Fix build environment. * clutter/x11/clutter-x11-texture-pixmap.h: * clutter/x11/clutter-x11.h: Fix inclusion rules. * tests/test-pixmap.c: Fix inclusion of GdkPixbuf header. * README: Update release notes. --- cogl-color.h | 4 ++++ cogl-fixed.h | 4 ++++ cogl.h.in | 4 ++++ common/Makefile.am | 1 + gl/Makefile.am | 1 + gles/Makefile.am | 1 + 6 files changed, 15 insertions(+) diff --git a/cogl-color.h b/cogl-color.h index 14c5d8413..56f75a86b 100644 --- a/cogl-color.h +++ b/cogl-color.h @@ -1,3 +1,7 @@ +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + #ifndef __COGL_COLOR_H__ #define __COGL_COLOR_H__ diff --git a/cogl-fixed.h b/cogl-fixed.h index b1542bcc3..1e2709572 100644 --- a/cogl-fixed.h +++ b/cogl-fixed.h @@ -1,3 +1,7 @@ +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + #ifndef __COGL_FIXED_H__ #define __COGL_FIXED_H__ diff --git a/cogl.h.in b/cogl.h.in index 3f23621f9..5b57a7e8f 100644 --- a/cogl.h.in +++ b/cogl.h.in @@ -42,6 +42,8 @@ #ifndef __COGL_H__ #define __COGL_H__ +#define __COGL_H_INSIDE__ + #include #include @@ -1587,4 +1589,6 @@ void cogl_draw_buffer (CoglBufferTarget target, G_END_DECLS +#undef __COGL_H_INSIDE__ + #endif /* __COGL_H__ */ diff --git a/common/Makefile.am b/common/Makefile.am index 5a52418be..7e3d7dfc0 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -5,6 +5,7 @@ INCLUDES = \ -I$(top_srcdir)/clutter/cogl/$(CLUTTER_COGL) \ -I$(top_builddir)/clutter \ -I$(top_builddir)/clutter/cogl \ + -DCLUTTER_COMPILATION \ $(CLUTTER_CFLAGS) \ $(CLUTTER_DEBUG_CFLAGS) \ $(GCC_FLAGS) diff --git a/gl/Makefile.am b/gl/Makefile.am index 2b2273078..d2a1b4a16 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -13,6 +13,7 @@ INCLUDES = \ -I$(top_srcdir)/clutter/cogl/$(CLUTTER_COGL) \ -I$(top_builddir)/clutter \ -I$(top_builddir)/clutter/cogl \ + -DCLUTTER_COMPILATION \ $(CLUTTER_CFLAGS) \ $(CLUTTER_DEBUG_CFLAGS) \ $(GCC_FLAGS) diff --git a/gles/Makefile.am b/gles/Makefile.am index 1ac969ec3..29e25ddd2 100644 --- a/gles/Makefile.am +++ b/gles/Makefile.am @@ -13,6 +13,7 @@ INCLUDES = \ -I$(top_srcdir)/clutter/cogl/$(CLUTTER_COGL) \ -I$(top_builddir)/clutter \ -I$(top_builddir)/clutter/cogl \ + -DCLUTTER_COMPILATION \ $(CLUTTER_CFLAGS) \ $(CLUTTER_DEBUG_CFLAGS) \ $(GCC_FLAGS)