fixes for 98% of all the warnings/errors reported by OS X gcc on tiger
[ardour.git] / libs / ardour / wscript
1 #!/usr/bin/env python
2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
4 import os
5 import re
6 import subprocess
7
8 # Version of this package (even if built as a child)
9 MAJOR = '3'
10 MINOR = '0'
11 MICRO = '0'
12 LIBARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
13
14 # Library version (UNIX style major, minor, micro)
15 # major increment <=> incompatible changes
16 # minor increment <=> compatible changes (additions)
17 # micro increment <=> no interface changes
18 LIBARDOUR_LIB_VERSION = '3.0.0'
19
20 # default state file version for this build
21 CURRENT_SESSION_FILE_VERSION = 3000
22
23 # Variables for 'waf dist'
24 APPNAME = 'libardour'
25 VERSION = LIBARDOUR_VERSION
26
27 # Mandatory variables
28 top = '.'
29 out = 'build'
30
31 path_prefix = 'libs/ardour/'
32
33 libardour_sources = [
34         'amp.cc',
35         'analyser.cc',
36         'audio_buffer.cc',
37         'audio_diskstream.cc',
38         'audio_library.cc',
39         'audio_playlist.cc',
40         'audio_playlist_importer.cc',
41         'audio_playlist_source.cc',
42         'audio_port.cc',
43         'audio_region_importer.cc',
44         'audio_track.cc',
45         'audio_track_importer.cc',
46         'audioanalyser.cc',
47         'audioengine.cc',
48         'audiofile_tagger.cc',
49         'audiofilesource.cc',
50         'audioregion.cc',
51         'audiosource.cc',
52         'auditioner.cc',
53         'automatable.cc',
54         'automation.cc',
55         'automation_control.cc',
56         'automation_list.cc',
57         'beats_frames_converter.cc',
58         'broadcast_info.cc',
59         'buffer.cc',
60         'buffer_manager.cc',
61         'buffer_set.cc',
62         'bundle.cc',
63         'butler.cc',
64         'callback.cc',
65         'capturing_processor.cc',
66         'chan_count.cc',
67         'chan_mapping.cc',
68         'configuration.cc',
69         'config_text.cc',
70         'control_protocol_manager.cc',
71         'control_protocol_search_path.cc',
72         'crossfade.cc',
73         'crossfade_binder.cc',
74         'cycle_timer.cc',
75         'data_type.cc',
76         'default_click.cc',
77         'debug.cc',
78         'delivery.cc',
79         'directory_names.cc',
80         'diskstream.cc',
81         'element_import_handler.cc',
82         'element_importer.cc',
83         'enums.cc',
84         'event_type_map.cc',
85         'export_channel.cc',
86         'export_channel_configuration.cc',
87         'export_failed.cc',
88         'export_filename.cc',
89         'export_format_base.cc',
90         'export_format_manager.cc',
91         'export_format_specification.cc',
92         'export_formats.cc',
93         'export_formats_search_path.cc',
94         'export_graph_builder.cc',
95         'export_handler.cc',
96         'export_preset.cc',
97         'export_profile_manager.cc',
98         'export_status.cc',
99         'export_timespan.cc',
100         'file_source.cc',
101         'filename_extensions.cc',
102         'filesystem_paths.cc',
103         'filter.cc',
104         'find_session.cc',
105         'gain.cc',
106         'globals.cc',
107         'graph.cc',
108         'graphnode.cc',
109         'import.cc',
110         'internal_return.cc',
111         'internal_send.cc',
112         'interpolation.cc',
113         'io.cc',
114         'io_processor.cc',
115         'jack_slave.cc',
116         'ladspa_plugin.cc',
117         'location.cc',
118         'location_importer.cc',
119         'meter.cc',
120         'midi_automation_list_binder.cc',
121         'midi_buffer.cc',
122         'midi_clock_slave.cc',
123         'midi_diskstream.cc',
124         'midi_model.cc',
125         'midi_patch_manager.cc',
126         'midi_playlist.cc',
127         'midi_playlist_source.cc',
128         'midi_port.cc',
129         'midi_region.cc',
130         'midi_ring_buffer.cc',
131         'midi_source.cc',
132         'midi_state_tracker.cc',
133         'midi_stretch.cc',
134         'midi_track.cc',
135         'midi_ui.cc',
136         'mix.cc',
137         'monitor_processor.cc',
138         'mtc_slave.cc',
139         'mtdm.cc',
140         'mute_master.cc',
141         'named_selection.cc',
142         'onset_detector.cc',
143         'operations.cc',
144         'pan_controllable.cc',
145         'pannable.cc',
146         'panner.cc',
147         'panner_manager.cc',
148         'panner_search_path.cc',
149         'panner_shell.cc',
150         'pcm_utils.cc',
151         'pi_controller.cc',
152         'playlist.cc',
153         'playlist_factory.cc',
154         'playlist_source.cc',
155         'plugin.cc',
156         'plugin_insert.cc',
157         'plugin_manager.cc',
158         'port.cc',
159         'port_insert.cc',
160         'port_set.cc',
161         'process_thread.cc',
162         'processor.cc',
163         'progress.cc',
164         'quantize.cc',
165         'rc_configuration.cc',
166         'recent_sessions.cc',
167         'region_factory.cc',
168         'resampled_source.cc',
169         'region.cc',
170         'return.cc',
171         'reverse.cc',
172         'route.cc',
173         'route_group.cc',
174         'route_group_member.cc',
175         'rb_effect.cc',
176         'send.cc',
177         'session.cc',
178         'session_butler.cc',
179         'session_click.cc',
180         'session_command.cc',
181         'session_configuration.cc',
182         'session_directory.cc',
183         'session_events.cc',
184         'session_export.cc',
185         'session_handle.cc',
186         'session_metadata.cc',
187         'session_midi.cc',
188         'session_object.cc',
189         'session_playlists.cc',
190         'session_process.cc',
191         'session_rtevents.cc',
192         'session_state.cc',
193         'session_state_utils.cc',
194         'session_time.cc',
195         'session_transport.cc',
196         'session_utils.cc',
197         'slave.cc',
198         'smf_source.cc',
199         'sndfile_helpers.cc',
200         'sndfileimportable.cc',
201         'sndfilesource.cc',
202         'source.cc',
203         'source_factory.cc',
204         'speakers.cc',
205         'strip_silence.cc',
206         'svn_revision.cc',
207         'tape_file_matcher.cc',
208         'template_utils.cc',
209         'tempo.cc',
210         'tempo_map_importer.cc',
211         'thread_buffers.cc',
212         'ticker.cc',
213         'track.cc',
214         'transient_detector.cc',
215         'unknown_processor.cc',
216         'user_bundle.cc',
217         'utils.cc',
218         'version.cc'
219 ]
220
221 def flac_supported():
222     cmd = subprocess.Popen ("sndfile-info testfile.flac",
223                             stdout = subprocess.PIPE,
224                             stderr = subprocess.STDOUT, shell = True)
225     out = cmd.communicate()[0].decode('utf-8');
226     return re.search ('unknown format', out) == None
227
228 def ogg_supported():
229     cmd = subprocess.Popen ("sndfile-info testfile.ogg",
230                             stdout = subprocess.PIPE,
231                             stderr = subprocess.STDOUT, shell = True)
232     out = cmd.communicate()[0].decode('utf-8');
233     return re.search ('unknown format', out) == None
234
235 def options(opt):
236     autowaf.set_options(opt)
237
238 def configure(conf):
239     conf.load('compiler_cxx')
240     conf.load('gas')
241     autowaf.build_version_files(
242         path_prefix + 'ardour/version.h',
243         path_prefix + 'version.cc',
244         'libardour3', MAJOR, MINOR, MICRO)
245     autowaf.configure(conf)
246     autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
247                       atleast_version='0.3.2')
248     autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
249                       atleast_version='0.118.2')
250     autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
251     autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
252                       atleast_version='0.4.0')
253     autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
254                       atleast_version='0.1.0')
255     autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
256                       atleast_version='2.0')
257     autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
258                       atleast_version='0.0.0', mandatory=False)
259     if conf.is_defined('HAVE_LILV'):
260         autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
261                           atleast_version='0.2.0', mandatory=False)
262     else:
263         autowaf.check_pkg(conf, 'slv2', uselib_store='SLV2',
264                           atleast_version='0.6.4', mandatory=False)
265         if conf.is_defined('HAVE_SLV2'):
266             autowaf.check_pkg(conf, 'rasqal', uselib_store='RASQAL',
267                               atleast_version='0.9.14', mandatory=False)
268     autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH',
269                       mandatory=False)
270     autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT',
271                       atleast_version='1.12.0', mandatory=False)
272     autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
273     autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
274                       atleast_version='1.2.1')
275     autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
276                       atleast_version='7.0.0')
277
278     # we don't try to detect this, since its part of our source tree
279
280     conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
281     conf.define('USE_RUBBERBAND', 1)  # controls whether we actually use it
282
283     conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
284
285     conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
286     conf.check(header_name='wordexp.h', define_name='HAVE_WORDEXP',mandatory=False)
287
288     conf.check(header_name='jack/session.h', uselib = [ 'JACK' ],
289                define_name='HAVE_JACK_SESSION')
290
291     conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
292
293     conf.check_cc(fragment = '''
294 #include <jack/jack.h>
295 void callback(jack_status_t code, const char* reason, void* arg) { return; }
296 int main(int argc, char **argv) {
297     jack_client_t* c;
298     jack_on_info_shutdown(c, callback, (void*) 0);
299     return 0;
300 }''',
301                   uselib= [ 'JACK' ],
302                   msg = 'Checking for jack_on_info_shutdown',
303                   define_name = 'HAVE_JACK_ON_INFO_SHUTDOWN',
304                   okmsg = 'present')
305
306     missing_jack_message = 'missing - a version of JACK that supports jack_port_set_latency_range() is required to compile Ardour3.'
307
308     conf.check_cc(fragment = '''
309 #include <jack/jack.h>
310 int main(int argc, char **argv) {
311     jack_port_t* p;
312     jack_latency_range_t r;
313     jack_port_set_latency_range(p, JackCaptureLatency, &r);
314     return 0;
315 }''',
316                   uselib = [ 'JACK' ],
317                   msg = 'Checking for new JACK latency API',
318                   okmsg = 'present',
319                   mandatory = True,
320                   errmsg = missing_jack_message)
321
322     conf.check_cc(fragment = '''
323 #include <jack/jack.h>
324 int main(int argc, char **argv) {
325    jack_port_type_get_buffer_size((jack_client_t*)0, "");
326    return 0;
327 }''',
328                   uselib = [ 'JACK' ],
329                   msg = 'Checking for new jack_port_type_get_buffer_size',
330                   okmsg = 'present',
331                   mandatory = True,
332                   errmsg = missing_jack_message)
333
334     if flac_supported():
335         conf.define ('HAVE_FLAC', 1)
336     if ogg_supported():
337         conf.define ('HAVE_OGG', 1)
338
339     if conf.is_defined('HAVE_LILV') or conf.is_defined('HAVE_SLV2'):
340         conf.define ('LV2_SUPPORT', 1)
341
342     conf.write_config_header('libardour-config.h', remove=False)
343
344     # Boost headers
345     autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
346     autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
347     autowaf.check_header(conf, 'cxx', 'boost/scoped_ptr.hpp')
348     autowaf.check_header(conf, 'cxx', 'boost/ptr_container/ptr_list.hpp')
349
350
351 def build(bld):
352     # Library
353     obj              = bld(features = 'c cxx cshlib cxxshlib')
354     obj.source       = libardour_sources
355     obj.export_includes = ['.']
356     obj.includes     = ['.', '../surfaces/control_protocol', '..']
357     obj.name         = 'libardour'
358     obj.target       = 'ardour'
359     obj.uselib       = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
360                         'JACK','SNDFILE','SAMPLERATE','LRDF','AUDIOUNIT',
361                         'OSX','BOOST','CURL','DL']
362     obj.use          = ['libpbd','libmidipp','libevoral','libvamphost',
363                         'libvampplugin','libtaglib','librubberband',
364                         'libaudiographer']
365     obj.vnum         = LIBARDOUR_LIB_VERSION
366     obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
367     obj.defines      = [
368         'PACKAGE="libardour3"',
369         'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
370         'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
371         'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
372         'LOCALEDIR="' + os.path.join(
373             os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
374         'VAMP_DIR="' + os.path.join(
375             os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"',
376         'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
377         ]
378
379     #obj.source += ' st_stretch.cc st_pitch.cc '
380     #obj.uselib += ' SOUNDTOUCH '
381     #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
382
383     if bld.is_defined('HAVE_LILV') :
384         obj.source += [ 'lv2_plugin_lilv.cc', 'lv2_event_buffer.cc',
385                         'uri_map.cc', 'rdff.c' ]
386         obj.uselib += ['LILV']
387         if bld.is_defined('HAVE_SUIL'):
388             obj.uselib += ['SUIL']
389     elif bld.is_defined('HAVE_SLV2'):
390         obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc',
391                         'uri_map.cc', 'rdff.c' ]
392         obj.uselib += ['SLV2','RASQAL']
393
394     if bld.is_defined('VST_SUPPORT'):
395         obj.source += [ 'vst_plugin.cc', 'session_vst.cc' ]
396         obj.includes += [ '../fst' ]
397         obj.defines += [ 'VST_SUPPORT' ]
398
399     if bld.is_defined('LXVST_SUPPORT'):
400         obj.source += [ 'lxvst_plugin.cc', 'session_lxvst.cc', 'vstfx.cc', 'vstfxwin.cc', 'vstfxinfofile.cc' ]
401         obj.defines += [ 'LXVST_SUPPORT' ]
402
403
404     if bld.is_defined('COREAUDIO'):
405         obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
406         obj.use    += ['libappleutility']
407         obj.source += [ 'audio_unit.cc' ]
408
409     if Options.options.fpu_optimization:
410         if (bld.env['build_target'] == 'i386'
411             or bld.env['build_target'] == 'i686'):
412             obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s' ]
413         elif bld.env['build_target'] == 'x86_64':
414             obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s' ]
415
416     # i18n
417     if bld.is_defined('ENABLE_NLS'):
418         mo_files = bld.path.ant_glob('po/*.mo')
419         for mo in mo_files:
420             lang = os.path.basename(mo).replace('.mo', '')
421             bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
422                                         lang, 'LC_MESSAGES', 'libardour3.mo'),
423                            mo)
424
425     if bld.is_defined('BUILD_TESTS') and bld.is_defined('HAVE_CPPUNIT'):
426         # Unit tests
427         testobj              = bld(features = 'cxx cxxprogram')
428         testobj.source       = '''
429                 test/bbt_test.cpp
430                 test/interpolation_test.cpp
431                 test/midi_clock_slave_test.cpp
432                 test/resampled_source.cc
433                 test/mantis_3356.cc
434                 test/testrunner.cpp
435         '''.split()
436         testobj.includes     = obj.includes + ['test', '../pbd']
437         testobj.uselib       = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
438                                 'SAMPLERATE','XML','LRDF','COREAUDIO']
439         testobj.use          = ['libpbd','libmidipp','libardour']
440         testobj.name         = 'libardour-tests'
441         testobj.target       = 'run-tests'
442         testobj.install_path = ''
443         testobj.defines      = [
444             'PACKAGE="libardour3test"',
445             'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
446             'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
447             'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
448             'LOCALEDIR="' + os.path.join(
449                 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
450             'VAMP_DIR="' + os.path.join(
451                 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
452             ]
453         if bld.is_defined('FPU_OPTIMIZATION'):
454             testobj.source += [ 'sse_functions_xmm.cc' ]
455             if (bld.env['build_target'] == 'i386'
456                 or bld.env['build_target'] == 'i686'):
457                 testobj.source += [ 'sse_functions.s' ]
458             elif bld.env['build_target'] == 'x86_64':
459                 testobj.source += [ 'sse_functions_64bit.s' ]
460
461 def shutdown():
462     autowaf.shutdown()
463
464 def i18n(bld):
465     autowaf.build_i18n (bld, '.', 'libs/ardour', APPNAME, libardour_sources)