[Cogl] [PATCH] namespace symbols output by glib-mkenums
Robert Bragg
robert at sixbynine.org
Wed Apr 18 08:26:07 PDT 2012
From: Robert Bragg <robert at linux.intel.com>
This puts all the _get_type() symbols output by glib-mkenums into a
cogl_gtype_ namespace and also ensures the symbols aren't generated if
Cogl is built with --disable-glib.
This is consistent with the cogl_gtype_matrix_get_type() symbol we
expose.
By namespacing the GType integration api that also means we can choose
to use api like cogl_texture_get_type() for queries more directly
related to the core Cogl api, such as querying whether a texture is a
CoglTexture2D vs Texture3D or SubTexture etc.
---
build/autotools/Makefile.am.enums | 1 +
cogl/Makefile.am | 7 ++++++-
cogl/cogl-matrix.c | 2 +-
cogl/cogl.h | 6 ------
configure.ac | 1 +
examples/Makefile.am | 12 +++++++++---
6 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/build/autotools/Makefile.am.enums b/build/autotools/Makefile.am.enums
index d3dc742..1c92437 100644
--- a/build/autotools/Makefile.am.enums
+++ b/build/autotools/Makefile.am.enums
@@ -45,6 +45,7 @@ $(glib_enum_h): stamp-enum-types
$(glib_enum_c): $(glib_enum_headers) $(glib_enum_h) $(enum_tmpl_c)
$(AM_V_GEN)$(GLIB_MKENUMS) \
+ --symbol-prefix cogl_gtype \
--template $(enum_tmpl_c) \
$(glib_enum_headers) > xgen-ec \
&& cp -f xgen-ec $(glib_enum_c) \
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 82f5857..c459140 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -430,11 +430,13 @@ endif
EXTRA_DIST += stb_image.c
+if USE_GLIB
# glib-mkenums rules
glib_enum_h = cogl-enum-types.h
glib_enum_c = cogl-enum-types.c
glib_enum_headers = $(cogl_1_public_h)
include $(top_srcdir)/build/autotools/Makefile.am.enums
+endif
#XXX should we specify a libdir sub-directory now so that
#for the next major version of Cogl we don't need to change
@@ -466,7 +468,10 @@ cogl_headers = \
coglincludedir = $(includedir)/cogl2/cogl
coglinclude_HEADERS = $(cogl_headers) $(cogl_experimental_h)
-nodist_coglinclude_HEADERS = cogl-defines.h cogl-enum-types.h
+nodist_coglinclude_HEADERS = cogl-defines.h
+if USE_GLIB
+nodist_coglinclude_HEADERS += cogl-enum-types.h
+endif
dist-hook: ../build/win32/vs9/cogl.vcproj ../build/win32/vs10/cogl.vcxproj ../build/win32/vs10/cogl.vcxproj.filters ../build/win32/gen-enums.bat
diff --git a/cogl/cogl-matrix.c b/cogl/cogl-matrix.c
index d22293e..b1574eb 100644
--- a/cogl/cogl-matrix.c
+++ b/cogl/cogl-matrix.c
@@ -77,7 +77,7 @@
#include <math.h>
#include <string.h>
-#ifdef _COGL_SUPPORTS_GTYPE_INTEGRATION
+#ifdef COGL_HAS_GTYPE_SUPPORT
#include <cogl-gtype-private.h>
COGL_GTYPE_DEFINE_BOXED ("Matrix", matrix,
cogl_matrix_copy,
diff --git a/cogl/cogl.h b/cogl/cogl.h
index 1984e3f..80e6d9c 100644
--- a/cogl/cogl.h
+++ b/cogl/cogl.h
@@ -39,12 +39,6 @@
#define COGL_ENABLE_EXPERIMENTAL_API
#endif
-/* We currently keep gtype integration delimited in case we eventually
- * want to split it out into a separate utility library when Cogl
- * becomes a standalone project. (like cairo-gobject.so)
- */
-#define _COGL_SUPPORTS_GTYPE_INTEGRATION
-
/*
* API common to the 1.x and 2.0 api...
*/
diff --git a/configure.ac b/configure.ac
index 668bf87..aaba17e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -398,6 +398,7 @@ AM_CONDITIONAL([USE_GLIB], [test "x$enable_glib" = "xyes"])
AS_IF([test "x$enable_glib" = "xyes"],
[
COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLIB_SUPPORT"
+ COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GTYPE_SUPPORT"
],
[
EXPERIMENTAL_CONFIG=yes
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 8b4b468..fec0a65 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -17,14 +17,18 @@ common_ldadd = \
$(COGL_DEP_LIBS) \
$(top_builddir)/cogl/libcogl2.la
-programs = cogl-hello cogl-info cogl-msaa
+programs = cogl-info
+
+cogl_info_SOURCES = cogl-info.c
+cogl_info_LDADD = $(common_ldadd)
+
+if USE_GLIB
+programs += cogl-hello cogl-msaa
examples_datadir = $(pkgdatadir)/examples-data
examples_data_DATA =
cogl_hello_SOURCES = cogl-hello.c
cogl_hello_LDADD = $(common_ldadd)
-cogl_info_SOURCES = cogl-info.c
-cogl_info_LDADD = $(common_ldadd)
cogl_msaa_SOURCES = cogl-msaa.c
cogl_msaa_LDADD = $(common_ldadd)
@@ -56,6 +60,8 @@ cogl_sdl_hello_SOURCES = cogl-sdl-hello.c
cogl_sdl_hello_LDADD = $(common_ldadd)
endif
+endif #USE_GLIB
+
if INSTALL_EXAMPLES
bin_PROGRAMS = $(programs)
else
--
1.7.7.6
More information about the Cogl
mailing list