source: wscript @ 6ed0f4e

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

waf: update to 1.7.9

  • Property mode set to 100644
File size: 7.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'
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' to clean-up autotools files before using waf"
28    sys.exit(1)
29
30top = '.'
31out = 'build'
32
33def options(ctx):
34  ctx.add_option('--enable-double', action='store_true', default=False,
35      help='compile aubio in double precision mode')
36  ctx.add_option('--enable-fftw', action='store_true', default=False,
37      help='compile with ooura instead of fftw')
38  ctx.add_option('--enable-fftw3f', action='store_true', default=False,
39      help='compile with fftw3 instead of fftw3f')
40  ctx.add_option('--enable-complex', action='store_true', default=False,
41      help='compile with C99 complex')
42  ctx.add_option('--enable-jack', action='store_true', default=False,
43      help='compile with jack support')
44  ctx.add_option('--enable-lash', action='store_true', default=False,
45      help='compile with lash support')
46  ctx.add_option('--enable-sndfile', action='store_true', default=False,
47      help='compile with libsndfile support')
48  ctx.add_option('--enable-samplerate', action='store_true', default=False,
49      help='compile with libsamplerate support')
50  ctx.add_option('--enable-swig', action='store_true', default=False,
51      help='compile with swig support (obsolete)')
52  ctx.add_option('--with-target-platform', type='string',
53      help='set target platform for cross-compilation', dest='target_platform')
54  ctx.load('compiler_c')
55  ctx.load('waf_unit_test')
56
57def configure(ctx):
58  from waflib import Options
59  ctx.load('compiler_c')
60  ctx.load('waf_unit_test')
61  ctx.env.CFLAGS = ['-g', '-Wall', '-Wextra']
62
63  if Options.options.target_platform:
64    Options.platform = Options.options.target_platform
65
66  if Options.platform == 'win32':
67    ctx.env['shlib_PATTERN'] = 'lib%s.dll'
68
69  if Options.platform == 'darwin':
70    ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
71    ctx.env.LINKFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
72    ctx.env.CC = 'llvm-gcc-4.2'
73    ctx.env.LINK_CC = 'llvm-gcc-4.2'
74    ctx.env.FRAMEWORK = ['CoreFoundation', 'AudioToolbox']
75
76  # check for required headers
77  ctx.check(header_name='stdlib.h')
78  ctx.check(header_name='stdio.h')
79  ctx.check(header_name='math.h')
80  ctx.check(header_name='string.h')
81  ctx.check(header_name='limits.h')
82
83  # optionally use complex.h
84  if (Options.options.enable_complex == True):
85    ctx.check(header_name='complex.h')
86
87  # check dependencies
88  if (Options.options.enable_sndfile == True):
89    ctx.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
90      args = '--cflags --libs')
91  if (Options.options.enable_samplerate == True):
92      ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
93        args = '--cflags --libs')
94
95  # double precision mode
96  if (Options.options.enable_double == True):
97    ctx.define('HAVE_AUBIO_DOUBLE', 1)
98  else:
99    ctx.define('HAVE_AUBIO_DOUBLE', 0)
100
101  # check if pkg-config is installed, optional
102  try:
103    ctx.find_program('pkg-config', var='PKGCONFIG')
104  except ctx.errors.ConfigurationError:
105    ctx.msg('Could not find pkg-config', 'disabling fftw, jack, and lash')
106    ctx.msg('Could not find fftw', 'using ooura')
107
108  # optional dependancies using pkg-config
109  if ctx.env['PKGCONFIG']:
110
111    if (Options.options.enable_fftw == True or Options.options.enable_fftw3f == True):
112      # one of fftwf or fftw3f
113      if (Options.options.enable_fftw3f == True):
114        ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
115            args = '--cflags --libs')
116        if (Options.options.enable_double == True):
117          ctx.msg('Warning', 'fftw3f enabled, but aubio compiled in double precision!')
118      else:
119        # fftw3f not enabled, take most sensible one according to enable_double
120        if (Options.options.enable_double == True):
121          ctx.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
122              args = '--cflags --libs')
123        else:
124          ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
125              args = '--cflags --libs')
126      ctx.define('HAVE_FFTW3', 1)
127    else:
128      # fftw disabled, use ooura
129      ctx.msg('Checking for FFT implementation', 'ooura')
130      pass
131
132    if (Options.options.enable_jack == True):
133      ctx.check_cfg(package = 'jack', atleast_version = '0.15.0',
134      args = '--cflags --libs')
135
136    if (Options.options.enable_lash == True):
137      ctx.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
138      args = '--cflags --libs', uselib_store = 'LASH')
139
140  # swig
141  if (Options.options.enable_swig == True):
142    try:
143      ctx.find_program('swig', var='SWIG')
144    except ctx.errors.ConfigurationError:
145      ctx.to_log('swig was not found, not looking for (ignoring)')
146
147    if ctx.env['SWIG']:
148      ctx.check_tool('swig')
149      ctx.check_swig_version()
150
151      # python
152      if ctx.find_program('python'):
153        ctx.check_tool('python')
154        ctx.check_python_version((2,4,2))
155        ctx.check_python_headers()
156
157  # check support for C99 __VA_ARGS__ macros
158  check_c99_varargs = '''
159#include <stdio.h>
160#define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
161'''
162  if ctx.check_cc(fragment = check_c99_varargs,
163      type='cstlib',
164      msg = 'Checking for C99 __VA_ARGS__ macro'):
165    ctx.define('HAVE_C99_VARARGS_MACROS', 1)
166
167  # write configuration header
168  ctx.write_config_header('src/config.h')
169
170  # add some defines used in examples
171  ctx.define('AUBIO_PREFIX', ctx.env['PREFIX'])
172  ctx.define('PACKAGE', APPNAME)
173
174  # check if docbook-to-man is installed, optional
175  try:
176    ctx.find_program('docbook-to-man', var='DOCBOOKTOMAN')
177  except ctx.errors.ConfigurationError:
178    ctx.to_log('docbook-to-man was not found (ignoring)')
179
180def build(bld):
181  bld.env['VERSION'] = VERSION
182  bld.env['LIB_VERSION'] = LIB_VERSION
183
184  # add sub directories
185  bld.recurse('src examples tests')
186
187  """
188  # create the aubio.pc file for pkg-config
189  if ctx.env['TARGET_PLATFORM'] == 'linux':
190    aubiopc = ctx.new_task_gen('subst')
191    aubiopc.source = 'aubio.pc.in'
192    aubiopc.target = 'aubio.pc'
193    aubiopc.install_path = '${PREFIX}/lib/pkgconfig'
194
195  # build manpages from sgml files
196  if ctx.env['DOCBOOKTOMAN']:
197    import TaskGen
198    TaskGen.declare_chain(
199        name    = 'docbooktoman',
200        rule    = '${DOCBOOKTOMAN} ${SRC} > ${TGT}',
201        ext_in  = '.sgml',
202        ext_out = '.1',
203        reentrant = 0,
204    )
205    manpages = ctx.new_task_gen(name = 'docbooktoman',
206        source=ctx.path.ant_glob('doc/*.sgml'))
207    ctx.install_files('${MANDIR}/man1', ctx.path.ant_glob('doc/*.1'))
208
209  # install woodblock sound
210  bld.install_files('${PREFIX}/share/sounds/aubio/',
211      'sounds/woodblock.aiff')
212  """
Note: See TracBrowser for help on using the repository browser.