source: wscript @ 729a3c0

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

add support for ooura so that aubio can be build without fftw

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