[clutter: 17/19] Adds a --with-system-cogl config option for Clutter



commit 70767f08dc1e0ca64ad0c38131cebd70ddd5022f
Author: Robert Bragg <robert linux intel com>
Date:   Tue Feb 22 15:51:13 2011 +0000

    Adds a --with-system-cogl config option for Clutter
    
    This makes it possible to build Clutter against a standalone build of
    Cogl instead of having the Clutter build traverse into the clutter/cogl
    subdirectory.

 clutter/Makefile.am                      |   78 ++++++++++++++++++++++++------
 clutter/clutter-backend.c                |    1 -
 clutter/clutter-main.c                   |    7 ++-
 clutter/clutter-private.h                |    4 ++
 clutter/glx/clutter-backend-glx.c        |    3 +-
 clutter/glx/clutter-glx-texture-pixmap.c |    5 ++
 clutter/x11/clutter-backend-x11.c        |    3 +-
 clutter/x11/clutter-x11-texture-pixmap.c |    5 ++
 configure.ac                             |   17 ++++++-
 tests/interactive/Makefile.am            |    1 -
 10 files changed, 101 insertions(+), 23 deletions(-)
---
diff --git a/clutter/Makefile.am b/clutter/Makefile.am
index 3946c10..5314d7e 100644
--- a/clutter/Makefile.am
+++ b/clutter/Makefile.am
@@ -4,7 +4,9 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
 NULL =
 
 # we recurse only into Cogl
+if !USE_SYSTEM_COGL
 SUBDIRS = cogl
+endif
 
 # common definitions
 CLEANFILES =
@@ -17,16 +19,21 @@ lib_LTLIBRARIES =
 INCLUDES = \
 	-I$(top_srcdir) 				\
 	-I$(top_srcdir)/clutter				\
-	-I$(top_srcdir)/clutter/cogl			\
-	-I$(top_srcdir)/clutter/cogl/pango		\
 	-I$(top_srcdir)/clutter/$(CLUTTER_WINSYS)	\
 	-I$(top_srcdir)/clutter/$(CLUTTER_WINSYS_BASE)	\
 	-I$(top_srcdir)/clutter/cally			\
 	-I$(top_srcdir)/clutter/evdev			\
 	-I$(top_builddir)				\
 	-I$(top_builddir)/clutter			\
+	$(NULL)
+
+if !USE_SYSTEM_COGL
+INCLUDES += \
+	-I$(top_srcdir)/clutter/cogl			\
+	-I$(top_srcdir)/clutter/cogl/pango		\
 	-I$(top_builddir)/clutter/cogl			\
 	$(NULL)
+endif
 
 AM_CPPFLAGS = \
 	-DCLUTTER_PREFIX=\""$(prefix)"\"	\
@@ -646,15 +653,20 @@ lib_LTLIBRARIES += libclutter- CLUTTER_SONAME_INFIX@- CLUTTER_API_VERSION@.la
 
 libclutter_ CLUTTER_SONAME_INFIX@_ CLUTTER_API_VERSION@_la_LIBADD = \
 	$(CLUTTER_LIBS) \
-	$(CLUTTER_PROFILE_LIBS) \
-	$(top_builddir)/clutter/cogl/cogl/libcogl.la \
-	$(top_builddir)/clutter/cogl/pango/libcoglpango.la
+	$(CLUTTER_PROFILE_LIBS)
 
 libclutter_ CLUTTER_SONAME_INFIX@_ CLUTTER_API_VERSION@_la_DEPENDENCIES = \
-	$(top_builddir)/clutter/cogl/cogl/libcogl.la \
-	$(top_builddir)/clutter/cogl/pango/libcoglpango.la \
 	$(win32_resources)
 
+if !USE_SYSTEM_COGL
+libclutter_ CLUTTER_SONAME_INFIX@_ CLUTTER_API_VERSION@_la_LIBADD += \
+	$(top_builddir)/clutter/cogl/cogl/libcogl.la \
+	$(top_builddir)/clutter/cogl/pango/libcoglpango.la
+libclutter_ CLUTTER_SONAME_INFIX@_ CLUTTER_API_VERSION@_la_DEPENDENCIES += \
+	$(top_builddir)/clutter/cogl/cogl/libcogl.la \
+	$(top_builddir)/clutter/cogl/pango/libcoglpango.la
+endif
+
 libclutter_ CLUTTER_SONAME_INFIX@_ CLUTTER_API_VERSION@_la_SOURCES = \
 	$(backend_source_c) \
 	$(backend_source_h) \
