source: wscript @ 5820107

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

wscript: parse VERSION from file

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