source: wscript @ 2a6e672

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

wscript: make jack, samplerate, and lash optional

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