File: wscript_build

package info (click to toggle)
aubio 0.4.9-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,720 kB
  • sloc: python: 20,447; ansic: 20,127; makefile: 348; sh: 232
file content (37 lines) | stat: -rw-r--r-- 1,222 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# vim:set syntax=python:

import sys
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('\\', '\\\\')

b = bld(name='create_tests_source',
    rule=sys.executable + ' ${SRC} ${TGT}',
    source='create_tests_source.py',
    target=test_sound_target)
# use post() to create the task, keep a reference to it
b.post()
create_tests_source = b.tasks[0]

for source_file in programs_sources:
    target = os.path.basename(os.path.splitext(str(source_file))[0])
    a = bld(features = 'c cprogram test',
            source = source_file,
            target = target,
            includes = includes,
            use = uselib,
            install_path = None,
            defines = ['AUBIO_UNSTABLE_API=1',
                        'AUBIO_TESTS_SOURCE={}'.format(test_sound_abspath)]
       )
    a.post()
    # make sure the unit_test task runs *after* the source is created
    a.tasks[-1].set_run_after(create_tests_source)