summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-03-12 20:13:10 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2017-05-03 15:10:53 +0100
commit3ac88fa6b65ddb7223cd6f6f66fbf504a9401a50 (patch)
tree9b1e84476fdbb04554081e83b6f8d3e2bfcf4efc /examples
parentd276cd47a5db26718f03b84ca3586a4fc5475f1b (diff)
downloadgtk+-3ac88fa6b65ddb7223cd6f6f66fbf504a9401a50.tar.gz
meson: examples: update
Mostly style changes. Don't create resource source files with spaces in them, that's tempting our luck.
Diffstat (limited to 'examples')
-rw-r--r--examples/application1/meson.build14
-rw-r--r--examples/application10/meson.build17
-rw-r--r--examples/application2/meson.build20
-rw-r--r--examples/application3/meson.build20
-rw-r--r--examples/application4/meson.build20
-rw-r--r--examples/application5/meson.build22
-rw-r--r--examples/application6/meson.build19
-rw-r--r--examples/application7/meson.build17
-rw-r--r--examples/application8/meson.build17
-rw-r--r--examples/application9/meson.build17
-rw-r--r--examples/bp/meson.build14
-rw-r--r--examples/builder.c5
-rw-r--r--examples/meson.build54
13 files changed, 65 insertions, 191 deletions
diff --git a/examples/application1/meson.build b/examples/application1/meson.build
index ae5620f07e..172c1d3b1c 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 ce842ae794..ee07654567 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 99deae6e12..5fb7770829 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 f0cec4c198..ce90523d46 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 2ae18200b2..7070790001 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 f0fed1ca59..22d12cb477 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 2d923f35a3..4f9357c706 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 cc32f36ad0..2beed866af 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 1192f4d688..7981907440 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 fccee738cb..d872819d74 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 a3f82802f5..5bf9b5d851 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 d732068383..eb97a7fc90 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 79af2f8440..09dc1bb5c1 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')