[libpeas] Use the buildir when running the demo's in running in builddir mode



commit 2aa501c25a3530b53496b482ef8df0643db847b3
Author: Garrett Regier <garrettregier gmail com>
Date:   Fri Aug 22 12:03:47 2014 -0700

    Use the buildir when running the demo's in running in builddir mode
    
    Otherwise it assumes the current directory is libpeas/peas-demo
    which can be a pain to figure out.

 peas-demo/Makefile.am |    7 ++++---
 peas-demo/peas-demo.c |   15 +++++++++------
 2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/peas-demo/Makefile.am b/peas-demo/Makefile.am
index ebecf05..d3dc6ab 100644
--- a/peas-demo/Makefile.am
+++ b/peas-demo/Makefile.am
@@ -22,9 +22,10 @@ peas_demo_LDADD = \
        $(PEAS_GTK_LIBS)
 
 peas_demo_CFLAGS = \
-       $(PEAS_CFLAGS)                  \
-       -DPEAS_LIBDIR="\"$(libdir)\""   \
-       -DPEAS_PREFIX="\"$(prefix)\""
+       $(PEAS_CFLAGS)                                  \
+       -DPEAS_LIBDIR="\"$(libdir)\""                   \
+       -DPEAS_PREFIX="\"$(prefix)\""                   \
+       -DPEAS_BUILDDIR="\"$(abs_top_builddir)\""
 
 .PHONY: demo
 demo: $(bin_PROGRAMS)
diff --git a/peas-demo/peas-demo.c b/peas-demo/peas-demo.c
index 7220fa7..94332d2 100644
--- a/peas-demo/peas-demo.c
+++ b/peas-demo/peas-demo.c
@@ -109,13 +109,16 @@ main (int    argc,
 
   g_option_context_free (option_context);
 
-  /* Ensure we pick the uninstalled plugin loaders if we're running from build dir */
   if (run_from_build_dir)
     {
-      g_debug ("Running from build dir.");
-      g_irepository_prepend_search_path ("../libpeas");
-      g_irepository_prepend_search_path ("../libpeas-gtk");
-      g_setenv ("PEAS_PLUGIN_LOADERS_DIR", "../loaders", TRUE);
+      g_debug ("Running from build directory: %s", PEAS_BUILDDIR);
+
+      /* Use the uninstalled typelibs */
+      g_irepository_prepend_search_path (PEAS_BUILDDIR "/libpeas");
+      g_irepository_prepend_search_path (PEAS_BUILDDIR "/libpeas-gtk");
+
+      /* Use the uninstalled plugin loaders */
+      g_setenv ("PEAS_PLUGIN_LOADERS_DIR", PEAS_BUILDDIR "/loaders", TRUE);
     }
 
   engine = peas_engine_get_default ();
@@ -129,7 +132,7 @@ main (int    argc,
   peas_engine_enable_loader (engine, "seed");
 
   if (run_from_build_dir)
-    peas_engine_add_search_path (engine, "./plugins", NULL);
+    peas_engine_add_search_path (engine, PEAS_BUILDDIR "/peas-demo/plugins", NULL);
   else
     peas_engine_add_search_path (engine,
                                  PEAS_LIBDIR "/peas-demo/plugins/",


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