[gtkmm-documentation/gtkmm-3-24] examples/meson.build: Don't use the bash command



commit 2df21a9cfc43baf8814f99f0d229190807866db3
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sun Feb 2 16:40:26 2020 +0100

    examples/meson.build: Don't use the bash command
    
    The bash command may not be available, e.g. in Windows.
    Use python instead of bash in 'ninja examples'.

 README                             | 2 +-
 examples/book/buildapp/meson.build | 5 +----
 examples/book/giomm/meson.build    | 6 ++----
 examples/book/meson.build          | 4 +---
 examples/book/treeview/meson.build | 4 +---
 examples/meson.build               | 5 ++++-
 examples/others/meson.build        | 4 +---
 7 files changed, 11 insertions(+), 19 deletions(-)
---
diff --git a/README b/README
index 9a60909..52bd79f 100644
--- a/README
+++ b/README
@@ -37,7 +37,7 @@ or (probably slower)
   $ ninja test
 
 Create a PDF file:
-  $ meson -Dbuild-pdf=true
+  $ meson configure -Dbuild-pdf=true
   $ ninja
 This requires that you have either the dblatex or the xmllint and docbook2pdf
 commands installed.
diff --git a/examples/book/buildapp/meson.build b/examples/book/buildapp/meson.build
index 2987452..3f97e84 100644
--- a/examples/book/buildapp/meson.build
+++ b/examples/book/buildapp/meson.build
@@ -63,7 +63,7 @@ foreach ex : examples_book_buildapp
   )
 
   stamp_file_name = ex_name + '_copy.stamp'
-  custom_target(stamp_file_name,
+  examples_targets += custom_target(stamp_file_name,
     input: exe_file,
     output: stamp_file_name,
     command: [
@@ -77,12 +77,9 @@ foreach ex : examples_book_buildapp
   )
 
   target_name = 'examples' / 'book' / 'buildapp' / stamp_file_name
-  examples_targets += target_name
-
   test('book_buildapp_' + ex_name, meson_backend,
     args: target_name,
     workdir: project_build_root,
     timeout: test_timeout
   )
 endforeach
-
diff --git a/examples/book/giomm/meson.build b/examples/book/giomm/meson.build
index c6b51eb..43733d8 100644
--- a/examples/book/giomm/meson.build
+++ b/examples/book/giomm/meson.build
@@ -41,7 +41,7 @@ foreach ex : examples_book_giomm
   )
 
   stamp_file_name = ex_name + '_copy.stamp'
-  custom_target(stamp_file_name,
+  examples_targets += custom_target(stamp_file_name,
     input: exe_file,
     output: stamp_file_name,
     command: [
@@ -54,10 +54,8 @@ foreach ex : examples_book_giomm
     build_by_default: build_examples_by_default
   )
 
-  target_name = 'examples' / 'book' / 'giomm' / stamp_file_name
-  examples_targets += target_name
-
   # These example programs build quite fast. No need for extra timeout time.
+  target_name = 'examples' / 'book' / 'giomm' / stamp_file_name
   test('book_giomm_' + ex_name, meson_backend,
     args: target_name,
     workdir: project_build_root
diff --git a/examples/book/meson.build b/examples/book/meson.build
index e4cb4b4..3599835 100644
--- a/examples/book/meson.build
+++ b/examples/book/meson.build
@@ -145,7 +145,7 @@ foreach ex : examples_book
   endif
 
   stamp_file_name = ex_name + '_copy.stamp'
-  custom_target(stamp_file_name,
+  examples_targets += custom_target(stamp_file_name,
     input: exe_file,
     output: stamp_file_name,
     command: [
@@ -159,8 +159,6 @@ foreach ex : examples_book
   )
 
   target_name = 'examples' / 'book' / stamp_file_name
-  examples_targets += target_name
-
   test('book_' + ex_name, meson_backend,
     args: target_name,
     workdir: project_build_root,
diff --git a/examples/book/treeview/meson.build b/examples/book/treeview/meson.build
index 3cc665d..9c5e3dd 100644
--- a/examples/book/treeview/meson.build
+++ b/examples/book/treeview/meson.build
@@ -47,7 +47,7 @@ foreach ex : examples_book_treeview
   )
 
   stamp_file_name = ex_name + '_copy.stamp'
-  custom_target(stamp_file_name,
+  examples_targets += custom_target(stamp_file_name,
     input: exe_file,
     output: stamp_file_name,
     command: [
@@ -61,8 +61,6 @@ foreach ex : examples_book_treeview
   )
 
   target_name = 'examples' / 'book' / 'treeview' / stamp_file_name
-  examples_targets += target_name
-
   test('book_treeview_' + ex_name, meson_backend,
     args: target_name,
     workdir: project_build_root,
diff --git a/examples/meson.build b/examples/meson.build
index 78d808a..e747a8a 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -34,6 +34,9 @@ examples_targets = []
 subdir('book')
 subdir('others')
 
+# 'ninja examples' builds all example programs.
+# alias_target(), added in Meson 0.52.0, is an alternative to run_target().
 run_target('examples',
-  command: ['bash', '-c', 'cd ' + project_build_root + '; ' + meson.backend() + ' ' + ' 
'.join(examples_targets)]
+  depends: examples_targets,
+  command: [ python3, '-c', '# Dummy program' ]
 )
diff --git a/examples/others/meson.build b/examples/others/meson.build
index 1472d05..231ff8f 100644
--- a/examples/others/meson.build
+++ b/examples/others/meson.build
@@ -47,7 +47,7 @@ foreach ex : examples_others
   )
 
   stamp_file_name = ex_name + '_copy.stamp'
-  custom_target(stamp_file_name,
+  examples_targets += custom_target(stamp_file_name,
     input: exe_file,
     output: stamp_file_name,
     command: [
@@ -61,8 +61,6 @@ foreach ex : examples_others
   )
 
   target_name = 'examples' / 'others' / stamp_file_name
-  examples_targets += target_name
-
   test('others_' + ex_name, meson_backend,
     args: target_name,
     workdir: project_build_root,


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