build: Make cogl.h not conditional on driver defines

The main COGL header cogl.h is currently created at configure time
because it conditionally includes the driver-dependent defines. This
sometimes leads to a stale cogl.h with old definitions which can
break the build until you clean out the whole tree and start from
scratch.

We can generate a stable cogl-defines.h at build time from the
equivalent driver-dependent header and let cogl.h include that
file instead.
This commit is contained in:
Emmanuele Bassi 2009-11-18 17:35:07 +00:00
parent b91e8a828f
commit 2f2c3fb839
2 changed files with 13 additions and 7 deletions

View File

@ -4,8 +4,8 @@ NULL =
SUBDIRS = driver SUBDIRS = driver
BUILT_SOURCES = cogl.h BUILT_SOURCES =
EXTRA_DIST = cogl.h.in cogl.pc.in EXTRA_DIST =
CLEANFILES = CLEANFILES =
DISTCLEANFILES = DISTCLEANFILES =
@ -23,6 +23,7 @@ cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc: cogl.pc
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files) pkgconfig_DATA = $(pc_files)
EXTRA_DIST += cogl.pc.in
CLEANFILES += $(pc_files) CLEANFILES += $(pc_files)
INCLUDES = \ INCLUDES = \
@ -33,6 +34,12 @@ INCLUDES = \
-I$(top_builddir)/clutter/cogl \ -I$(top_builddir)/clutter/cogl \
$(NULL) $(NULL)
cogl-defines.h: $(srcdir)/driver/gl/cogl-defines.h $(srcdir)/driver/gles/cogl-defines.h
$(QUIET_GEN)cp -f $(srcdir)/driver/$(COGL_DRIVER)/cogl-defines.h $(@F)
BUILT_SOURCES += cogl-defines.h
DISTCLEANFILES += cogl-defines.h
# public headers # public headers
cogl_public_h = \ cogl_public_h = \
$(srcdir)/cogl-bitmap.h \ $(srcdir)/cogl-bitmap.h \
@ -47,7 +54,7 @@ cogl_public_h = \
$(srcdir)/cogl-texture.h \ $(srcdir)/cogl-texture.h \
$(srcdir)/cogl-types.h \ $(srcdir)/cogl-types.h \
$(srcdir)/cogl-vertex-buffer.h \ $(srcdir)/cogl-vertex-buffer.h \
$(top_builddir)/clutter/cogl/cogl/cogl.h \ $(srcdir)/cogl.h \
$(NULL) $(NULL)
# windowing system; all sources have to be distributed, but we'll # windowing system; all sources have to be distributed, but we'll
@ -82,6 +89,7 @@ libclutter_cogl_la_LIBADD = -lm $(CLUTTER_LIBS) \
$(top_builddir)/clutter/cogl/cogl/driver/$(COGL_DRIVER)/libclutter-cogl-driver.la $(top_builddir)/clutter/cogl/cogl/driver/$(COGL_DRIVER)/libclutter-cogl-driver.la
libclutter_cogl_la_SOURCES = \ libclutter_cogl_la_SOURCES = \
$(BUILT_SOURCES) \
$(srcdir)/winsys/cogl-winsys.h \ $(srcdir)/winsys/cogl-winsys.h \
$(srcdir)/winsys/cogl-@COGL_WINSYS@.c \ $(srcdir)/winsys/cogl-@COGL_WINSYS@.c \
$(srcdir)/cogl-handle.h \ $(srcdir)/cogl-handle.h \
@ -127,18 +135,16 @@ libclutter_cogl_la_SOURCES = \
$(srcdir)/cogl-draw-buffer.c \ $(srcdir)/cogl-draw-buffer.c \
$(srcdir)/cogl-matrix-mesa.h \ $(srcdir)/cogl-matrix-mesa.h \
$(srcdir)/cogl-matrix-mesa.c \ $(srcdir)/cogl-matrix-mesa.c \
$(BUILT_SOURCES) \
$(NULL) $(NULL)
EXTRA_DIST += $(cogl_winsys_sources) EXTRA_DIST += $(cogl_winsys_sources)
EXTRA_DIST += stb_image.c EXTRA_DIST += stb_image.c
# COGL installed headers # COGL installed headers
cogl_headers = \ cogl_headers = \
$(cogl_public_h) \ $(cogl_public_h) \
$(srcdir)/cogl-deprecated.h \ $(srcdir)/cogl-deprecated.h \
cogl-defines-$(COGL_DRIVER).h \ cogl-defines.h \
cogl-enum-types.h \ cogl-enum-types.h \
$(NULL) $(NULL)

View File

@ -29,7 +29,7 @@
#define __COGL_H_INSIDE__ #define __COGL_H_INSIDE__
#include <cogl/cogl-defines-@COGL_DRIVER@.h> #include <cogl/cogl-defines.h>
#include <cogl/cogl-bitmap.h> #include <cogl/cogl-bitmap.h>
#include <cogl/cogl-color.h> #include <cogl/cogl-color.h>