Make cogl-sdl.h a top-level header

This makes it so that cogl-sdl.h is a top-level header no longer
automatically included by cogl.h. This avoids lots of warnings building
the conformance tests and examples due to SDL.h warning when
__STRICT_ANSI__ isn't defined.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit f7536985437dc85c26b33d1bbe1b7f3d4b32476a)
This commit is contained in:
Robert Bragg 2013-11-28 17:36:08 +00:00
parent 7dcdf4dfd6
commit a0bc2d96be
4 changed files with 32 additions and 7 deletions

View File

@ -21,13 +21,26 @@
* *
*/ */
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
#error "Only <cogl/cogl.h> can be included directly."
#endif
#ifndef __COGL_SDL_H__ #ifndef __COGL_SDL_H__
#define __COGL_SDL_H__ #define __COGL_SDL_H__
/* NB: this is a top-level header that can be included directly but we
* want to be careful not to define __COGL_H_INSIDE__ when this is
* included internally while building Cogl itself since
* __COGL_H_INSIDE__ is used in headers to guard public vs private 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_SDL_H_MUST_UNDEF_COGL_H_INSIDE__
#endif
#endif /* COGL_COMPILATION */
#include <cogl/cogl-context.h> #include <cogl/cogl-context.h>
#include <cogl/cogl-onscreen.h> #include <cogl/cogl-onscreen.h>
#include <SDL.h> #include <SDL.h>
@ -221,4 +234,17 @@ cogl_sdl_onscreen_get_window (CoglOnscreen *onscreen);
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_SDL_H_MUST_UNDEF_COGL_H_INSIDE__
#undef __COGL_H_INSIDE__
#undef __COGL_SDL_H_MUST_UNDEF_COGL_H_INSIDE__
#endif
#endif /* __COGL_SDL_H__ */ #endif /* __COGL_SDL_H__ */

View File

@ -138,9 +138,6 @@
* code has been migrated down into Cogl! */ * code has been migrated down into Cogl! */
#include <cogl/deprecated/cogl-clutter.h> #include <cogl/deprecated/cogl-clutter.h>
#endif #endif
#ifdef COGL_HAS_SDL_SUPPORT
#include <cogl/cogl-sdl.h>
#endif
/* /*
* API deprecations * API deprecations

View File

@ -1,4 +1,5 @@
#include <cogl/cogl.h> #include <cogl/cogl.h>
#include <cogl/cogl-sdl.h>
#include <stdio.h> #include <stdio.h>
#include <SDL.h> #include <SDL.h>

View File

@ -1,4 +1,5 @@
#include <cogl/cogl.h> #include <cogl/cogl.h>
#include <cogl/cogl-sdl.h>
#include <stdio.h> #include <stdio.h>
#include <SDL.h> #include <SDL.h>