source: wscript @ 55ffa55

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

wscript: remove debug output

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