source: wscript @ e565c649

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

wscript: ask the user to run 'make distclean' before running waf

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