source: wscript @ ee36175

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretchpitchshiftsamplertimestretchyinfft+
Last change on this file since ee36175 was ee36175, checked in by Paul Brossier <piem@piem.org>, 11 years ago

wscript: update TODO, remove pd stuff

  • Property mode set to 100644
File size: 6.0 KB
Line 
1#! /usr/bin/python
2#
3#  - doc: add doxygen
4#  - tests: move to new unit test system
5
6APPNAME = 'aubio'
7VERSION = '0.3.3'
8LIB_VERSION = '2.1.1'
9srcdir = '.'
10blddir = 'build'
11
12def init(opt):
13  pass
14
15def set_options(opt):
16  opt.add_option('--enable-double', action='store_true', default=False,
17      help='compile aubio in double precision mode')
18  opt.add_option('--disable-fftw3f', action='store_true', default=False,
19      help='compile with fftw3 instead of fftw3f')
20  opt.add_option('--enable-complex', action='store_true', default=False,
21      help='compile with C99 complex')
22  opt.add_option('--disable-jack', action='store_true', default=False,
23      help='compile without jack support')
24  opt.add_option('--disable-lash', action='store_true', default=False,
25      help='compile without lash support')
26  opt.add_option('--enable-java', action='store_true', default=False,
27      help='compile with java support')
28  opt.add_option('--with-target-platform', type='string',
29      help='set target platform for cross-compilation', dest='target_platform')
30  opt.tool_options('compiler_cc')
31  opt.tool_options('compiler_cxx')
32  opt.tool_options('gnu_dirs')
33  opt.tool_options('UnitTest')
34
35def configure(conf):
36  import Options
37  conf.check_tool('compiler_cc')
38  conf.check_tool('compiler_cxx')
39  conf.check_tool('gnu_dirs') # helpful for autotools transition and .pc generation
40  conf.check_tool('misc') # needed for subst
41
42  if Options.options.target_platform:
43    Options.platform = Options.options.target_platform
44
45  if Options.platform == 'win32':
46    conf.env['shlib_PATTERN'] = 'lib%s.dll'
47
48  # check for required headers
49  conf.check(header_name='stdlib.h')
50  conf.check(header_name='stdio.h')
51  conf.check(header_name='math.h')
52  conf.check(header_name='string.h')
53  conf.check(header_name='limits.h')
54
55  # optionally use complex.h
56  if (Options.options.enable_complex == True):
57    conf.check(header_name='complex.h')
58
59  # required dependancies
60  conf.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
61    args = '--cflags --libs')
62  conf.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
63    args = '--cflags --libs')
64
65  # double precision mode
66  if (Options.options.enable_double == True):
67    conf.define('HAVE_AUBIO_DOUBLE', 1)
68  else:
69    conf.define('HAVE_AUBIO_DOUBLE', 0)
70
71  # one of fftwf or fftw3f
72  if (Options.options.disable_fftw3f == True):
73    conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
74        args = '--cflags --libs')
75  else:
76    # fftw3f not disabled, take most sensible one according to enable_double
77    if (Options.options.enable_double == True):
78      conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
79          args = '--cflags --libs')
80    else:
81      conf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
82          args = '--cflags --libs')
83
84  # optional dependancies
85  if (Options.options.disable_jack == False):
86    conf.check_cfg(package = 'jack', atleast_version = '0.15.0',
87    args = '--cflags --libs')
88  if (Options.options.disable_lash == False):
89    conf.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
90    args = '--cflags --libs', uselib_store = 'LASH')
91
92  # swig
93  if conf.find_program('swig', var='SWIG', mandatory = False):
94    conf.check_tool('swig', tooldir='swig')
95    conf.check_swig_version('1.3.27')
96
97    # python
98    if conf.find_program('python', mandatory = False):
99      conf.check_tool('python')
100      conf.check_python_version((2,4,2))
101      conf.check_python_headers()
102
103    # java
104    if (Options.options.enable_java == True):
105      conf.fatal('Java build not yet implemented')
106      conf.check_tool('java')
107
108  # check support for C99 __VA_ARGS__ macros
109  check_c99_varargs = '''
110#include <stdio.h>
111#define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
112'''
113  if conf.check_cc(fragment = check_c99_varargs,
114      type='cstaticlib',
115      msg = 'Checking for C99 __VA_ARGS__ macro'):
116    conf.define('HAVE_C99_VARARGS_MACROS', 1)
117
118  # write configuration header
119  conf.write_config_header('src/config.h')
120
121  # add some defines used in examples
122  conf.define('AUBIO_PREFIX', conf.env['PREFIX'])
123  conf.define('PACKAGE', APPNAME)
124
125  # check if docbook-to-man is installed, optional
126  conf.find_program('docbook-to-man', var='DOCBOOKTOMAN', mandatory=False)
127
128def build(bld):
129  bld.env['VERSION'] = VERSION
130  bld.env['LIB_VERSION'] = LIB_VERSION
131
132  # add sub directories
133  bld.add_subdirs('src examples')
134  if bld.env['SWIG']:
135    if bld.env['PYTHON']:
136      bld.add_subdirs('python/aubio python')
137    if bld.env['JAVA']:
138      pass
139
140  # create the aubio.pc file for pkg-config
141  aubiopc = bld.new_task_gen('subst')
142  aubiopc.source = 'aubio.pc.in'
143  aubiopc.target = 'aubio.pc'
144  aubiopc.install_path = '${PREFIX}/lib/pkgconfig'
145
146  # build manpages from sgml files
147  if bld.env['DOCBOOKTOMAN']:
148    import TaskGen
149    TaskGen.declare_chain(
150        name    = 'docbooktoman',
151        rule    = '${DOCBOOKTOMAN} ${SRC} > ${TGT}',
152        ext_in  = '.sgml',
153        ext_out = '.1',
154        reentrant = 0,
155    )
156    manpages = bld.new_task_gen(name = 'docbooktoman',
157        source=bld.path.ant_glob('doc/*.sgml'))
158    bld.install_files('${MANDIR}/man1', bld.path.ant_glob('doc/*.1'))
159
160  # install woodblock sound
161  bld.install_files('${PREFIX}/share/sounds/aubio/',
162      'sounds/woodblock.aiff')
163
164  # build and run the unit tests
165  build_tests(bld)
166  import UnitTest
167  bld.add_post_fun(UnitTest.summary)
168
169def shutdown(bld):
170  pass
171
172# loop over all *.c filenames in tests/src to build them all
173# target name is filename.c without the .c
174def build_tests(bld):
175  for target_name in bld.path.ant_glob('tests/src/**/*.c').split():
176    this_target = bld.new_task_gen(
177        features = 'cc cprogram test',
178        source = target_name,
179        target = target_name.split('.')[0],
180        includes = 'src',
181        defines = 'AUBIO_UNSTABLE_API=1',
182        uselib_local = 'aubio')
183    # phasevoc-jack also needs jack
184    if target_name.endswith('test-phasevoc-jack.c'):
185      this_target.includes = ['src', 'examples']
186      this_target.uselib_local = ['aubio']
187      this_target.uselib = ['JACK']
188      this_target.source += ' examples/jackio.c'
Note: See TracBrowser for help on using the repository browser.