source: wscript @ 5c411dc

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

wscript: add --with-target-platform option for cross-compiling, change name from aubio-2.dll to libaubio-2.dll

  • Property mode set to 100644
File size: 5.3 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('--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-alsa', action='store_true', default=False,
28      help='compile without alsa 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  # one of fftwf or fftw3f
70  if (Options.options.disable_fftw3f == True):
71    conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
72    args = '--cflags --libs')
73  else:
74    conf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
75    args = '--cflags --libs')
76
77  # optional dependancies
78  if (Options.options.disable_jack == False):
79    conf.check_cfg(package = 'jack', atleast_version = '0.15.0',
80    args = '--cflags --libs')
81  if (Options.options.disable_alsa == False):
82    conf.check_cfg(package = 'alsa', atleast_version = '0.0.9',
83    args = '--cflags --libs')
84  if (Options.options.disable_lash == False):
85    conf.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
86    args = '--cflags --libs', uselib_store = 'LASH')
87
88  # swig
89  if conf.find_program('swig', var='SWIG', mandatory = False):
90    conf.check_tool('swig', tooldir='swig')
91    conf.check_swig_version('1.3.27')
92
93    # python
94    if conf.find_program('python', mandatory = False):
95      conf.check_tool('python')
96      conf.check_python_version((2,4,2))
97      conf.check_python_headers()
98
99    # java
100    if (Options.options.enable_java == True):
101      conf.fatal('Java build not yet implemented')
102      conf.check_tool('java')
103
104  # check support for C99 __VA_ARGS__ macros
105  check_c99_varargs = '''
106#include <stdio.h>
107#define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
108'''
109  if conf.check_cc(fragment = check_c99_varargs,
110      type='cstaticlib',
111      msg = 'Checking for C99 __VA_ARGS__ macro'):
112    conf.define('HAVE_C99_VARARGS_MACROS', 1)
113
114  # write configuration header
115  conf.write_config_header('src/config.h')
116
117  # check for puredata header
118  conf.check(header_name='m_pd.h')
119
120  # add some defines used in examples
121  conf.define('AUBIO_PREFIX', conf.env['PREFIX'])
122  conf.define('PACKAGE', APPNAME)
123
124  # check if docbook-to-man is installed, optional
125  conf.find_program('docbook-to-man', var='DOCBOOKTOMAN', mandatory=False)
126
127def build(bld):
128  bld.env['VERSION'] = VERSION
129  bld.env['LIB_VERSION'] = LIB_VERSION
130
131  # add sub directories
132  bld.add_subdirs('src ext examples cpp tests/src')
133  if bld.env['SWIG']:
134    if bld.env['PYTHON']:
135      bld.add_subdirs('python/aubio python')
136    if bld.env['JAVA']:
137      pass
138
139  # create the aubio.pc file for pkg-config
140  aubiopc = bld.new_task_gen('subst')
141  aubiopc.source = 'aubio.pc.in'
142  aubiopc.target = 'aubio.pc'
143  aubiopc.install_path = '${PREFIX}/lib/pkgconfig'
144
145  # build manpages from sgml files
146  if bld.env['DOCBOOKTOMAN']:
147    import TaskGen
148    TaskGen.declare_chain(
149        name    = 'docbooktoman',
150        rule    = '${DOCBOOKTOMAN} ${SRC} > ${TGT}',
151        ext_in  = '.sgml',
152        ext_out = '.1',
153        reentrant = 0,
154    )
155    manpages = bld.new_task_gen(name = 'docbooktoman',
156        source=bld.path.ant_glob('doc/*.sgml'))
157    bld.install_files('${MANDIR}/man1', bld.path.ant_glob('doc/*.1'))
158
159  if bld.env['HAVE_M_PD_H']:
160    bld.add_subdirs('plugins/puredata')
161
162  # install woodblock sound
163  bld.install_files('${PREFIX}/share/sounds/aubio/',
164      'sounds/woodblock.aiff')
165
166def shutdown(bld):
167  pass
168
169def check(bld):
170  ut = UnitTest.unit_test()
171  ut.change_to_testfile_dir = True
172  ut.run()
173  ut.print_results()
Note: See TracBrowser for help on using the repository browser.