[gtk+/wip/meson: 111/181] meson: examples: update



commit c87674f5a0c4684275b6ac1be012e5057f4178f9
Author: Tim-Philipp Müller <tim centricular com>
Date:   Sun Mar 12 20:13:10 2017 +0000

    meson: examples: update
    
    Mostly style changes. Don't create resource source files
    with spaces in them, that's tempting our luck.

 examples/application1/meson.build  |   14 ++-------
 examples/application10/meson.build |   17 ++--------
 examples/application2/meson.build  |   20 +++----------
 examples/application3/meson.build  |   20 +++----------
 examples/application4/meson.build  |   20 +++----------
 examples/application5/meson.build  |   22 +++-----------
 examples/application6/meson.build  |   19 +++---------
 examples/application7/meson.build  |   17 ++--------
 examples/application8/meson.build  |   17 ++--------
 examples/application9/meson.build  |   17 ++--------
 examples/bp/meson.build            |   14 ++-------
 examples/builder.c                 |    5 +++
 examples/meson.build               |   54 ++++++++---------------------------
 13 files changed, 65 insertions(+), 191 deletions(-)
---
diff --git a/examples/application1/meson.build b/examples/application1/meson.build
index ae5620f..172c1d3 100644
--- a/examples/application1/meson.build
+++ b/examples/application1/meson.build
@@ -1,11 +1,3 @@
-
-
-app1 = executable(
-  'exampleapp',
-  'main.c',
-  'exampleapp.c',
-  'exampleapp.h',
-  'exampleappwin.c',
-  'exampleappwin.h',
-  dependencies: libgtk_dep
-)
+executable('exampleapp',
+  'exampleapp.c', 'exampleappwin.c', 'main.c',
+  dependencies: libgtk_dep)
diff --git a/examples/application10/meson.build b/examples/application10/meson.build
index ce842ae..ee07654 100644
--- a/examples/application10/meson.build
+++ b/examples/application10/meson.build
@@ -1,23 +1,14 @@
-
-app10_resources = gnome.compile_resources(
-  'exampleapp10 resources',
+app10_resources = gnome.compile_resources('exampleapp10 resources',
   'exampleapp.gresource.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
 app10_schemas = gnome.compile_schemas()
 
-
-app10 = executable(
-  'exampleapp10',
+executable('exampleapp10',
   'main.c',
   'exampleapp.c',
-  'exampleapp.h',
   'exampleappwin.c',
-  'exampleappwin.h',
   'exampleappprefs.c',
-  'exampleappprefs.h',
   app10_resources,
   app10_schemas,
-  dependencies: libgtk_dep
-)
+  dependencies: libgtk_dep)
diff --git a/examples/application2/meson.build b/examples/application2/meson.build
index 99deae6..5fb7770 100644
--- a/examples/application2/meson.build
+++ b/examples/application2/meson.build
@@ -1,17 +1,7 @@
-
-app2_resources = gnome.compile_resources(
-  'exampleapp2 resources',
+app2_resources = gnome.compile_resources('exampleapp2_resources',
   'exampleapp.gresource.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
-app2 = executable(
-  'exampleapp2',
-  'main.c',
-  'exampleapp.c',
-  'exampleapp.h',
-  'exampleappwin.c',
-  'exampleappwin.h',
-  app2_resources,
-  dependencies: libgtk_dep
-)
+executable('exampleapp2',
+  'exampleapp.c', 'exampleappwin.c', 'main.c', app2_resources,
+  dependencies: libgtk_dep)
diff --git a/examples/application3/meson.build b/examples/application3/meson.build
index f0cec4c..ce90523 100644
--- a/examples/application3/meson.build
+++ b/examples/application3/meson.build
@@ -1,17 +1,7 @@
-
-app3_resources = gnome.compile_resources(
-  'exampleapp3 resources',
+app3_resources = gnome.compile_resources('exampleapp3_resources',
   'exampleapp.gresource.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
-app3 = executable(
-  'exampleapp3',
-  'main.c',
-  'exampleapp.c',
-  'exampleapp.h',
-  'exampleappwin.c',
-  'exampleappwin.h',
-  app3_resources,
-  dependencies: libgtk_dep
-)
+executable('exampleapp3',
+  'exampleapp.c', 'exampleappwin.c', 'main.c', app3_resources,
+  dependencies: libgtk_dep)
diff --git a/examples/application4/meson.build b/examples/application4/meson.build
index 2ae1820..7070790 100644
--- a/examples/application4/meson.build
+++ b/examples/application4/meson.build
@@ -1,17 +1,7 @@
-
-app4_resources = gnome.compile_resources(
-  'exampleapp4 resources',
+app4_resources = gnome.compile_resources('exampleapp4_resources',
   'exampleapp.gresource.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
-app4 = executable(
-  'exampleapp4',
-  'main.c',
-  'exampleapp.c',
-  'exampleapp.h',
-  'exampleappwin.c',
-  'exampleappwin.h',
-  app4_resources,
-  dependencies: libgtk_dep
-)
+executable('exampleapp4',
+  'exampleapp.c', 'exampleappwin.c', 'main.c', app4_resources,
+  dependencies: libgtk_dep)
diff --git a/examples/application5/meson.build b/examples/application5/meson.build
index f0fed1c..22d12cb 100644
--- a/examples/application5/meson.build
+++ b/examples/application5/meson.build
@@ -1,21 +1,9 @@
-
-app5_resources = gnome.compile_resources(
-  'exampleapp5 resources',
+app5_resources = gnome.compile_resources('exampleapp5_resources',
   'exampleapp.gresource.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
 app5_schemas = gnome.compile_schemas()
 
-
-app5 = executable(
-  'exampleapp5',
-  'main.c',
-  'exampleapp.c',
-  'exampleapp.h',
-  'exampleappwin.c',
-  'exampleappwin.h',
-  app5_resources,
-  app5_schemas,
-  dependencies: libgtk_dep
-)
+executable('exampleapp5',
+  'exampleapp.c', 'exampleappwin.c', 'main.c', app5_resources, app5_schemas,
+  dependencies: libgtk_dep)
diff --git a/examples/application6/meson.build b/examples/application6/meson.build
index 2d923f3..4f9357c 100644
--- a/examples/application6/meson.build
+++ b/examples/application6/meson.build
@@ -1,23 +1,14 @@
-
-app6_resources = gnome.compile_resources(
-  'exampleapp6 resources',
+app6_resources = gnome.compile_resources('exampleapp6_resources',
   'exampleapp.gresource.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
 app6_schemas = gnome.compile_schemas()
 
-
-app6 = executable(
-  'exampleapp6',
-  'main.c',
+executable('exampleapp6',
   'exampleapp.c',
-  'exampleapp.h',
   'exampleappwin.c',
-  'exampleappwin.h',
+  'main.c',
   'exampleappprefs.c',
-  'exampleappprefs.h',
   app6_resources,
   app6_schemas,
-  dependencies: libgtk_dep
-)
+  dependencies: libgtk_dep)
diff --git a/examples/application7/meson.build b/examples/application7/meson.build
index cc32f36..2beed86 100644
--- a/examples/application7/meson.build
+++ b/examples/application7/meson.build
@@ -1,23 +1,14 @@
-
-app7_resources = gnome.compile_resources(
-  'exampleapp7 resources',
+app7_resources = gnome.compile_resources('exampleapp7_resources',
   'exampleapp.gresource.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
 app7_schemas = gnome.compile_schemas()
 
-
-app7 = executable(
-  'exampleapp7',
+executable('exampleapp7',
   'main.c',
   'exampleapp.c',
-  'exampleapp.h',
   'exampleappwin.c',
-  'exampleappwin.h',
   'exampleappprefs.c',
-  'exampleappprefs.h',
   app7_resources,
   app7_schemas,
-  dependencies: libgtk_dep
-)
+  dependencies: libgtk_dep)
diff --git a/examples/application8/meson.build b/examples/application8/meson.build
index 1192f4d..7981907 100644
--- a/examples/application8/meson.build
+++ b/examples/application8/meson.build
@@ -1,23 +1,14 @@
-
-app8_resources = gnome.compile_resources(
-  'exampleapp8 resources',
+app8_resources = gnome.compile_resources('exampleapp8 resources',
   'exampleapp.gresource.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
 app8_schemas = gnome.compile_schemas()
 
-
-app8 = executable(
-  'exampleapp8',
+executable('exampleapp8',
   'main.c',
   'exampleapp.c',
-  'exampleapp.h',
   'exampleappwin.c',
-  'exampleappwin.h',
   'exampleappprefs.c',
-  'exampleappprefs.h',
   app8_resources,
   app8_schemas,
-  dependencies: libgtk_dep
-)
+  dependencies: libgtk_dep)
diff --git a/examples/application9/meson.build b/examples/application9/meson.build
index fccee73..d872819 100644
--- a/examples/application9/meson.build
+++ b/examples/application9/meson.build
@@ -1,23 +1,14 @@
-
-app9_resources = gnome.compile_resources(
-  'exampleapp9 resources',
+app9_resources = gnome.compile_resources('exampleapp9_resources',
   'exampleapp.gresource.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
 app9_schemas = gnome.compile_schemas()
 
-
-app9 = executable(
-  'exampleapp9',
+executable('exampleapp9',
   'main.c',
   'exampleapp.c',
-  'exampleapp.h',
   'exampleappwin.c',
-  'exampleappwin.h',
   'exampleappprefs.c',
-  'exampleappprefs.h',
   app9_resources,
   app9_schemas,
-  dependencies: libgtk_dep
-)
+  dependencies: libgtk_dep)
diff --git a/examples/bp/meson.build b/examples/bp/meson.build
index a3f8280..5bf9b5d 100644
--- a/examples/bp/meson.build
+++ b/examples/bp/meson.build
@@ -1,13 +1,5 @@
-
-bp_resources = gnome.compile_resources(
-  'bloatpad resources',
+bp_resources = gnome.compile_resources('bloatpad_resources',
   'bloatpad.gresources.xml',
-  source_dir: '.'
-)
+  source_dir: '.')
 
-bloatpad = executable(
-  'bloatpad',
-  'bloatpad.c',
-  bp_resources,
-  dependencies: libgtk_dep
-)
+executable('bloatpad', 'bloatpad.c', bp_resources, dependencies: libgtk_dep)
diff --git a/examples/builder.c b/examples/builder.c
index d732068..eb97a7f 100644
--- a/examples/builder.c
+++ b/examples/builder.c
@@ -1,4 +1,5 @@
 #include <gtk/gtk.h>
+#include <glib/gstdio.h>
 
 static void
 print_hello (GtkWidget *widget,
@@ -15,6 +16,10 @@ main (int   argc,
   GObject *window;
   GObject *button;
 
+#ifdef GTK_SRCDIR
+  g_chdir (GTK_SRCDIR);
+#endif
+
   gtk_init ();
 
   /* Construct a GtkBuilder instance and load our UI description */
diff --git a/examples/meson.build b/examples/meson.build
index 79af2f8..09dc1bb 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -1,51 +1,23 @@
-builder_example = executable(
-  'builder_example',
-  'builder.c',
-  dependencies: libgtk_dep
-)
-
-drawing = executable(
+examples = [
+  'builder',
   'drawing',
-  'drawing.c',
-  dependencies: libgtk_dep
-)
-
-grid_packing = executable(
   'grid-packing',
-  'grid-packing.c',
-  dependencies: libgtk_dep
-)
-
-hello_world = executable(
   'hello-world',
-  'hello-world.c',
-  dependencies: libgtk_dep
-)
-
-plugman = executable(
   'plugman',
-  'plugman.c',
-  dependencies: libgtk_dep
-)
-
-search_bar = executable(
   'search-bar',
-  'search-bar.c',
-  dependencies: libgtk_dep
-)
-
-sunny = executable(
   'sunny',
-  'sunny.c',
-  dependencies: libgtk_dep
-)
-
-window_default = executable(
   'window-default',
-  'window-default.c',
-  dependencies: libgtk_dep
-)
-
+]
+
+foreach ex : examples
+  # TODO: name clash with testsuite/gtk/builder, rename one of the two
+  example_name = ex == 'builder' ? 'builder_example' : ex
+  executable(example_name, '@0@.c'.format(ex),
+    c_args : ['-DGDK_DISABLE_DEPRECATED',
+              '-DGTK_DISABLE_DEPRECATED',
+              '-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir())],
+    dependencies: libgtk_dep)
+endforeach
 
 subdir('bp')
 subdir('application1')


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