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
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 # include locally patched version of UnitTest until upstream incorporates patch
37 # see http://code.google.com/p/waf/issues/detail?id=542
38 opt.tool_options('UnitTest', tooldir='.')
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
47 if Options.options.target_platform:
48 Options.platform = Options.options.target_platform
50 if Options.platform == 'win32':
51 conf.env['shlib_PATTERN'] = 'lib%s.dll'
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')
59 # optionally use complex.h
60 if (Options.options.disable_complex == False):
61 conf.check(header_name='complex.h')
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')
69 # double precision mode
70 if (Options.options.enable_double == True):
71 conf.define('HAVE_AUBIO_DOUBLE', 1)
73 conf.define('HAVE_AUBIO_DOUBLE', 0)
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')
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')
85 conf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
86 args = '--cflags --libs')
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')
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')
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()
108 if (Options.options.enable_java == True):
109 conf.fatal('Java build not yet implemented')
110 conf.check_tool('java')
112 # check support for C99 __VA_ARGS__ macros
113 check_c99_varargs = '''
115 #define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
117 if conf.check_cc(fragment = check_c99_varargs,
119 msg = 'Checking for C99 __VA_ARGS__ macro'):
120 conf.define('HAVE_C99_VARARGS_MACROS', 1)
122 # write configuration header
123 conf.write_config_header('src/config.h')
125 # check for puredata header
126 conf.check(header_name='m_pd.h')
128 # add some defines used in examples
129 conf.define('AUBIO_PREFIX', conf.env['PREFIX'])
130 conf.define('PACKAGE', APPNAME)
132 # check if docbook-to-man is installed, optional
133 conf.find_program('docbook-to-man', var='DOCBOOKTOMAN', mandatory=False)
136 bld.env['VERSION'] = VERSION
137 bld.env['LIB_VERSION'] = LIB_VERSION
139 # add sub directories
140 bld.add_subdirs('src ext examples cpp')
142 if bld.env['PYTHON']:
143 bld.add_subdirs('python/aubio python')
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'
153 # build manpages from sgml files
154 if bld.env['DOCBOOKTOMAN']:
156 TaskGen.declare_chain(
157 name = 'docbooktoman',
158 rule = '${DOCBOOKTOMAN} ${SRC} > ${TGT}',
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'))
167 if bld.env['HAVE_M_PD_H']:
168 bld.add_subdirs('plugins/puredata')
170 # install woodblock sound
171 bld.install_files('${PREFIX}/share/sounds/aubio/',
172 'sounds/woodblock.aiff')
174 # build and run the unit tests
177 bld.add_post_fun(UnitTest.summary)
182 # loop over all *.c filenames in tests/src to build them all
183 # target name is filename.c without the .c
184 def build_tests(bld):
185 for target_name in bld.path.ant_glob('tests/src/**/*.c').split():
186 this_target = bld.new_task_gen(
187 features = 'cprogram cc test',
188 source = target_name,
189 target = target_name.split('.')[0],
192 uselib_local = 'aubio')
193 # phasevoc-jack also needs aubioext
194 if target_name.endswith('test-phasevoc-jack.c'):
195 this_target.includes = ['src', 'ext']
196 this_target.uselib_local = ['aubio', 'aubioext']