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')
56 conf.check(header_name='limits.h')
58 # optionally use complex.h
59 if (Options.options.disable_complex == False):
60 conf.check(header_name='complex.h')
62 # required dependancies
63 conf.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
64 args = '--cflags --libs')
65 conf.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
66 args = '--cflags --libs')
68 # double precision mode
69 if (Options.options.enable_double == True):
70 conf.define('HAVE_AUBIO_DOUBLE', 1)
72 conf.define('HAVE_AUBIO_DOUBLE', 0)
74 # one of fftwf or fftw3f
75 if (Options.options.disable_fftw3f == True):
76 conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
77 args = '--cflags --libs')
79 # fftw3f not disabled, take most sensible one according to enable_double
80 if (Options.options.enable_double == True):
81 conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
82 args = '--cflags --libs')
84 conf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
85 args = '--cflags --libs')
87 # optional dependancies
88 if (Options.options.disable_jack == False):
89 conf.check_cfg(package = 'jack', atleast_version = '0.15.0',
90 args = '--cflags --libs')
91 if (Options.options.disable_lash == False):
92 conf.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
93 args = '--cflags --libs', uselib_store = 'LASH')
96 if conf.find_program('swig', var='SWIG', mandatory = False):
97 conf.check_tool('swig', tooldir='swig')
98 conf.check_swig_version('1.3.27')
101 if conf.find_program('python', mandatory = False):
102 conf.check_tool('python')
103 conf.check_python_version((2,4,2))
104 conf.check_python_headers()
107 if (Options.options.enable_java == True):
108 conf.fatal('Java build not yet implemented')
109 conf.check_tool('java')
111 # check support for C99 __VA_ARGS__ macros
112 check_c99_varargs = '''
114 #define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
116 if conf.check_cc(fragment = check_c99_varargs,
118 msg = 'Checking for C99 __VA_ARGS__ macro'):
119 conf.define('HAVE_C99_VARARGS_MACROS', 1)
121 # write configuration header
122 conf.write_config_header('src/config.h')
124 # check for puredata header
125 conf.check(header_name='m_pd.h')
127 # add some defines used in examples
128 conf.define('AUBIO_PREFIX', conf.env['PREFIX'])
129 conf.define('PACKAGE', APPNAME)
131 # check if docbook-to-man is installed, optional
132 conf.find_program('docbook-to-man', var='DOCBOOKTOMAN', mandatory=False)
135 bld.env['VERSION'] = VERSION
136 bld.env['LIB_VERSION'] = LIB_VERSION
138 # add sub directories
139 bld.add_subdirs('src examples interfaces/cpp')
141 if bld.env['PYTHON']:
142 bld.add_subdirs('python/aubio python')
146 # create the aubio.pc file for pkg-config
147 aubiopc = bld.new_task_gen('subst')
148 aubiopc.source = 'aubio.pc.in'
149 aubiopc.target = 'aubio.pc'
150 aubiopc.install_path = '${PREFIX}/lib/pkgconfig'
152 # build manpages from sgml files
153 if bld.env['DOCBOOKTOMAN']:
155 TaskGen.declare_chain(
156 name = 'docbooktoman',
157 rule = '${DOCBOOKTOMAN} ${SRC} > ${TGT}',
162 manpages = bld.new_task_gen(name = 'docbooktoman',
163 source=bld.path.ant_glob('doc/*.sgml'))
164 bld.install_files('${MANDIR}/man1', bld.path.ant_glob('doc/*.1'))
166 if bld.env['HAVE_M_PD_H']:
167 bld.add_subdirs('plugins/puredata')
169 # install woodblock sound
170 bld.install_files('${PREFIX}/share/sounds/aubio/',
171 'sounds/woodblock.aiff')
173 # build and run the unit tests
176 bld.add_post_fun(UnitTest.summary)
181 # loop over all *.c filenames in tests/src to build them all
182 # target name is filename.c without the .c
183 def build_tests(bld):
184 for target_name in bld.path.ant_glob('tests/src/**/*.c').split():
185 this_target = bld.new_task_gen(
186 features = 'cc cprogram test',
187 source = target_name,
188 target = target_name.split('.')[0],
190 defines = 'AUBIO_UNSTABLE_API=1',
191 uselib_local = 'aubio')
192 # phasevoc-jack also needs jack
193 if target_name.endswith('test-phasevoc-jack.c'):
194 this_target.includes = ['src', 'examples']
195 this_target.uselib_local = ['aubio']
196 this_target.uselib = ['JACK']
197 this_target.source += ' examples/jackio.c'