@@ -701,9 +713,19 @@ Clutter_ CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0 cairo-1.0 Atk
 Clutter_ CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
 	--warn-all \
 	--c-include='clutter/clutter.h' \
-	--pkg-export=clutter- CLUTTER_API_VERSION@ \
+	--pkg-export=clutter- CLUTTER_API_VERSION@
+if USE_SYSTEM_COGL
+Clutter_ CLUTTER_API_VERSION_AM@_gir_INCLUDES += Cogl-1.0
+else
+Clutter_ CLUTTER_API_VERSION_AM@_gir_LIBS += \
+	$(top_builddir)/clutter/cogl/cogl/libcogl.la \
+	$(top_builddir)/clutter/cogl/pango/libcoglpango.la
+Clutter_ CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS += \
 	--include-uninstalled=$(top_builddir)/clutter/cogl/cogl/Cogl-1.0.gir
+COGL_GIR_DEP=Cogl-1.0.gir
+endif
 
+if !USE_SYSTEM_COGL
 # Cogl.gir is used included into Clutter.gir, so it needs to be built
 # before the typelib is generated
 Clutter- CLUTTER_API_VERSION@.typelib: Cogl-1.0.gir
@@ -716,11 +738,12 @@ Clutter- CLUTTER_API_VERSION@.typelib: Cogl-1.0.gir
 Cogl-1.0.gir: Makefile Clutter- CLUTTER_API_VERSION@.gir cogl/cogl/Cogl-1.0.gir
 	$(QUIET_GEN) \
 	shlib=`sed -n 's/.*shared-library="\([^"]*\)".*/\1/p' < Clutter- CLUTTER_API_VERSION@.gir` ; \
-	sed "s/shared-library=\"[^\"]*\"/shared-library=\"$$shlib\"/"< cogl/cogl/Cogl-1.0.gir > $@
+	sed "s/shared-library=\"[^\"]*\"/shared-library=\"$$shlib\"/"< $(top_builddir)/clutter/cogl/cogl/Cogl-1.0.gir > $@
 
 BUILT_GIRSOURCES += Cogl-1.0.gir
+endif
 
-Cally- CLUTTER_API_VERSION@.gir: Makefile Clutter- CLUTTER_API_VERSION@.gir Cogl-1.0.gir
+Cally- CLUTTER_API_VERSION@.gir: Makefile Clutter- CLUTTER_API_VERSION@.gir $(COGL_GIR_DEP)
 
 Cally_ CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Cally
 Cally_ CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@
@@ -731,27 +754,52 @@ Cally_ CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
 	--identifier-prefix=Cally \
 	--symbol-prefix=cally \
 	--c-include='cally/cally.h' \
-	--pkg-export=cally- CLUTTER_API_VERSION@ \
+	--pkg-export=cally- CLUTTER_API_VERSION@
+# Note: it's important to pass --include-uninstalled for the Cogl-1.0.gir
+# before the Clutter gir otherwise g-ir-scanner can get upset as it
+# immediatly scans the Clutter gir file and may fail to find a Cogl-1.0.gir
+if USE_SYSTEM_COGL
+Cally_ CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS += \
+	--include-uninstalled=$(top_builddir)/clutter/Clutter- CLUTTER_API_VERSION@.gir
+else
+Cally_ CLUTTER_API_VERSION_AM@_gir_LIBS += \
+	$(top_builddir)/clutter/cogl/cogl/libcogl.la \
+	$(top_builddir)/clutter/cogl/pango/libcoglpango.la
+Cally_ CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS += \
 	--include-uninstalled=$(top_builddir)/clutter/Cogl-1.0.gir \
 	--include-uninstalled=$(top_builddir)/clutter/Clutter- CLUTTER_API_VERSION@.gir
+endif
 
 INTROSPECTION_GIRS += Cally- CLUTTER_API_VERSION@.gir
 
 if SUPPORT_X11
