source: wscript @ 7ce0701

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 7ce0701 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
RevLine 
[5c411dc]1#! /usr/bin/python
2#
[21ee709]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
[ee36175]11#  - doc: add doxygen
[000b090]12#  - tests: move to new unit test system
13
14APPNAME = 'aubio'
15VERSION = '0.3.3'
16LIB_VERSION = '2.1.1'
[46378b3]17top = '.'
18out = 'build'
[000b090]19
20def init(opt):
21  pass
22
[46378b3]23def options(opt):
[06d30f9]24  opt.add_option('--enable-double', action='store_true', default=False,
25      help='compile aubio in double precision mode')
[000b090]26  opt.add_option('--disable-fftw3f', action='store_true', default=False,
27      help='compile with fftw3 instead of fftw3f')
[62b8ab2]28  opt.add_option('--enable-complex', action='store_true', default=False,
29      help='compile with C99 complex')
[46378b3]30  opt.add_option('--enable-jack', action='store_true', default=False,
[2a6e672]31      help='compile with jack support')
[46378b3]32  opt.add_option('--enable-lash', action='store_true', default=False,
[2a6e672]33      help='compile with lash support')
[46378b3]34  opt.add_option('--enable-libsamplerate', action='store_true', default=False,
[2a6e672]35      help='compile with libsamplerate support')
[5c411dc]36  opt.add_option('--with-target-platform', type='string',
37      help='set target platform for cross-compilation', dest='target_platform')
[46378b3]38  opt.load('compiler_cc')
39  opt.load('compiler_cxx')
40  opt.load('gnu_dirs')
41  opt.load('waf_unit_test')
[000b090]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
[46378b3]49  conf.load('waf_unit_test')
[000b090]50
[5c411dc]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
[000b090]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')
[10a5413]62  conf.check(header_name='limits.h')
[000b090]63
64  # optionally use complex.h
[62b8ab2]65  if (Options.options.enable_complex == True):
[000b090]66    conf.check(header_name='complex.h')
67
[2e4fb04]68  # check dependencies
[000b090]69  conf.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
70    args = '--cflags --libs')
[46378b3]71  if (Options.options.enable_libsamplerate == True):
72      conf.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
[2e4fb04]73        args = '--cflags --libs')
[000b090]74
[06d30f9]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
[000b090]81  # one of fftwf or fftw3f
82  if (Options.options.disable_fftw3f == True):
83    conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
[06d30f9]84        args = '--cflags --libs')
[000b090]85  else:
[06d30f9]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')
[000b090]93
94  # optional dependancies
[46378b3]95  if (Options.options.enable_jack == True):
[000b090]96    conf.check_cfg(package = 'jack', atleast_version = '0.15.0',
97    args = '--cflags --libs')
[46378b3]98  if (Options.options.enable_lash == True):
[000b090]99    conf.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
100    args = '--cflags --libs', uselib_store = 'LASH')
101
102  # swig
[46378b3]103  if 0: #conf.find_program('swig', var='SWIG', mandatory = False):
[000b090]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,
[46378b3]119      type='cstlib',
[000b090]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
[e460e60]138  bld.add_subdirs('src examples')
[000b090]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
[f11d78d]167  # build and run the unit tests
168  build_tests(bld)
169
[000b090]170def shutdown(bld):
171  pass
172
[f11d78d]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):
[46378b3]176  for target_name in bld.path.ant_glob('tests/src/**/*.c'):
[f11d78d]177    this_target = bld.new_task_gen(
[46378b3]178        features = 'c cprogram test',
[f11d78d]179        source = target_name,
[46378b3]180        target = str(target_name).split('.')[0],
[f11d78d]181        includes = 'src',
[740f06b]182        defines = 'AUBIO_UNSTABLE_API=1',
[46378b3]183        use = 'aubio')
[740f06b]184    # phasevoc-jack also needs jack
[46378b3]185    if str(target_name).endswith('test-phasevoc-jack.c'):
[740f06b]186      this_target.includes = ['src', 'examples']
[46378b3]187      this_target.use = ['aubio']
[740f06b]188      this_target.uselib = ['JACK']
[46378b3]189      this_target.target += ' examples/jackio.c'
Note: See TracBrowser for help on using the repository browser.