[tests] add run_on_default_source_and_sink helper
[aubio.git] / examples / wscript_build
index dc169e1..7970bf6 100644 (file)
@@ -1,23 +1,27 @@
-# build examples
-sndfileio = bld.new_task_gen(features = 'c',
-    includes = '../src',
-    source = ['sndfileio.c'],
-    target = 'sndfileio')
+# vim:set syntax=python:
+
+import os.path
+
+uselib = ['aubio']
+uselib += ['JACK']
 
-utilsio = bld.new_task_gen(features = 'c',
-      includes = '../src',
-      add_objects = 'sndfileio',
-      source = ['utils.c', 'jackio.c'],
-      uselib = ['LASH', 'JACK', 'SNDFILE'],
-      target = 'utilsio')
+includes = ['../src']
+utils_source = ['utils.c', 'jackio.c']
+programs_source = ctx.path.ant_glob('*.c', excl = utils_source)
+
+# build examples
+bld(features = 'c',
+        source = utils_source,
+        includes = includes,
+        use = uselib,
+        target = 'utilsio')
 
 # loop over all *.c filenames in examples to build them all
-for target_name in bld.path.ant_glob('*.c', excl = ['utils.c', 'jackio.c', 'sndfileio.c']):
-  bld.new_task_gen(features = 'c cprogram',
-      add_objects = 'utilsio',
-      includes = '../src',
-      uselib = ['LASH', 'JACK', 'SNDFILE'],
-      use = ['aubio'],
-      source = target_name,
-      # program name is filename.c without the .c
-      target = str(target_name).split('.')[0])
+for source_file in programs_source:
+    target = os.path.basename(os.path.splitext(str(source_file))[0])
+    bld(features = 'c cprogram',
+            source = source_file,
+            target = target,
+            includes = includes,
+            use = uselib + ['utilsio'],
+       )