[tests] [win] workaround to escape backslashes
[aubio.git] / tests / wscript_build
index 55dcbf2..7ae6449 100644 (file)
@@ -1,26 +1,30 @@
 # vim:set syntax=python:
 
-for target_name in ctx.path.ant_glob('src/**/*.c'):
-    uselib = []
-    uselib += ['FFTW3', 'FFTW3F']
-    uselib += ['SAMPLERATE']
-    uselib += ['SNDFILE']
-    uselib += ['AVCODEC']
-    uselib += ['AVFORMAT']
-    uselib += ['AVRESAMPLE']
-    uselib += ['AVUTIL']
-    uselib += ['JACK']
-    uselib += ['BLAS']
-    includes = ['../src', '.']
-    extra_source = []
+import os.path
 
+uselib = ['aubio']
+
+includes = ['../src', '.']
+programs_sources = ctx.path.ant_glob('src/**/*.c')
+
+test_sound_target = '44100Hz_44100f_sine441_stereo.wav'
+test_sound_abspath = bld.path.get_bld().make_node(test_sound_target)
+# workaround to double escape backslash characters on windows
+test_sound_abspath = str(test_sound_abspath).replace('\\', '\\\\')
+
+bld(name='create_tests_source',
+    rule='python ${SRC} ${TGT}',
+    source='create_tests_source.py',
+    target=test_sound_target)
+
+for source_file in programs_sources:
+    target = os.path.basename(os.path.splitext(str(source_file))[0])
     bld(features = 'c cprogram test',
-            lib = 'm',
-            uselib = uselib,
-            source = [target_name] + extra_source,
-            target = str(target_name).split('.')[0],
+            source = source_file,
+            target = target,
             includes = includes,
+            use = uselib,
             install_path = None,
-            defines = 'AUBIO_UNSTABLE_API=1',
-            cflags = ['-g'],
-            use = 'aubio')
+            defines = ['AUBIO_UNSTABLE_API=1',
+                        'AUBIO_TESTS_SOURCE={}'.format(test_sound_abspath)]
+       )