-ClutterX11- CLUTTER_API_VERSION@.gir: Makefile Clutter- CLUTTER_API_VERSION@.gir Cogl-1.0.gir
+ClutterX11- CLUTTER_API_VERSION@.gir: Makefile Clutter- CLUTTER_API_VERSION@.gir $(COGL_GIR_DEP)
 
 ClutterX11_ CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
 	--identifier-prefix=ClutterX11 \
 	--symbol-prefix=clutter_x11 \
 	--c-include='clutter/x11/clutter-x11.h' \
-	--pkg-export=clutter-x11- CLUTTER_API_VERSION@ \
-	--include-uninstalled=$(top_builddir)/clutter/Cogl-1.0.gir \
-	--include-uninstalled=$(top_builddir)/clutter/Clutter- CLUTTER_API_VERSION@.gir
+	--pkg-export=clutter-x11- CLUTTER_API_VERSION@
 ClutterX11_ CLUTTER_API_VERSION_AM@_gir_INCLUDES = xlib-2.0
 ClutterX11_ CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter- CLUTTER_SONAME_INFIX@- CLUTTER_API_VERSION@.la
 ClutterX11_ CLUTTER_API_VERSION_AM@_gir_FILES = $(x11_introspection)
 ClutterX11_ CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(CLUTTER_CFLAGS) $(AM_CPPFLAGS) -UCLUTTER_DISABLE_DEPRECATED
 
+# Note: it's important to pass --include-uninstalled for the Cogl-1.0.gir
+# before the Clutter gir otherwise g-ir-scanner can get upset as it
+# immediatly scans the Clutter gir file and may fail to find a Cogl-1.0.gir
+if USE_SYSTEM_COGL
+ClutterX11_ CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS += \
+	--include-uninstalled=$(top_builddir)/clutter/Clutter- CLUTTER_API_VERSION@.gir
+else
+ClutterX11_ CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS += \
+	--include-uninstalled=$(top_builddir)/clutter/Cogl-1.0.gir \
+	--include-uninstalled=$(top_builddir)/clutter/Clutter- CLUTTER_API_VERSION@.gir
+ClutterX11_ CLUTTER_API_VERSION_AM@_gir_LIBS += \
+	$(top_builddir)/clutter/cogl/cogl/libcogl.la \
+	$(top_builddir)/clutter/cogl/pango/libcoglpango.la
+endif
+
 INTROSPECTION_GIRS += ClutterX11- CLUTTER_API_VERSION@.gir
 endif # SUPPORT_X11
 
diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c
index 6763247..93328be 100644
--- a/clutter/clutter-backend.c
+++ b/clutter/clutter-backend.c
@@ -53,7 +53,6 @@
 #include "clutter-version.h"
 
 #include <cogl/cogl.h>
-#include <cogl/cogl-internal.h>
 
 G_DEFINE_ABSTRACT_TYPE (ClutterBackend, clutter_backend, G_TYPE_OBJECT);
 
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index c1e6884..183f784 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -109,8 +109,13 @@
 #include "clutter-stage-private.h"
 #include "clutter-version.h" 	/* For flavour define */
 
-#include "cogl/cogl.h"
+#include <cogl/cogl.h>
+
+#ifdef CLUTTER_USING_SYSTEM_COGL
+#include <cogl/cogl-pango.h>
+#else
 #include "pango/cogl-pango.h"
+#endif
 
 #include "cally.h" /* For accessibility support */
 
diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h
index 4a27343..7476f0e 100644
--- a/clutter/clutter-private.h
+++ b/clutter/clutter-private.h
@@ -30,7 +30,11 @@
 
 #include <glib/gi18n-lib.h>
 
+#ifdef CLUTTER_USING_SYSTEM_COGL
+#include <cogl/cogl-pango.h>
+#else
 #include "pango/cogl-pango.h"
+#endif
 
 #include "clutter-backend.h"
 #include "clutter-effect.h"
diff --git a/clutter/glx/clutter-backend-glx.c b/clutter/glx/clutter-backend-glx.c
index 38c90ba..3e565ea 100644
--- a/clutter/glx/clutter-backend-glx.c
+++ b/clutter/glx/clutter-backend-glx.c
@@ -48,8 +48,7 @@
 #include "clutter-private.h"
 #include "clutter-stage-private.h"
 
-#include "cogl/cogl.h"
-#include "cogl/cogl-internal.h"
+#include <cogl/cogl.h>
 
 #define clutter_backend_glx_get_type    _clutter_backend_glx_get_type
 
