source: wscript @ 9d3fa49

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 9d3fa49 was f82aa09, checked in by Paul Brossier <piem@piem.org>, 15 years ago

wscript: remove java stuff

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