mutter/cogl/Makefile.am
Neil Roberts 058d79dce2 cogl: Make it easier to add checks for GL extensions
Previously if you need to depend on a new GL feature you had to:

- Add typedefs for all of the functions in cogl-defines.h.in

- Add function pointers for each of the functions in
  cogl-context-driver.h

- Add an initializer for the function pointers in
  cogl-context-driver.c

- Add a check for the extension and all of the functions in
  cogl_features_init. If the extension is available under multiple
  names then you have to duplicate the checks.

This is quite tedious and error prone. This patch moves all of the
features and their functions into a list of macro invocations in
cogl-feature-functions.h. The macros can be redefined to implement all
of the above tasks from the same header.

The features are described in a struct with a pointer to a table of
functions. A new function takes the feature description from this
struct and checks for its availability. The feature can take a list of
extension names with a list of alternate namespaces (such as "EXT" or
"ARB"). It can also detect the feature from a particular version of
GL.

The typedefs are now gone and instead the function pointer in the Cogl
context just directly contains the type.

Some of the functions in the context were previously declared with the
'ARB' extension. This has been removed so that now all the functions
have no suffix. This makes more sense when the extension could
potentially be merged into GL core as well.
2009-11-17 15:11:26 +00:00

173 lines
4.7 KiB
Makefile

include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
SUBDIRS = driver
BUILT_SOURCES = cogl.h
EXTRA_DIST = cogl.h.in cogl.pc.in
CLEANFILES =
DISTCLEANFILES =
# pkg-config ==================================================================
pc_files = \
cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc \
cogl-$(CLUTTER_API_VERSION).pc
cogl-$(CLUTTER_API_VERSION).pc: cogl.pc
$(QUIET_GEN)cp -f $< $(@F)
cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc: cogl.pc
$(QUIET_GEN)cp -f $< $(@F)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)
CLEANFILES += $(pc_files)
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/clutter/cogl \
-I$(srcdir)/winsys \
-I$(srcdir)/driver/$(COGL_DRIVER) \
-I$(top_builddir)/clutter/cogl \
$(NULL)
# public headers
cogl_public_h = \
$(srcdir)/cogl-bitmap.h \
$(srcdir)/cogl-color.h \
$(srcdir)/cogl-debug.h \
$(srcdir)/cogl-fixed.h \
$(srcdir)/cogl-material.h \
$(srcdir)/cogl-matrix.h \
$(srcdir)/cogl-offscreen.h \
$(srcdir)/cogl-path.h \
$(srcdir)/cogl-shader.h \
$(srcdir)/cogl-texture.h \
$(srcdir)/cogl-types.h \
$(srcdir)/cogl-vertex-buffer.h \
$(top_builddir)/clutter/cogl/cogl/cogl.h \
$(NULL)
# windowing system; all sources have to be distributed, but we'll
# compile just the one we need
cogl_winsys_sources = \
$(srcdir)/winsys/cogl-eglnative.c \
$(srcdir)/winsys/cogl-eglx.c \
$(srcdir)/winsys/cogl-glx.c \
$(srcdir)/winsys/cogl-osx.c \
$(srcdir)/winsys/cogl-sdl.c \
$(srcdir)/winsys/cogl-win32.c \
$(NULL)
# glib-mkenums rules
glib_enum_h = cogl-enum-types.h
glib_enum_c = cogl-enum-types.c
glib_enum_headers = $(cogl_public_h)
include $(top_srcdir)/build/autotools/Makefile.am.enums
noinst_LTLIBRARIES = libclutter-cogl.la
libclutter_cogl_la_CPPFLAGS = \
$(COGL_DEBUG_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(MAINTAINER_CFLAGS) \
-DG_DISABLE_SINGLE_INCLUDES \
-DG_LOG_DOMAIN=\"Cogl-$(COGL_WINSYS)\" \
-DCLUTTER_COMPILATION
libclutter_cogl_la_CFLAGS = $(CLUTTER_CFLAGS)
libclutter_cogl_la_LIBADD = -lm $(CLUTTER_LIBS) \
$(top_builddir)/clutter/cogl/cogl/driver/$(COGL_DRIVER)/libclutter-cogl-driver.la
libclutter_cogl_la_SOURCES = \
$(srcdir)/winsys/cogl-winsys.h \
$(srcdir)/winsys/cogl-@COGL_WINSYS@.c \
$(srcdir)/cogl-handle.h \
$(srcdir)/cogl-context.h \
$(srcdir)/cogl-context.c \
$(srcdir)/cogl-internal.h \
$(srcdir)/cogl.c \
$(srcdir)/cogl-util.h \
$(srcdir)/cogl-util.c \
$(srcdir)/cogl-bitmap-private.h \
$(srcdir)/cogl-bitmap.c \
$(srcdir)/cogl-bitmap-fallback.c \
$(srcdir)/cogl-primitives.h \
$(srcdir)/cogl-primitives.c \
$(srcdir)/cogl-bitmap-pixbuf.c \
$(srcdir)/cogl-clip-stack.h \
$(srcdir)/cogl-clip-stack.c \
$(srcdir)/cogl-feature-private.h \
$(srcdir)/cogl-feature-private.c \
$(srcdir)/cogl-fixed.c \
$(srcdir)/cogl-color.c \
$(srcdir)/cogl-vertex-buffer-private.h \
$(srcdir)/cogl-vertex-buffer.c \
$(srcdir)/cogl-matrix.c \
$(srcdir)/cogl-matrix-stack.c \
$(srcdir)/cogl-matrix-stack.h \
$(srcdir)/cogl-material.c \
$(srcdir)/cogl-material-private.h \
$(srcdir)/cogl-blend-string.c \
$(srcdir)/cogl-blend-string.h \
$(srcdir)/cogl-debug.c \
$(srcdir)/cogl-texture-private.h \
$(srcdir)/cogl-texture-2d-sliced-private.h \
$(srcdir)/cogl-texture-driver.h \
$(srcdir)/cogl-texture.c \
$(srcdir)/cogl-texture-2d-sliced.c \
$(srcdir)/cogl-spans.h \
$(srcdir)/cogl-spans.c \
$(srcdir)/cogl-journal-private.h \
$(srcdir)/cogl-journal.c \
$(srcdir)/cogl-draw-buffer-private.h \
$(srcdir)/cogl-draw-buffer.c \
$(srcdir)/cogl-matrix-mesa.h \
$(srcdir)/cogl-matrix-mesa.c \
$(BUILT_SOURCES) \
$(NULL)
EXTRA_DIST += $(cogl_winsys_sources)
EXTRA_DIST += stb_image.c
# COGL installed headers
cogl_headers = \
$(cogl_public_h) \
$(srcdir)/cogl-deprecated.h \
cogl-defines-$(COGL_DRIVER).h \
cogl-enum-types.h \
$(NULL)
coglincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
coglinclude_HEADERS = $(cogl_headers)
if HAVE_INTROSPECTION
Cogl-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-cogl.la
$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \
-I$(srcdir) \
-I$(srcdir)/.. \
-I$(srcdir)/winsys \
-I$(srcdir)/driver/@COGL_DRIVER@ \
-DCLUTTER_COMPILATION \
--c-include='cogl/cogl.h' \
--include=GL-1.0 \
--include=GObject-2.0 \
--library=libclutter-cogl.la \
--libtool="$(top_builddir)/libtool" \
--pkg gobject-2.0 \
--output $@ \
$(cogl_headers)
BUILT_GIRSOURCES = Cogl-@CLUTTER_API_VERSION@.gir
girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES)
CLEANFILES += $(BUILT_GIRSOURCES)
endif