convert codebase to use Temporal for various time types
[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 sys
6 import re
7 import subprocess
8 import sys
9
10 # default state file version for this build
11 CURRENT_SESSION_FILE_VERSION = 5990
12
13 I18N_PACKAGE = 'ardour'
14
15 # Mandatory variables
16 top = '.'
17 out = 'build'
18
19 path_prefix = 'libs/ardour/'
20
21 libardour_sources = [
22         'amp.cc',
23         'analyser.cc',
24         'analysis_graph.cc',
25         'async_midi_port.cc',
26         'audio_backend.cc',
27         'audio_buffer.cc',
28         'audio_library.cc',
29         'audio_playlist.cc',
30         'audio_playlist_importer.cc',
31         'audio_playlist_source.cc',
32         'audio_port.cc',
33         'audio_region_importer.cc',
34         'audio_track.cc',
35         'audio_track_importer.cc',
36         'audioanalyser.cc',
37         'audioengine.cc',
38         'audiofile_tagger.cc',
39         'audiofilesource.cc',
40         'audioregion.cc',
41         'audiosource.cc',
42         'auditioner.cc',
43         'automatable.cc',
44         'automation.cc',
45         'automation_control.cc',
46         'automation_list.cc',
47         'automation_watch.cc',
48         'beats_samples_converter.cc',
49         'broadcast_info.cc',
50         'buffer.cc',
51         'buffer_manager.cc',
52         'buffer_set.cc',
53         'bundle.cc',
54         'butler.cc',
55         'capturing_processor.cc',
56         'chan_count.cc',
57         'chan_mapping.cc',
58         'config_text.cc',
59         'controllable_descriptor.cc',
60         'control_group.cc',
61         'control_protocol_manager.cc',
62         'cycle_timer.cc',
63         'data_type.cc',
64         'default_click.cc',
65         'debug.cc',
66         'delayline.cc',
67         'delivery.cc',
68         'directory_names.cc',
69         'disk_io.cc',
70         'disk_reader.cc',
71         'disk_writer.cc',
72         'dsp_filter.cc',
73         'ebur128_analysis.cc',
74         'element_import_handler.cc',
75         'element_importer.cc',
76         'engine_slave.cc',
77         'enums.cc',
78         'event_type_map.cc',
79         'export_channel.cc',
80         'export_channel_configuration.cc',
81         'export_failed.cc',
82         'export_filename.cc',
83         'export_format_base.cc',
84         'export_format_manager.cc',
85         'export_format_specification.cc',
86         'export_formats.cc',
87         'export_graph_builder.cc',
88         'export_handler.cc',
89         'export_preset.cc',
90         'export_profile_manager.cc',
91         'export_status.cc',
92         'export_timespan.cc',
93         'file_source.cc',
94         'filename_extensions.cc',
95         'filesystem_paths.cc',
96         'filter.cc',
97         'find_session.cc',
98         'fixed_delay.cc',
99         'fluid_synth.cc',
100         'gain_control.cc',
101         'globals.cc',
102         'graph.cc',
103         'graphnode.cc',
104         'iec1ppmdsp.cc',
105         'iec2ppmdsp.cc',
106         'import.cc',
107         'instrument_info.cc',
108         'internal_return.cc',
109         'internal_send.cc',
110         'interpolation.cc',
111         'io.cc',
112         'io_processor.cc',
113         'kmeterdsp.cc',
114         'ladspa_plugin.cc',
115         'legatize.cc',
116         'location.cc',
117         'location_importer.cc',
118         'ltc_file_reader.cc',
119         'ltc_slave.cc',
120         'lua_api.cc',
121         'luabindings.cc',
122         'luaproc.cc',
123         'luascripting.cc',
124         'meter.cc',
125         'midi_automation_list_binder.cc',
126         'midi_buffer.cc',
127         'midi_channel_filter.cc',
128         'midi_clock_slave.cc',
129         'midi_model.cc',
130         'midi_patch_manager.cc',
131         'midi_playlist.cc',
132         'midi_playlist_source.cc',
133         'midi_port.cc',
134         'midi_region.cc',
135         'midi_ring_buffer.cc',
136         'midi_scene_change.cc',
137         'midi_scene_changer.cc',
138         'midi_source.cc',
139         'midi_state_tracker.cc',
140         'midi_stretch.cc',
141         'midi_track.cc',
142         'midi_ui.cc',
143         'mididm.cc',
144         'midiport_manager.cc',
145         'mix.cc',
146         'mode.cc',
147         'monitor_control.cc',
148         'monitor_processor.cc',
149         'mtc_slave.cc',
150         'mtdm.cc',
151         'muteable.cc',
152         'mute_control.cc',
153         'mute_master.cc',
154         'note_fixer.cc',
155         'onset_detector.cc',
156         'operations.cc',
157         'pan_controllable.cc',
158         'pannable.cc',
159         'panner.cc',
160         'panner_manager.cc',
161         'panner_shell.cc',
162         'parameter_descriptor.cc',
163         'pcm_utils.cc',
164         'phase_control.cc',
165         'playlist.cc',
166         'playlist_factory.cc',
167         'playlist_source.cc',
168         'plugin.cc',
169         'plugin_insert.cc',
170         'plugin_manager.cc',
171         'port.cc',
172         'port_insert.cc',
173         'port_manager.cc',
174         'port_set.cc',
175         'presentation_info.cc',
176         'process_thread.cc',
177         'processor.cc',
178         'progress.cc',
179         'quantize.cc',
180         'rc_configuration.cc',
181         'readonly_control.cc',
182         'recent_sessions.cc',
183         'record_enable_control.cc',
184         'record_safe_control.cc',
185         'region_factory.cc',
186         'resampled_source.cc',
187         'region.cc',
188         'return.cc',
189         'reverse.cc',
190         'route.cc',
191         'route_graph.cc',
192         'route_group.cc',
193         'route_group_member.cc',
194         'rb_effect.cc',
195         'scene_change.cc',
196         'search_paths.cc',
197         'selection.cc',
198         'send.cc',
199         'session.cc',
200         'session_butler.cc',
201         'session_click.cc',
202         'session_command.cc',
203         'session_configuration.cc',
204         'session_directory.cc',
205         'session_events.cc',
206         'session_export.cc',
207         'session_handle.cc',
208         'session_ltc.cc',
209         'session_metadata.cc',
210         'session_midi.cc',
211         'session_object.cc',
212         'session_playlists.cc',
213         'session_process.cc',
214         'session_rtevents.cc',
215         'session_state.cc',
216         'session_state_utils.cc',
217         'session_time.cc',
218         'session_transport.cc',
219         'sidechain.cc',
220         'slave.cc',
221         'slavable.cc',
222         'slavable_automation_control.cc',
223         'smf_source.cc',
224         'sndfile_helpers.cc',
225         'sndfileimportable.cc',
226         'sndfilesource.cc',
227         'solo_control.cc',
228         'solo_isolate_control.cc',
229         'solo_safe_control.cc',
230         'soundcloud_upload.cc',
231         'source.cc',
232         'source_factory.cc',
233         'speakers.cc',
234         'srcfilesource.cc',
235         'stripable.cc',
236         'strip_silence.cc',
237         'system_exec.cc',
238         'revision.cc',
239         'tape_file_matcher.cc',
240         'template_utils.cc',
241         'tempo.cc',
242         'tempo_map_importer.cc',
243         'thread_buffers.cc',
244         'ticker.cc',
245         'track.cc',
246         'transient_detector.cc',
247         'transform.cc',
248         'transpose.cc',
249         'unknown_processor.cc',
250         'user_bundle.cc',
251         'utils.cc',
252         'vca.cc',
253         'vca_manager.cc',
254         'vumeterdsp.cc',
255         'worker.cc'
256 ]
257
258 def flac_supported():
259     cmd = subprocess.Popen ("sndfile-info testfile.flac",
260                             stdout = subprocess.PIPE,
261                             stderr = subprocess.STDOUT, shell = True)
262     out = cmd.communicate()[0].decode('utf-8');
263     return re.search ('unknown format', out) == None
264
265 def ogg_supported():
266     cmd = subprocess.Popen ("sndfile-info testfile.ogg",
267                             stdout = subprocess.PIPE,
268                             stderr = subprocess.STDOUT, shell = True)
269     out = cmd.communicate()[0].decode('utf-8');
270     return re.search ('unknown format', out) == None
271
272 def options(opt):
273     autowaf.set_options(opt)
274
275 def configure(conf):
276     conf.load('compiler_cxx')
277     conf.load('gas')
278     # we don't use hard-coded micro versions with ardour, so hard code it to zero
279     autowaf.configure(conf)
280     autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
281                       atleast_version='0.3.2')
282     autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO4',
283                       atleast_version='0.4.0', mandatory=False)
284     autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
285     if Options.options.dist_target != 'mingw':
286         if not Options.options.no_lrdf:
287             autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
288                               atleast_version='0.4.0')
289         autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
290                           atleast_version='0.3.2')
291     autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
292                       atleast_version='0.1.0')
293     autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
294                       atleast_version='2.0')
295
296     if Options.options.lv2:
297         autowaf.check_pkg(conf, 'lv2', uselib_store='LV2',
298                           atleast_version='1.0.0', mandatory=True)
299         autowaf.check_pkg(conf, 'lv2', uselib_store='LV2_1_2_0',
300                           atleast_version='1.2.0', mandatory=False)
301         autowaf.check_pkg(conf, 'lv2', uselib_store='LV2_1_10_0',
302                           atleast_version='1.10.0', mandatory=False)
303         autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD',
304                           atleast_version='0.14.0', mandatory=True)
305         autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD',
306                           atleast_version='0.8.0', mandatory=True)
307         autowaf.check_pkg(conf, 'sratom-0', uselib_store='SRATOM',
308                           atleast_version='0.2.0', mandatory=True)
309         autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
310                           atleast_version='0.14.0', mandatory=True)
311         autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV_0_16_0',
312                           atleast_version='0.16.0', mandatory=False)
313         autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV_0_19_2',
314                           atleast_version='0.19.2', mandatory=False)
315         autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV_0_21_3',
316                           atleast_version='0.21.3', mandatory=False)
317         autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
318                           atleast_version='0.6.0', mandatory=False)
319         conf.define ('LV2_SUPPORT', 1)
320
321     # non-standard LV2 extention -- TODO: add option to disable??
322     if conf.is_defined ('HAVE_LV2_1_10_0'):
323         conf.define ('LV2_EXTENDED', 1)
324
325 #    autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH',
326 #                      mandatory=False)
327     autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT',
328                       atleast_version='1.12.0', mandatory=False)
329     autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
330     autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
331                       atleast_version='1.2.1')
332     autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
333                       atleast_version='7.0.0')
334
335     # controls whether we actually use it in preference to soundtouch
336     # Note: as of 2104, soundtouch (WSOLA) has been out-of-use for years.
337     conf.define('USE_RUBBERBAND', 1)
338
339     conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
340
341     conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
342     conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False)
343
344     conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
345
346     if flac_supported():
347         conf.define ('HAVE_FLAC', 1)
348     if ogg_supported():
349         conf.define ('HAVE_OGG', 1)
350
351     conf.write_config_header('libardour-config.h', remove=False)
352
353     # Boost headers
354     autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
355     autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
356     autowaf.check_header(conf, 'cxx', 'boost/scoped_ptr.hpp')
357     autowaf.check_header(conf, 'cxx', 'boost/ptr_container/ptr_list.hpp')
358     if conf.env['WINDOWS_VST_SUPPORT'] == True and Options.options.dist_target == 'mingw':
359         conf.check(compiler='cxx',
360                    lib='gdi32',
361                    mandatory=True,
362                    uselib_store='GDI32')
363
364
365 def build(bld):
366     # Library version (UNIX style major, minor, micro)
367     # major increment <=> incompatible changes
368     # minor increment <=> compatible changes (additions)
369     # micro increment <=> no interface changes
370     LIBARDOUR_LIB_VERSION = "3.0.0"
371
372     # operate on copy to avoid adding sources twice
373     sources = list(libardour_sources)
374     if bld.is_tracks_build():
375         sources += [ 'engine_state_controller.cc' ]
376
377     # Library
378     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
379         obj              = bld.shlib(features = 'c cxx cshlib cxxshlib', source=sources)
380         # macros for this shared library
381         obj.defines      = [ 'LIBARDOUR_DLL_EXPORTS=1' ]
382     else:
383         obj              = bld.stlib(features = 'c cxx cstlib cxxstlib', source=sources)
384         obj.cxxflags     = [  bld.env['compiler_flags_dict']['pic'] ]
385         obj.cflags       = [ bld.env['compiler_flags_dict']['pic'] ]
386         obj.defines      = []
387
388     obj.export_includes = ['.']
389     obj.includes     = ['.', '../surfaces/control_protocol', '..']
390     obj.name         = 'libardour'
391     obj.target       = 'ardour'
392     obj.uselib       = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID', 'LO',
393                         'SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS', 'GIOMM',
394                         'OSX','BOOST','CURL','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND']
395     obj.use          = ['libpbd','libmidipp','libevoral',
396                         'libaudiographer',
397                         'libtemporal',
398                         'liblua',
399                         ]
400     if bld.env['build_target'] != 'mingw':
401         obj.uselib += ['DL']
402     if bld.is_defined('USE_EXTERNAL_LIBS'):
403         obj.uselib.extend(['VAMPSDK', 'LIBLTC', 'LIBFLUIDSYNTH'])
404     else:
405         obj.use.extend(['librubberband', 'libltc_includes', 'libltc', 'libfluidsynth_includes', 'libfluidsynth'])
406
407     obj.vnum         = LIBARDOUR_LIB_VERSION
408     obj.install_path = bld.env['LIBDIR']
409     obj.defines      += [
410         'PACKAGE="' + I18N_PACKAGE + str(bld.env['MAJOR']) + '"',
411         'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
412         'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
413         'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
414         'LIBARDOUR="' + bld.env['lwrcase_dirname'] + '"'
415         ]
416
417     #obj.source += ' st_stretch.cc st_pitch.cc '
418     #obj.uselib += ' SOUNDTOUCH '
419     #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
420
421     if bld.is_defined('HAVE_LILV') :
422         obj.source += ['lv2_plugin.cc', 'lv2_evbuf.c', 'uri_map.cc']
423         obj.uselib += ['LILV']
424         if bld.is_defined('HAVE_SUIL'):
425             obj.uselib += ['SUIL']
426
427     if bld.is_defined('WINDOWS_VST_SUPPORT'):
428         obj.source += [ 'windows_vst_plugin.cc']
429         obj.includes += [ '../fst' ]
430         obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
431         if bld.env['build_target'] == 'mingw':
432             obj.use += [ 'vstwin' ]
433             obj.uselib += ['GDI32']
434
435     if bld.is_defined('LXVST_SUPPORT'):
436         obj.source += [ 'lxvst_plugin.cc', 'linux_vst_support.cc' ]
437         obj.defines += [ 'LXVST_SUPPORT' ]
438
439     if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT') or bld.is_defined('MACVST_SUPPORT'):
440         obj.source += [ 'session_vst.cc', 'vst_plugin.cc', 'vst_info_file.cc', 'vst_state.cc' ]
441
442     if bld.is_defined('MACVST_SUPPORT'):
443         obj.source += [ 'mac_vst_plugin.cc', 'mac_vst_support.cc' ]
444         obj.defines += [ 'MACVST_SUPPORT' ]
445
446     if bld.is_defined('HAVE_COREAUDIO'):
447         obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
448         obj.use    += ['libappleutility']
449
450     if bld.is_defined('AUDIOUNIT_SUPPORT'):
451         obj.source += [ 'audio_unit.cc' ]
452
453     avx_sources = []
454
455     if Options.options.fpu_optimization:
456         if (bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686'):
457             obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s', ]
458             avx_sources = [ 'sse_functions_avx_linux.cc' ]
459         elif bld.env['build_target'] == 'x86_64':
460             obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s', ]
461             avx_sources = [ 'sse_functions_avx_linux.cc' ]
462         elif bld.env['build_target'] == 'mingw':
463                 # usability of the 64 bit windows assembler depends on the compiler target,
464                 # not the build host, which in turn can only be inferred from the name
465                 # of the compiler.
466                 if re.search ('x86_64-w64', str(bld.env['CC'])):
467                         obj.source += [ 'sse_functions_xmm.cc' ]
468                         obj.source += [ 'sse_functions_64bit_win.s',  'sse_avx_functions_64bit_win.s' ]
469                         avx_sources = [ 'sse_functions_avx.cc' ]
470
471         if avx_sources:
472             # as long as we want to use AVX intrinsics in this file,
473             # compile it with -mavx flag - append avx flag to the existing
474             avx_cxxflags = list(bld.env['CXXFLAGS'])
475             avx_cxxflags.append (bld.env['compiler_flags_dict']['avx'])
476             avx_cxxflags.append (bld.env['compiler_flags_dict']['pic'])
477             bld(features = 'cxx',
478                 source   = avx_sources,
479                 cxxflags = avx_cxxflags,
480                 includes = [ '.' ],
481                 use = [ 'libtemporal', 'libpbd', 'libevoral', 'liblua' ],
482                 uselib = [ 'GLIBMM', 'XML' ],
483                 target   = 'sse_avx_functions')
484
485             obj.use += ['sse_avx_functions' ]
486
487     # i18n
488     if bld.is_defined('ENABLE_NLS'):
489         mo_files = bld.path.ant_glob('po/*.mo')
490         for mo in mo_files:
491             lang = os.path.basename(mo.srcpath()).replace('.mo', '')
492             bld.install_as(os.path.join(bld.env['LOCALEDIR'], lang, 'LC_MESSAGES', I18N_PACKAGE + str(bld.env['MAJOR']) + '.mo'),
493                            mo)
494
495     if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
496         # Unit tests
497         # only build these common sources once
498         testcommon              = bld(features = 'cxx')
499         testcommon.includes     = obj.includes + ['test', '../pbd', '..']
500         testcommon.source       = ['test/testrunner.cc', 'test/test_needing_session.cc',
501                                    'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc', 'test/test_ui.cc']
502         testcommon.uselib       = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
503                                    'SAMPLERATE','XML','LRDF','COREAUDIO','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND']
504         testcommon.use          = ['libpbd','libmidipp','libevoral',
505                                    'libaudiographer','libardour']
506         if bld.is_defined('USE_EXTERNAL_LIBS'):
507             testcommon.uselib.extend(['LIBLTC', 'LIBFLUIDSYNTH'])
508         else:
509             testcommon.use.extend(['libltc', 'librubberband', 'libfluidsynth'])
510         testcommon.defines      = [
511             'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'test"',
512             'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
513             'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
514             'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
515             ]
516         testcommon.name         = 'testcommon'
517
518         if bld.env['SINGLE_TESTS']:
519             create_ardour_test_program(bld, obj.includes, 'audio_engine_test', 'test_audio_engine', ['test/audio_engine_test.cc'])
520             create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
521             create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
522             create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
523             create_ardour_test_program(bld, obj.includes, 'interpolation', 'test_interpolation', ['test/interpolation_test.cc'])
524             create_ardour_test_program(bld, obj.includes, 'lua_script', 'test_lua_script', ['test/lua_script_test.cc'])
525             create_ardour_test_program(bld, obj.includes, 'midi_clock_slave', 'test_midi_clock_slave', ['test/midi_clock_slave_test.cc'])
526             create_ardour_test_program(bld, obj.includes, 'resampled_source', 'test_resampled_source', ['test/resampled_source_test.cc'])
527             create_ardour_test_program(bld, obj.includes, 'samplewalk_to_beats', 'test_samplewalk_to_beats', ['test/samplewalk_to_beats_test.cc'])
528             create_ardour_test_program(bld, obj.includes, 'samplepos_plus_beats', 'test_samplepos_plus_beats', ['test/samplepos_plus_beats_test.cc'])
529             create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
530             create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
531             create_ardour_test_program(bld, obj.includes, 'plugins_test', 'test_plugins', ['test/plugins_test.cc'])
532             create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
533             create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
534             create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
535             create_ardour_test_program(bld, obj.includes, 'sha1_test', 'test_sha1', ['test/sha1_test.cc'])
536             create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc'])
537             create_ardour_test_program(bld, obj.includes, 'dsp_load_calculator_test', 'test_dsp_load_calculator', ['test/dsp_load_calculator_test.cc'])
538
539         test_sources  = '''
540             test/audio_engine_test.cc
541             test/automation_list_property_test.cc
542             test/bbt_test.cc
543             test/dsp_load_calculator_test.cc
544             test/tempo_test.cc
545             test/interpolation_test.cc
546             test/lua_script_test.cc
547             test/midi_clock_slave_test.cc
548             test/resampled_source_test.cc
549             test/samplewalk_to_beats_test.cc
550             test/samplepos_plus_beats_test.cc
551             test/playlist_equivalent_regions_test.cc
552             test/playlist_layering_test.cc
553             test/plugins_test.cc
554             test/region_naming_test.cc
555             test/control_surfaces_test.cc
556             test/mtdm_test.cc
557             test/sha1_test.cc
558             test/session_test.cc
559         '''.split()
560
561 # Tests that don't work
562 #                test/playlist_read_test.cc
563 #                test/audio_region_read_test.cc
564 #                test/combine_regions_test.cc
565 #                test/mantis_3356_test.cc
566
567         create_ardour_test_program(bld, obj.includes, 'libardour-tests', 'run-tests', test_sources)
568
569         # Utility to load and save a session
570         load_save_session = bld(features = 'cxx cxxprogram')
571         load_save_session.source = '''
572                     test/test_util.cc
573                     test/test_ui.cc
574                     test/load_save_session.cc
575                     test/dummy_lxvst.cc
576             '''.split()
577
578         load_save_session.includes  = obj.includes
579         load_save_session.includes.append ('test')
580         load_save_session.uselib    = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
581                              'SAMPLERATE','XML','LRDF','COREAUDIO']
582         load_save_session.use       = ['libpbd','libmidipp','libardour']
583         load_save_session.name      = 'libardour-load-save-session'
584         load_save_session.target    = 'load-save-session'
585         load_save_session.install_path = ''
586         load_save_session.defines      = [
587             'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'profile"',
588             'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
589             'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
590             'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
591             ]
592
593         # Profiling
594         for p in ['runpc', 'lots_of_regions', 'load_session']:
595             profilingobj = bld(features = 'cxx cxxprogram')
596             profilingobj.source = '''
597                     test/dummy_lxvst.cc
598                     test/test_util.cc
599             '''.split()
600
601             profilingobj.source.append('test/profiling/%s.cc' % p)
602
603             profilingobj.includes  = obj.includes
604             profilingobj.includes.append ('test')
605             profilingobj.uselib    = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
606                              'SAMPLERATE','XML','LRDF','COREAUDIO']
607             profilingobj.use       = ['libpbd','libmidipp','libardour']
608             profilingobj.name      = 'libardour-profiling'
609             profilingobj.target    = p
610             profilingobj.install_path = ''
611             profilingobj.defines      = [
612                 'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'profile"',
613                 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
614                 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
615                 'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
616                 ]
617
618 def create_ardour_test_program(bld, includes, name, target, sources):
619     testobj              = bld(features = 'cxx cxxprogram')
620     testobj.includes     = includes + ['test', '../pbd', '..']
621     testobj.source       = sources
622     testobj.uselib       = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
623                             'SAMPLERATE','XML','LRDF','COREAUDIO','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND']
624     testobj.use          = ['libpbd','libmidipp','libevoral',
625                             'libaudiographer','libardour','testcommon']
626     if bld.is_defined('USE_EXTERNAL_LIBS'):
627         testobj.uselib.extend(['LIBLTC', 'LIBFLUIDSYNTH'])
628     else:
629         testobj.use.extend(['libltc', 'libfluidsynth'])
630
631     testobj.name         = name
632     testobj.target       = target
633     # not sure about install path
634     testobj.install_path = bld.env['LIBDIR']
635     testobj.defines      = [
636         'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'test"',
637         'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
638         'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
639         'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
640         ]
641
642 def shutdown():
643     autowaf.shutdown()
644
645 def i18n(bld):
646     autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
647                        'Paul Davis')
648
649 def i18n_pot(bld):
650     autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
651                        'Paul Davis')
652
653 def i18n_po(bld):
654     autowaf.build_i18n_po(bld, top, 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
655                        'Paul Davis')
656
657 def i18n_mo(bld):
658     autowaf.build_i18n_mo(bld, top, 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
659                        'Paul Davis')