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',
446 obj.cxxflags = [ '-fPIC' ]
447 obj.name = 'jack_audiobackend'
448 obj.target = 'jack_audiobackend'
449 obj.uselib = [ 'JACK' ]
450 obj.use = [ 'ardour' ]
452 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
453 obj.includes = [ '.' ]
455 'PACKAGE="' + I18N_PACKAGE + '"',
456 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
457 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
458 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
463 if bld.is_defined('ENABLE_NLS'):
464 mo_files = bld.path.ant_glob('po/*.mo')
466 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
467 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
468 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
471 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
473 # only build these common sources once
474 testcommon = bld(features = 'cxx')
475 testcommon.includes = obj.includes + ['test', '../pbd', '..']
476 testcommon.source = ['test/test_globals.cc', 'test/testrunner.cc', 'test/test_needing_session.cc',
477 'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc']
478 testcommon.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
479 'SAMPLERATE','XML','LRDF','COREAUDIO']
480 testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost',
481 'libvampplugin','libtaglib','librubberband',
482 'libaudiographer','libltc','ardour']
483 testcommon.defines = [
484 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
485 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
486 'LOCALEDIR="' + os.path.join(
487 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
488 'VAMP_DIR="' + os.path.join(
489 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
491 testcommon.name = 'testcommon'
493 if bld.env['FPU_OPTIMIZATION']:
494 testcommon.source += [ 'sse_functions_xmm.cc' ]
495 if (bld.env['build_target'] == 'i386'
496 or bld.env['build_target'] == 'i686'):
497 testcommon.source += [ 'sse_functions.s' ]
498 elif bld.env['build_target'] == 'x86_64':
499 testcommon.source += [ 'sse_functions_64bit.s' ]
501 if bld.env['SINGLE_TESTS']:
502 create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
503 create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
504 create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
505 create_ardour_test_program(bld, obj.includes, 'interpolation', 'test_interpolation', ['test/interpolation_test.cc'])
506 create_ardour_test_program(bld, obj.includes, 'midi_clock_slave', 'test_midi_clock_slave', ['test/midi_clock_slave_test.cc'])
507 create_ardour_test_program(bld, obj.includes, 'resampled_source', 'test_resampled_source', ['test/resampled_source_test.cc'])
508 create_ardour_test_program(bld, obj.includes, 'framewalk_to_beats', 'test_framewalk_to_beats', ['test/framewalk_to_beats_test.cc'])
509 create_ardour_test_program(bld, obj.includes, 'framepos_plus_beats', 'test_framepos_plus_beats', ['test/framepos_plus_beats_test.cc'])
510 create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc'])
511 create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
512 create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
513 create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
514 create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
515 create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
516 create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc'])
519 test/automation_list_property_test.cc
522 test/interpolation_test.cc
523 test/midi_clock_slave_test.cc
524 test/resampled_source_test.cc
525 test/framewalk_to_beats_test.cc
526 test/framepos_plus_beats_test.cc
527 test/framepos_minus_beats_test.cc
528 test/playlist_equivalent_regions_test.cc
529 test/playlist_layering_test.cc
530 test/region_naming_test.cc
531 test/control_surfaces_test.cc
536 # Tests that don't work
537 # test/playlist_read_test.cc
538 # test/audio_region_read_test.cc
539 # test/combine_regions_test.cc
540 # test/mantis_3356_test.cc
542 create_ardour_test_program(bld, obj.includes, 'libardour-tests', 'run-tests', test_sources)
544 # Tester to just load a session
545 session_load_tester = bld(features = 'cxx cxxprogram')
546 session_load_tester.source = '''
552 session_load_tester.includes = obj.includes
553 session_load_tester.includes.append ('test')
554 session_load_tester.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
555 'SAMPLERATE','XML','LRDF','COREAUDIO']
556 session_load_tester.use = ['libpbd','libmidipp','ardour']
557 session_load_tester.name = 'libardour-session-load-tester'
558 session_load_tester.target = 'load-session'
559 session_load_tester.install_path = ''
560 session_load_tester.defines = [
561 'PACKAGE="libardour3profile"',
562 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
563 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
564 'LOCALEDIR="' + os.path.join(
565 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
566 'VAMP_DIR="' + os.path.join(
567 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
569 if bld.env['FPU_OPTIMIZATION']:
570 session_load_tester.source += [ 'sse_functions_xmm.cc' ]
571 if (bld.env['build_target'] == 'i386'
572 or bld.env['build_target'] == 'i686'):
573 session_load_tester.source += [ 'sse_functions.s' ]
574 elif bld.env['build_target'] == 'x86_64':
575 session_load_tester.source += [ 'sse_functions_64bit.s' ]
578 for p in ['runpc', 'lots_of_regions', 'load_session']:
579 profilingobj = bld(features = 'cxx cxxprogram')
580 profilingobj.source = '''
585 profilingobj.source.append('test/profiling/%s.cc' % p)
587 profilingobj.includes = obj.includes
588 profilingobj.includes.append ('test')
589 profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
590 'SAMPLERATE','XML','LRDF','COREAUDIO']
591 profilingobj.use = ['libpbd','libmidipp','ardour']
592 profilingobj.name = 'libardour-profiling'
593 profilingobj.target = p
594 profilingobj.install_path = ''
595 profilingobj.defines = [
596 'PACKAGE="libardour3profile"',
597 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
598 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
599 'LOCALEDIR="' + os.path.join(
600 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
601 'VAMP_DIR="' + os.path.join(
602 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
604 if bld.env['FPU_OPTIMIZATION']:
605 profilingobj.source += [ 'sse_functions_xmm.cc' ]
606 if (bld.env['build_target'] == 'i386'
607 or bld.env['build_target'] == 'i686'):
608 profilingobj.source += [ 'sse_functions.s' ]
609 elif bld.env['build_target'] == 'x86_64':
610 profilingobj.source += [ 'sse_functions_64bit.s' ]
612 def create_ardour_test_program(bld, includes, name, target, sources):
613 testobj = bld(features = 'cxx cxxprogram')
614 testobj.includes = includes + ['test', '../pbd', '..']
615 testobj.source = sources
616 testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
617 'SAMPLERATE','XML','LRDF','COREAUDIO']
618 testobj.use = ['libpbd','libmidipp','libevoral','libvamphost',
619 'libvampplugin','libtaglib','librubberband',
620 'libaudiographer','libltc','ardour','testcommon']
622 testobj.target = target
623 # not sure about install path
624 testobj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
626 'PACKAGE="libardour3test"',
627 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
628 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
629 'LOCALEDIR="' + os.path.join(
630 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
631 'VAMP_DIR="' + os.path.join(
632 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
639 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
643 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
647 autowaf.build_i18n_po(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
651 autowaf.build_i18n_mo(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,