diff --git a/clutter/glx/clutter-glx-texture-pixmap.c b/clutter/glx/clutter-glx-texture-pixmap.c
index 662764d..df29156 100644
--- a/clutter/glx/clutter-glx-texture-pixmap.c
+++ b/clutter/glx/clutter-glx-texture-pixmap.c
@@ -52,7 +52,12 @@
 #include <GL/glx.h>
 
 #include "x11/clutter-x11-texture-pixmap.h"
+
+#ifdef CLUTTER_USING_SYSTEM_COGL
+#include <cogl/cogl-texture-pixmap-x11.h>
+#else
 #include "cogl/winsys/cogl-texture-pixmap-x11.h"
+#endif
 
 G_DEFINE_TYPE (ClutterGLXTexturePixmap,    \
                clutter_glx_texture_pixmap, \
diff --git a/clutter/x11/clutter-backend-x11.c b/clutter/x11/clutter-backend-x11.c
index 4b04123..1df37b4 100644
--- a/clutter/x11/clutter-backend-x11.c
+++ b/clutter/x11/clutter-backend-x11.c
@@ -58,8 +58,7 @@
 #include <X11/extensions/XInput2.h>
 #endif
 
-#include "cogl/cogl.h"
-#include "cogl/cogl-internal.h"
+#include <cogl/cogl.h>
 
 #include "clutter-backend.h"
 #include "clutter-debug.h"
diff --git a/clutter/x11/clutter-x11-texture-pixmap.c b/clutter/x11/clutter-x11-texture-pixmap.c
index 5e349bb..9965fb0 100644
--- a/clutter/x11/clutter-x11-texture-pixmap.c
+++ b/clutter/x11/clutter-x11-texture-pixmap.c
@@ -52,7 +52,12 @@
 #include "clutter-private.h"
 
 #include "cogl/cogl.h"
+
+#ifdef CLUTTER_USING_SYSTEM_COGL
+#include <cogl/cogl-texture-pixmap-x11.h>
+#else
 #include "cogl/winsys/cogl-texture-pixmap-x11.h"
+#endif
 
 #include <X11/extensions/Xdamage.h>
 
diff --git a/configure.ac b/configure.ac
index c17f212..fddf4d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,8 +206,23 @@ AC_ARG_WITH([gles],
                             [Select Clutter GLES version (for EGL backends)])],
             [glesversion=$with_gles])
 
+COGL_REQ=""
+AC_ARG_WITH([system-cogl],
+            [AS_HELP_STRING([--with-system-cogl=@<:@yes/no@:>@],
+                            [Use a system installed Cogl library])],
+            [
+              if test "x$with_system_cogl" = "xyes"; then
+                COGL_REQ="cogl-1.0"
+              fi
+            ],
+            [with_system_cogl=no])
+
+AM_CONDITIONAL(USE_SYSTEM_COGL, [test "x$with_system_cogl" = "xyes"])
+AS_IF([test "x$with_system_cogl" = "xyes"],
+      [ AC_DEFINE([CLUTTER_USING_SYSTEM_COGL], [1], [Built against the system Cogl library])])
+
 # base dependencies for core
-CLUTTER_BASE_PC_FILES="cairo-gobject >= $CAIRO_REQ_VERSION atk >= $ATK_REQ_VERSION pangocairo >= $PANGO_REQ_VERSION json-glib-1.0 >= $JSON_GLIB_REQ_VERSION"
+CLUTTER_BASE_PC_FILES="cairo-gobject >= $CAIRO_REQ_VERSION atk >= $ATK_REQ_VERSION pangocairo >= $PANGO_REQ_VERSION json-glib-1.0 >= $JSON_GLIB_REQ_VERSION $COGL_REQ"
 
 # backend specific pkg-config files
 BACKEND_PC_FILES=""
diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am
index c720768..5c04bf6 100644
--- a/tests/interactive/Makefile.am
+++ b/tests/interactive/Makefile.am
@@ -109,7 +109,6 @@ INCLUDES = \
 
 common_ldadd = $(top_builddir)/clutter/libclutter- CLUTTER_SONAME_INFIX@- CLUTTER_API_VERSION@.la
 
-
 noinst_PROGRAMS = test-interactive
 
 test_interactive_SOURCES = test-main.c $(UNIT_TESTS)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]