source: wscript @ 342e3807

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

ext/midi: remove all midi stuff borrowed from fluidsynth, now unused

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