2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
8 # default state file version for this build
9 CURRENT_SESSION_FILE_VERSION = 3001
11 # Variables for 'waf dist'
12 APPNAME = 'libardour3'
13 I18N_PACKAGE = 'ardour3'
19 path_prefix = 'libs/ardour/'
25 'audio_diskstream.cc',
28 'audio_playlist_importer.cc',
29 'audio_playlist_source.cc',
31 'audio_region_importer.cc',
33 'audio_track_importer.cc',
36 'audiofile_tagger.cc',
43 'automation_control.cc',
45 'automation_watch.cc',
46 'backend_search_path.cc',
47 'beats_frames_converter.cc',
54 'capturing_processor.cc',
59 'control_protocol_manager.cc',
60 'control_protocol_search_path.cc',
68 'element_import_handler.cc',
69 'element_importer.cc',
73 'export_channel_configuration.cc',
76 'export_format_base.cc',
77 'export_format_manager.cc',
78 'export_format_specification.cc',
80 'export_formats_search_path.cc',
81 'export_graph_builder.cc',
84 'export_profile_manager.cc',
88 'filename_extensions.cc',
89 'filesystem_paths.cc',
108 'location_importer.cc',
110 'lv2_bundled_search_path.cc',
112 'midi_automation_list_binder.cc',
114 'midi_clock_slave.cc',
115 'midi_diskstream.cc',
117 'midi_patch_manager.cc',
118 'midi_patch_search_path.cc',
120 'midi_playlist_source.cc',
123 'midi_ring_buffer.cc',
125 'midi_state_tracker.cc',
130 'monitor_processor.cc',
136 'pan_controllable.cc',
140 'panner_search_path.cc',
145 'playlist_factory.cc',
146 'playlist_source.cc',
158 'rc_configuration.cc',
159 'recent_sessions.cc',
161 'resampled_source.cc',
168 'route_group_member.cc',
174 'session_command.cc',
175 'session_configuration.cc',
176 'session_directory.cc',
181 'session_metadata.cc',
184 'session_playlists.cc',
185 'session_process.cc',
186 'session_rtevents.cc',
188 'session_state_utils.cc',
190 'session_transport.cc',
193 'sndfile_helpers.cc',
194 'sndfileimportable.cc',
201 'tape_file_matcher.cc',
204 'tempo_map_importer.cc',
208 'transient_detector.cc',
209 'unknown_processor.cc',
217 def flac_supported():
218 cmd = subprocess.Popen ("sndfile-info testfile.flac",
219 stdout = subprocess.PIPE,
220 stderr = subprocess.STDOUT, shell = True)
221 out = cmd.communicate()[0].decode('utf-8');
222 return re.search ('unknown format', out) == None
225 cmd = subprocess.Popen ("sndfile-info testfile.ogg",
226 stdout = subprocess.PIPE,
227 stderr = subprocess.STDOUT, shell = True)
228 out = cmd.communicate()[0].decode('utf-8');
229 return re.search ('unknown format', out) == None
232 autowaf.set_options(opt)
235 conf.load('compiler_cxx')
237 # we don't use hard-coded micro versions with ardour, so hard code it to zero
238 autowaf.build_version_files(
239 path_prefix + 'ardour/version.h',
240 path_prefix + 'version.cc',
241 'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0)
242 autowaf.configure(conf)
243 autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
244 atleast_version='0.3.2')
245 autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
246 atleast_version='0.118.2')
247 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
248 autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
249 atleast_version='0.4.0')
250 autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
251 atleast_version='0.1.0')
252 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
253 atleast_version='2.0')
254 if Options.options.lv2:
255 autowaf.check_pkg(conf, 'lv2', uselib_store='LV2',
256 atleast_version='1.0.0', mandatory=True)
257 autowaf.check_pkg(conf, 'lv2', uselib_store='NEW_LV2',
258 atleast_version='1.0.15', mandatory=False)
259 autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD',
260 atleast_version='0.14.0', mandatory=True)
261 autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD',
262 atleast_version='0.8.0', mandatory=True)
263 autowaf.check_pkg(conf, 'sratom-0', uselib_store='SRATOM',
264 atleast_version='0.2.0', mandatory=True)
265 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
266 atleast_version='0.14.0', mandatory=True)
267 autowaf.check_pkg(conf, 'lilv-0', uselib_store='NEW_LILV',
268 atleast_version='0.15.0', mandatory=False)
269 autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
270 atleast_version='0.6.0', mandatory=False)
271 conf.define ('LV2_SUPPORT', 1)
273 # autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH',
275 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT',
276 atleast_version='1.12.0', mandatory=False)
277 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
278 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
279 atleast_version='1.2.1')
280 autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
281 atleast_version='7.0.0')
283 # we don't try to detect this, since its part of our source tree
285 conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
286 conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it
288 conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
290 conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
291 conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False)
293 conf.check(header_name='jack/session.h', uselib = [ 'JACK' ],
294 define_name='HAVE_JACK_SESSION')
296 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
298 conf.check_cc(fragment = '''
299 #include <jack/jack.h>
300 void callback(jack_status_t code, const char* reason, void* arg) { return; }
301 int main(int argc, char **argv) {
303 jack_on_info_shutdown(c, callback, (void*) 0);
307 msg = 'Checking for jack_on_info_shutdown',
308 define_name = 'HAVE_JACK_ON_INFO_SHUTDOWN',
311 missing_jack_message = 'missing - a version of JACK that supports jack_port_set_latency_range() is required to compile Ardour3.'
313 conf.check_cc(fragment = '''
314 #include <jack/jack.h>
315 int main(int argc, char **argv) {
317 jack_latency_range_t r;
318 jack_port_set_latency_range(p, JackCaptureLatency, &r);
322 msg = 'Checking for new JACK latency API',
325 errmsg = missing_jack_message)
327 conf.check_cc(fragment = '''
328 #include <jack/jack.h>
329 int main(int argc, char **argv) {
330 jack_port_type_get_buffer_size((jack_client_t*)0, "");
334 msg = 'Checking for new jack_port_type_get_buffer_size',
337 errmsg = missing_jack_message)
339 conf.check_cc(fragment = '''
340 #include <jack/transport.h>
341 int main(int argc, char** argv) {
343 pos.valid & JackVideoFrameOffset;
347 msg = 'Checking for JackVideoFrameOffset',
348 define_name = 'HAVE_JACK_VIDEO_SUPPORT',
353 conf.define ('HAVE_FLAC', 1)
355 conf.define ('HAVE_OGG', 1)
357 conf.write_config_header('libardour-config.h', remove=False)
360 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
361 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
362 autowaf.check_header(conf, 'cxx', 'boost/scoped_ptr.hpp')
363 autowaf.check_header(conf, 'cxx', 'boost/ptr_container/ptr_list.hpp')
367 # Library version (UNIX style major, minor, micro)
368 # major increment <=> incompatible changes
369 # minor increment <=> compatible changes (additions)
370 # micro increment <=> no interface changes
371 LIBARDOUR_LIB_VERSION = "3.0.0."
374 if bld.is_defined ('INTERNAL_SHARED_LIBS'):
375 obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=libardour_sources)
377 obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=libardour_sources)
378 obj.cxxflags = [ '-fPIC' ]
379 obj.cflags = [ '-fPIC' ]
381 obj.export_includes = ['.']
382 obj.includes = ['.', '../surfaces/control_protocol', '..']
384 obj.target = 'ardour'
385 obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
386 'JACK','SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS',
387 'OSX','BOOST','CURL','DL']
388 obj.use = ['libpbd','libmidipp','libevoral','libvamphost',
389 'libvampplugin','libtaglib','librubberband',
390 'libaudiographer','libltc']
391 obj.vnum = LIBARDOUR_LIB_VERSION
392 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
394 'PACKAGE="' + I18N_PACKAGE + '"',
395 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
396 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
397 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
398 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
402 #obj.source += ' st_stretch.cc st_pitch.cc '
403 #obj.uselib += ' SOUNDTOUCH '
404 #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
406 if bld.is_defined('HAVE_LILV') :
407 obj.source += ['lv2_plugin.cc', 'lv2_evbuf.c', 'uri_map.cc']
408 obj.uselib += ['LILV']
409 if bld.is_defined('HAVE_SUIL'):
410 obj.uselib += ['SUIL']
412 if bld.is_defined('WINDOWS_VST_SUPPORT'):
413 obj.source += [ 'windows_vst_plugin.cc']
414 obj.includes += [ '../fst' ]
415 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
417 if bld.is_defined('LXVST_SUPPORT'):
418 obj.source += [ 'lxvst_plugin.cc', 'linux_vst_support.cc', 'linux_vst_info_file.cc' ]
419 obj.defines += [ 'LXVST_SUPPORT' ]
421 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
422 obj.source += [ 'session_vst.cc', 'vst_plugin.cc' ]
424 if bld.is_defined('HAVE_COREAUDIO'):
425 obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
426 obj.use += ['libappleutility']
428 if bld.is_defined('AUDIOUNIT_SUPPORT'):
429 obj.source += [ 'audio_unit.cc' ]
431 if Options.options.fpu_optimization:
432 if (bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686'):
433 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s' ]
434 elif bld.env['build_target'] == 'x86_64':
435 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s' ]
437 # the JACK audio backend
439 obj = bld.shlib (features = 'c cxx cshlib cxxshlib',
442 'jack_connection.cc',
443 'jack_audiobackend.cc',
444 'jack_portengine.cc',
447 obj.cxxflags = [ '-fPIC' ]
448 obj.name = 'jack_audiobackend'
449 obj.target = 'jack_audiobackend'
450 obj.uselib = [ 'JACK' ]
451 obj.use = [ 'ardour' ]
453 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
454 obj.includes = [ '.' ]
456 'PACKAGE="' + I18N_PACKAGE + '"',
457 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
458 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
459 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
464 if bld.is_defined('ENABLE_NLS'):
465 mo_files = bld.path.ant_glob('po/*.mo')
467 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
468 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
469 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
472 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
474 # only build these common sources once
475 testcommon = bld(features = 'cxx')
476 testcommon.includes = obj.includes + ['test', '../pbd', '..']
477 testcommon.source = ['test/test_globals.cc', 'test/testrunner.cc', 'test/test_needing_session.cc',
478 'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc']
479 testcommon.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
480 'SAMPLERATE','XML','LRDF','COREAUDIO']
481 testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost',
482 'libvampplugin','libtaglib','librubberband',
483 'libaudiographer','libltc','ardour']
484 testcommon.defines = [
485 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
486 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
487 'LOCALEDIR="' + os.path.join(
488 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
489 'VAMP_DIR="' + os.path.join(
490 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
492 testcommon.name = 'testcommon'
494 if bld.env['FPU_OPTIMIZATION']:
495 testcommon.source += [ 'sse_functions_xmm.cc' ]
496 if (bld.env['build_target'] == 'i386'
497 or bld.env['build_target'] == 'i686'):
498 testcommon.source += [ 'sse_functions.s' ]
499 elif bld.env['build_target'] == 'x86_64':
500 testcommon.source += [ 'sse_functions_64bit.s' ]
502 if bld.env['SINGLE_TESTS']:
503 create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
504 create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
505 create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
506 create_ardour_test_program(bld, obj.includes, 'interpolation', 'test_interpolation', ['test/interpolation_test.cc'])
507 create_ardour_test_program(bld, obj.includes, 'midi_clock_slave', 'test_midi_clock_slave', ['test/midi_clock_slave_test.cc'])
508 create_ardour_test_program(bld, obj.includes, 'resampled_source', 'test_resampled_source', ['test/resampled_source_test.cc'])
509 create_ardour_test_program(bld, obj.includes, 'framewalk_to_beats', 'test_framewalk_to_beats', ['test/framewalk_to_beats_test.cc'])
510 create_ardour_test_program(bld, obj.includes, 'framepos_plus_beats', 'test_framepos_plus_beats', ['test/framepos_plus_beats_test.cc'])
511 create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc'])
512 create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
513 create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
514 create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
515 create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
516 create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
517 create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc'])
520 test/automation_list_property_test.cc
523 test/interpolation_test.cc
524 test/midi_clock_slave_test.cc
525 test/resampled_source_test.cc
526 test/framewalk_to_beats_test.cc
527 test/framepos_plus_beats_test.cc
528 test/framepos_minus_beats_test.cc
529 test/playlist_equivalent_regions_test.cc
530 test/playlist_layering_test.cc
531 test/region_naming_test.cc
532 test/control_surfaces_test.cc
537 # Tests that don't work
538 # test/playlist_read_test.cc
539 # test/audio_region_read_test.cc
540 # test/combine_regions_test.cc
541 # test/mantis_3356_test.cc
543 create_ardour_test_program(bld, obj.includes, 'libardour-tests', 'run-tests', test_sources)
545 # Tester to just load a session
546 session_load_tester = bld(features = 'cxx cxxprogram')
547 session_load_tester.source = '''
553 session_load_tester.includes = obj.includes
554 session_load_tester.includes.append ('test')
555 session_load_tester.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
556 'SAMPLERATE','XML','LRDF','COREAUDIO']
557 session_load_tester.use = ['libpbd','libmidipp','ardour']
558 session_load_tester.name = 'libardour-session-load-tester'
559 session_load_tester.target = 'load-session'
560 session_load_tester.install_path = ''
561 session_load_tester.defines = [
562 'PACKAGE="libardour3profile"',
563 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
564 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
565 'LOCALEDIR="' + os.path.join(
566 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
567 'VAMP_DIR="' + os.path.join(
568 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
570 if bld.env['FPU_OPTIMIZATION']:
571 session_load_tester.source += [ 'sse_functions_xmm.cc' ]
572 if (bld.env['build_target'] == 'i386'
573 or bld.env['build_target'] == 'i686'):
574 session_load_tester.source += [ 'sse_functions.s' ]
575 elif bld.env['build_target'] == 'x86_64':
576 session_load_tester.source += [ 'sse_functions_64bit.s' ]
579 for p in ['runpc', 'lots_of_regions', 'load_session']:
580 profilingobj = bld(features = 'cxx cxxprogram')
581 profilingobj.source = '''
586 profilingobj.source.append('test/profiling/%s.cc' % p)
588 profilingobj.includes = obj.includes
589 profilingobj.includes.append ('test')
590 profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
591 'SAMPLERATE','XML','LRDF','COREAUDIO']
592 profilingobj.use = ['libpbd','libmidipp','ardour']
593 profilingobj.name = 'libardour-profiling'
594 profilingobj.target = p
595 profilingobj.install_path = ''
596 profilingobj.defines = [
597 'PACKAGE="libardour3profile"',
598 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
599 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
600 'LOCALEDIR="' + os.path.join(
601 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
602 'VAMP_DIR="' + os.path.join(
603 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
605 if bld.env['FPU_OPTIMIZATION']:
606 profilingobj.source += [ 'sse_functions_xmm.cc' ]
607 if (bld.env['build_target'] == 'i386'
608 or bld.env['build_target'] == 'i686'):
609 profilingobj.source += [ 'sse_functions.s' ]
610 elif bld.env['build_target'] == 'x86_64':
611 profilingobj.source += [ 'sse_functions_64bit.s' ]
613 def create_ardour_test_program(bld, includes, name, target, sources):
614 testobj = bld(features = 'cxx cxxprogram')
615 testobj.includes = includes + ['test', '../pbd', '..']
616 testobj.source = sources
617 testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
618 'SAMPLERATE','XML','LRDF','COREAUDIO']
619 testobj.use = ['libpbd','libmidipp','libevoral','libvamphost',
620 'libvampplugin','libtaglib','librubberband',
621 'libaudiographer','libltc','ardour','testcommon']
623 testobj.target = target
624 # not sure about install path
625 testobj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
627 'PACKAGE="libardour3test"',
628 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
629 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
630 'LOCALEDIR="' + os.path.join(
631 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
632 'VAMP_DIR="' + os.path.join(
633 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
640 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
644 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
648 autowaf.build_i18n_po(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
652 autowaf.build_i18n_mo(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,