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 opt.tool_options('UnitTest')
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
45 if Options.options.target_platform:
46 Options.platform = Options.options.target_platform
48 if Options.platform == 'win32':
49 conf.env['shlib_PATTERN'] = 'lib%s.dll'
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')
57 # optionally use complex.h
58 if (Options.options.disable_complex == False):
59 conf.check(header_name='complex.h')
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')
67 # double precision mode
68 if (Options.options.enable_double == True):
69 conf.define('HAVE_AUBIO_DOUBLE', 1)
71 conf.define('HAVE_AUBIO_DOUBLE', 0)
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')
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')
83 conf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
84 args = '--cflags --libs')
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')
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')
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()
106 if (Options.options.enable_java == True):
107 conf.fatal('Java build not yet implemented')
108 conf.check_tool('java')
110 # check support for C99 __VA_ARGS__ macros
111 check_c99_varargs = '''
113 #define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
115 if conf.check_cc(fragment = check_c99_varargs,
117 msg = 'Checking for C99 __VA_ARGS__ macro'):
118 conf.define('HAVE_C99_VARARGS_MACROS', 1)
120 # write configuration header
121 conf.write_config_header('src/config.h')
123 # check for puredata header
124 conf.check(header_name='m_pd.h')
126 # add some defines used in examples
127 conf.define('AUBIO_PREFIX', conf.env['PREFIX'])
128 conf.define('PACKAGE', APPNAME)
130 # check if docbook-to-man is installed, optional
131 conf.find_program('docbook-to-man', var='DOCBOOKTOMAN', mandatory=False)
134 bld.env['VERSION'] = VERSION
135 bld.env['LIB_VERSION'] = LIB_VERSION
137 # add sub directories
138 bld.add_subdirs('src ext examples interfaces/cpp')
140 if bld.env['PYTHON']:
141 bld.add_subdirs('python/aubio python')
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'
151 # build manpages from sgml files
152 if bld.env['DOCBOOKTOMAN']:
154 TaskGen.declare_chain(
155 name = 'docbooktoman',
156 rule = '${DOCBOOKTOMAN} ${SRC} > ${TGT}',
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'))
165 if bld.env['HAVE_M_PD_H']:
166 bld.add_subdirs('plugins/puredata')
168 # install woodblock sound
169 bld.install_files('${PREFIX}/share/sounds/aubio/',
170 'sounds/woodblock.aiff')
172 # build and run the unit tests
175 bld.add_post_fun(UnitTest.summary)
180 # loop over all *.c filenames in tests/src to build them all
181 # target name is filename.c without the .c
182 def 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],
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']