diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2017-05-26 12:49:44 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2017-05-26 12:54:02 +0100 |
commit | 2f047ce341df41d2d34801dc6262a5ae77487a31 (patch) | |
tree | 05f96da173bd20547bc27ca9a6bafb83896cb18e | |
parent | ed9e0a39129ba3e675933d1a1a4552a0a5fbbfc7 (diff) | |
download | clutter-gtk-2f047ce341df41d2d34801dc6262a5ae77487a31.tar.gz |
Allow running examples in non-srcdir builds
If we build the examples in a build directory we still want to be able
to access the ancillary data files.
-rw-r--r-- | examples/Makefile.am | 3 | ||||
-rw-r--r-- | examples/gtk-clutter-events.c | 6 | ||||
-rw-r--r-- | examples/gtk-clutter-test.c | 6 |
3 files changed, 12 insertions, 3 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am index b7959fb..01b17f1 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -13,7 +13,8 @@ AM_CPPFLAGS = \ -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)/clutter-gtk \ -DGLIB_DISABLE_DEPRECATION_WARNINGS \ -DGDK_DISABLE_DEPRECATION_WARNINGS \ - -DCLUTTER_DISABLE_DEPRECATION_WARNINGS + -DCLUTTER_DISABLE_DEPRECATION_WARNINGS \ + -DEXAMPLES_DATADIR=\"$(srcdir)\" AM_CFLAGS = $(MAINTAINER_CFLAGS) $(CLUTTER_GTK_DEPS_CFLAGS) common_deps = \ diff --git a/examples/gtk-clutter-events.c b/examples/gtk-clutter-events.c index d357b78..a433af5 100644 --- a/examples/gtk-clutter-events.c +++ b/examples/gtk-clutter-events.c @@ -3,6 +3,10 @@ #include <clutter-gtk/clutter-gtk.h> +#ifndef EXAMPLES_DATADIR +#define EXAMPLES_DATADIR "." +#endif + typedef struct { GtkWidget *window; @@ -181,7 +185,7 @@ main (gint argc, gchar **argv) NULL); /* Create the main texture that the spin buttons manipulate */ - pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL); + pixbuf = gdk_pixbuf_new_from_file (EXAMPLES_DATADIR G_DIR_SEPARATOR_S "redhand.png", NULL); if (pixbuf == NULL) g_error ("Unable to load pixbuf\n"); diff --git a/examples/gtk-clutter-test.c b/examples/gtk-clutter-test.c index f15c265..e61cd84 100644 --- a/examples/gtk-clutter-test.c +++ b/examples/gtk-clutter-test.c @@ -11,6 +11,10 @@ #define WINHEIGHT 400 #define RADIUS 150 +#ifndef EXAMPLES_DATADIR +#define EXAMPLES_DATADIR "." +#endif + typedef struct SuperOH { ClutterActor *stage; @@ -146,7 +150,7 @@ main (int argc, char *argv[]) /* calling gtk_clutter_init* multiple times should be safe */ g_assert (gtk_clutter_init (NULL, NULL) == CLUTTER_INIT_SUCCESS); - pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL); + pixbuf = gdk_pixbuf_new_from_file (EXAMPLES_DATADIR G_DIR_SEPARATOR_S "redhand.png", NULL); if (!pixbuf) g_error("pixbuf load failed"); |