source: wscript @ 10a5413

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

src/mathutils.c: add aubio_is_power_of_two and aubio_next_power_of_two

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