source: wscript @ d57c879

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

moved cpp to interfaces/

  • Property mode set to 100644
File size: 6.1 KB
Line 
1#! /usr/bin/python
2#
3# TODO
4#  - plugins/puredata: add pd compilation
5#  - java: add swig compilation
6#  - doc: add docbook2html and doxygen
7#  - tests: move to new unit test system
8
9APPNAME = 'aubio'
10VERSION = '0.3.3'
11LIB_VERSION = '2.1.1'
12srcdir = '.'
13blddir = 'build'
14
15def init(opt):
16  pass
17
18def set_options(opt):
19  opt.add_option('--enable-double', action='store_true', default=False,
20      help='compile aubio in double precision mode')
21  opt.add_option('--disable-fftw3f', action='store_true', default=False,
22      help='compile with fftw3 instead of fftw3f')
23  opt.add_option('--disable-complex', action='store_true', default=False,
24      help='compile without C99 complex')
25  opt.add_option('--disable-jack', action='store_true', default=False,
26      help='compile without jack support')
27  opt.add_option('--disable-lash', action='store_true', default=False,
28      help='compile without lash support')
29  opt.add_option('--enable-java', action='store_true', default=False,
30      help='compile with java support')
31  opt.add_option('--with-target-platform', type='string',
32      help='set target platform for cross-compilation', dest='target_platform')
33  opt.tool_options('compiler_cc')
34  opt.tool_options('compiler_cxx')
35  opt.tool_options('gnu_dirs')
36  opt.tool_options('UnitTest')
37
38def configure(conf):
39  import Options
40  conf.check_tool('compiler_cc')
41  conf.check_tool('compiler_cxx')
42  conf.check_tool('gnu_dirs') # helpful for autotools transition and .pc generation
43  conf.check_tool('misc') # needed for subst
44
45  if Options.options.target_platform:
46    Options.platform = Options.options.target_platform
47
48  if Options.platform == 'win32':
49    conf.env['shlib_PATTERN'] = 'lib%s.dll'
50
51  # check for required headers
52  conf.check(header_name='stdlib.h')
53  conf.check(header_name='stdio.h')
54  conf.check(header_name='math.h')
55  conf.check(header_name='string.h')
56
57  # optionally use complex.h
58  if (Options.options.disable_complex == False):
59    conf.check(header_name='complex.h')
60
61  # required dependancies
62  conf.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
63    args = '--cflags --libs')
64  conf.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
65    args = '--cflags --libs')
66
67  # double precision mode
68  if (Options.options.enable_double == True):
69    conf.define('HAVE_AUBIO_DOUBLE', 1)
70  else:
71    conf.define('HAVE_AUBIO_DOUBLE', 0)
72
73  # one of fftwf or fftw3f
74  if (Options.options.disable_fftw3f == True):
75    conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
76        args = '--cflags --libs')
77  else:
78    # fftw3f not disabled, take most sensible one according to enable_double
79    if (Options.options.enable_double == True):
80      conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
81          args = '--cflags --libs')
82    else:
83      conf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
84          args = '--cflags --libs')
85
86  # optional dependancies
87  if (Options.options.disable_jack == False):
88    conf.check_cfg(package = 'jack', atleast_version = '0.15.0',
89    args = '--cflags --libs')
90  if (Options.options.disable_lash == False):
91    conf.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
92    args = '--cflags --libs', uselib_store = 'LASH')
93
94  # swig
95  if conf.find_program('swig', var='SWIG', mandatory = False):
96    conf.check_tool('swig', tooldir='swig')
97    conf.check_swig_version('1.3.27')
98
99    # python
100    if conf.find_program('python', mandatory = False):
101      conf.check_tool('python')
102      conf.check_python_version((2,4,2))
103      conf.check_python_headers()
104
105    # java
106    if (Options.options.enable_java == True):
107      conf.fatal('Java build not yet implemented')
108      conf.check_tool('java')
109
110  # check support for C99 __VA_ARGS__ macros
111  check_c99_varargs = '''
112#include <stdio.h>
113#define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
114'''
115  if conf.check_cc(fragment = check_c99_varargs,
116      type='cstaticlib',
117      msg = 'Checking for C99 __VA_ARGS__ macro'):
118    conf.define('HAVE_C99_VARARGS_MACROS', 1)
119
120  # write configuration header
121  conf.write_config_header('src/config.h')
122
123  # check for puredata header
124  conf.check(header_name='m_pd.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
138  bld.add_subdirs('src ext examples interfaces/cpp')
139  if bld.env['SWIG']:
140    if bld.env['PYTHON']:
141      bld.add_subdirs('python/aubio python')
142    if bld.env['JAVA']:
143      pass
144
145  # create the aubio.pc file for pkg-config
146  aubiopc = bld.new_task_gen('subst')
147  aubiopc.source = 'aubio.pc.in'
148  aubiopc.target = 'aubio.pc'
149  aubiopc.install_path = '${PREFIX}/lib/pkgconfig'
150
151  # build manpages from sgml files
152  if bld.env['DOCBOOKTOMAN']:
153    import TaskGen
154    TaskGen.declare_chain(
155        name    = 'docbooktoman',
156        rule    = '${DOCBOOKTOMAN} ${SRC} > ${TGT}',
157        ext_in  = '.sgml',
158        ext_out = '.1',
159        reentrant = 0,
160    )
161    manpages = bld.new_task_gen(name = 'docbooktoman',
162        source=bld.path.ant_glob('doc/*.sgml'))
163    bld.install_files('${MANDIR}/man1', bld.path.ant_glob('doc/*.1'))
164
165  if bld.env['HAVE_M_PD_H']:
166    bld.add_subdirs('plugins/puredata')
167
168  # install woodblock sound
169  bld.install_files('${PREFIX}/share/sounds/aubio/',
170      'sounds/woodblock.aiff')
171
172  # build and run the unit tests
173  build_tests(bld)
174  import UnitTest
175  bld.add_post_fun(UnitTest.summary)
176
177def shutdown(bld):
178  pass
179
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):
183  for target_name in bld.path.ant_glob('tests/src/**/*.c').split():
184    this_target = bld.new_task_gen(
185        features = 'cc cprogram test',
186        source = target_name,
187        target = target_name.split('.')[0],
188        includes = 'src',
189        uselib_local = 'aubio')
190    # phasevoc-jack also needs aubioext
191    if target_name.endswith('test-phasevoc-jack.c'):
192      this_target.includes = ['src', 'ext']
193      this_target.uselib_local = ['aubio', 'aubioext']
Note: See TracBrowser for help on using the repository browser.