[cogl] examples: Allow installing of examples



commit 7669fdc8271efe76a9b0ded19092a7ac6384f8c5
Author: Robert Bragg <robert linux intel com>
Date:   Wed Oct 12 16:01:11 2011 +0100

    examples: Allow installing of examples
    
    This namespaces all of the examples and marks them for installation
    if --enable-examples-install has been passed to ./configure. This
    simplifies packaging the examples which can be quite convenient
    for smoke testing Cogl on various platform.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656755
    
    Reviewed-by: Neil Roberts <neil linux intel com>

 configure.ac                                   |   11 +++++
 examples/Makefile.am                           |   49 ++++++++++++++---------
 examples/{crate.c => cogl-crate.c}             |    0
 examples/{hello.c => cogl-hello.c}             |    0
 examples/{x11-foreign.c => cogl-x11-foreign.c} |    0
 examples/{x11-tfp.c => cogl-x11-tfp.c}         |    0
 6 files changed, 41 insertions(+), 19 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9166e3e..f436815 100644
--- a/configure.ac
+++ b/configure.ac
@@ -384,6 +384,17 @@ AS_IF([test "x$enable_cogl_pango" = "xyes"],
 )
 
 dnl     ============================================================
+dnl     Should examples be installed?
+dnl     ============================================================
+AC_ARG_ENABLE(
+  [examples-install],
+  [AC_HELP_STRING([--enable-examples-install=@<:@no/yes@:>@], [Enable installation of examples @<:@default=no@:>@])],
+  [],
+  enable_examples_install=no
+)
+AM_CONDITIONAL([INSTALL_EXAMPLES], [test "x$enable_examples_install" = "xyes"])
+
+dnl     ============================================================
 dnl     Determine which drivers and window systems we can support
 dnl     ============================================================
 
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 1ebe11a..4475753 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,48 +1,59 @@
 include $(top_srcdir)/build/autotools/Makefile.am.silent
 
 INCLUDES = \
-	-I$(top_srcdir) \
-	-I$(top_srcdir)/clutter/cogl \
-	-I$(top_builddir)/clutter/cogl
+	-I$(top_srcdir)
 
 AM_CFLAGS = \
 	$(COGL_DEP_CFLAGS) \
 	$(COGL_EXTRA_CFLAGS) \
-	-DCOGL_ENABLE_EXPERIMENTAL_2_0_API \
-	-DCOGL_EXAMPLES_DATA=\""$(abs_top_srcdir)/examples/"\"
+	-DCOGL_ENABLE_EXPERIMENTAL_2_0_API
+
+if INSTALL_EXAMPLES
+AM_CFLAGS += -DCOGL_EXAMPLES_DATA=\""$(pkgdatadir)/examples-data/"\"
+else
+AM_CFLAGS += -DCOGL_EXAMPLES_DATA=\""$(abs_top_srcdir)/examples/"\"
+endif
 
 common_ldadd = \
 	$(COGL_DEP_LIBS) \
 	$(top_builddir)/cogl/libcogl.la
 
-noinst_PROGRAMS = hello
+programs = cogl-hello
+examples_datadir = $(pkgdatadir)/examples-data
+examples_data_DATA =
 
-hello_SOURCES = hello.c
-hello_LDADD = $(common_ldadd)
+cogl_hello_SOURCES = cogl-hello.c
+cogl_hello_LDADD = $(common_ldadd)
 
 if BUILD_COGL_PANGO
-noinst_PROGRAMS += crate
-crate_SOURCES = crate.c
-crate_LDADD = $(common_ldadd) $(COGL_PANGO_DEP_LIBS) $(top_builddir)/cogl-pango/libcogl-pango.la
-crate_CFLAGS = $(AM_CFLAGS) $(COGL_PANGO_DEP_CFLAGS)
+programs += cogl-crate
+cogl_crate_SOURCES = cogl-crate.c
+cogl_crate_LDADD = $(common_ldadd) $(COGL_PANGO_DEP_LIBS) $(top_builddir)/cogl-pango/libcogl-pango.la
+cogl_crate_CFLAGS = $(AM_CFLAGS) $(COGL_PANGO_DEP_CFLAGS)
+examples_data_DATA += crate.jpg
 endif
 
 if X11_TESTS
-noinst_PROGRAMS += x11-foreign x11-tfp
-x11_foreign_SOURCES = x11-foreign.c
-x11_foreign_LDADD = $(common_ldadd)
-x11_tfp_SOURCES = x11-tfp.c
-x11_tfp_LDADD = $(common_ldadd)
+programs += cogl-x11-foreign cogl-x11-tfp
+cogl_x11_foreign_SOURCES = cogl-x11-foreign.c
+cogl_x11_foreign_LDADD = $(common_ldadd)
+cogl_x11_tfp_SOURCES = cogl-x11-tfp.c
+cogl_x11_tfp_LDADD = $(common_ldadd)
 endif
 
 if SUPPORT_WAYLAND_EGL_SERVER
-noinst_PROGRAMS += cogland
+programs += cogland
 cogland_SOURCES = cogland.c
 cogland_LDADD = $(common_ldadd)
 endif
 
+if INSTALL_EXAMPLES
+bin_PROGRAMS = $(programs)
+else
+noinst_PROGRAMS = $(programs)
+endif
+
 EXTRA_DIST = \
-	crate.jpg \
 	android/hello/AndroidManifest.xml \
 	android/hello/jni/Application.mk \
 	android/hello/jni/Android.mk \
diff --git a/examples/crate.c b/examples/cogl-crate.c
similarity index 100%
rename from examples/crate.c
rename to examples/cogl-crate.c
diff --git a/examples/hello.c b/examples/cogl-hello.c
similarity index 100%
rename from examples/hello.c
rename to examples/cogl-hello.c
diff --git a/examples/x11-foreign.c b/examples/cogl-x11-foreign.c
similarity index 100%
rename from examples/x11-foreign.c
rename to examples/cogl-x11-foreign.c
diff --git a/examples/x11-tfp.c b/examples/cogl-x11-tfp.c
similarity index 100%
rename from examples/x11-tfp.c
rename to examples/cogl-x11-tfp.c



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