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 'beats_frames_converter.cc',
53 'capturing_processor.cc',
58 'control_protocol_manager.cc',
59 'control_protocol_search_path.cc',
67 'element_import_handler.cc',
68 'element_importer.cc',
72 'export_channel_configuration.cc',
75 'export_format_base.cc',
76 'export_format_manager.cc',
77 'export_format_specification.cc',
79 'export_formats_search_path.cc',
80 'export_graph_builder.cc',
83 'export_profile_manager.cc',
87 'filename_extensions.cc',
88 'filesystem_paths.cc',
107 'location_importer.cc',
109 'lv2_bundled_search_path.cc',
111 'midi_automation_list_binder.cc',
113 'midi_clock_slave.cc',
114 'midi_diskstream.cc',
116 'midi_patch_manager.cc',
117 'midi_patch_search_path.cc',
119 'midi_playlist_source.cc',
122 'midi_ring_buffer.cc',
124 'midi_state_tracker.cc',
129 'monitor_processor.cc',
135 'pan_controllable.cc',
139 'panner_search_path.cc',
144 'playlist_factory.cc',
145 'playlist_source.cc',
156 'rc_configuration.cc',
157 'recent_sessions.cc',
159 'resampled_source.cc',
166 'route_group_member.cc',
172 'session_command.cc',
173 'session_configuration.cc',
174 'session_directory.cc',
179 'session_metadata.cc',
182 'session_playlists.cc',
183 'session_process.cc',
184 'session_rtevents.cc',
186 'session_state_utils.cc',
188 'session_transport.cc',
191 'sndfile_helpers.cc',
192 'sndfileimportable.cc',
199 'tape_file_matcher.cc',
202 'tempo_map_importer.cc',
206 'transient_detector.cc',
207 'unknown_processor.cc',
215 def flac_supported():
216 cmd = subprocess.Popen ("sndfile-info testfile.flac",
217 stdout = subprocess.PIPE,
218 stderr = subprocess.STDOUT, shell = True)
219 out = cmd.communicate()[0].decode('utf-8');
220 return re.search ('unknown format', out) == None
223 cmd = subprocess.Popen ("sndfile-info testfile.ogg",
224 stdout = subprocess.PIPE,
225 stderr = subprocess.STDOUT, shell = True)
226 out = cmd.communicate()[0].decode('utf-8');
227 return re.search ('unknown format', out) == None
230 autowaf.set_options(opt)
233 conf.load('compiler_cxx')
235 # we don't use hard-coded micro versions with ardour, so hard code it to zero
236 autowaf.build_version_files(
237 path_prefix + 'ardour/version.h',
238 path_prefix + 'version.cc',
239 'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0)
240 autowaf.configure(conf)
241 autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
242 atleast_version='0.3.2')
243 autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
244 atleast_version='0.118.2')
245 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
246 autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
247 atleast_version='0.4.0')
248 autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
249 atleast_version='0.1.0')
250 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
251 atleast_version='2.0')
252 if Options.options.lv2:
253 autowaf.check_pkg(conf, 'lv2', uselib_store='LV2',
254 atleast_version='1.0.0', mandatory=True)
255 autowaf.check_pkg(conf, 'lv2', uselib_store='NEW_LV2',
256 atleast_version='1.0.15', mandatory=False)
257 autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD',
258 atleast_version='0.14.0', mandatory=True)
259 autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD',
260 atleast_version='0.8.0', mandatory=True)
261 autowaf.check_pkg(conf, 'sratom-0', uselib_store='SRATOM',
262 atleast_version='0.2.0', mandatory=True)
263 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
264 atleast_version='0.14.0', mandatory=True)
265 autowaf.check_pkg(conf, 'lilv-0', uselib_store='NEW_LILV',
266 atleast_version='0.15.0', mandatory=False)
267 autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
268 atleast_version='0.6.0', mandatory=False)
269 conf.define ('LV2_SUPPORT', 1)
271 # autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH',
273 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT',
274 atleast_version='1.12.0', mandatory=False)
275 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
276 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
277 atleast_version='1.2.1')
278 autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
279 atleast_version='7.0.0')
281 # we don't try to detect this, since its part of our source tree
283 conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
284 conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it
286 conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
288 conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
289 conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False)
291 conf.check(header_name='jack/session.h', uselib = [ 'JACK' ],
292 define_name='HAVE_JACK_SESSION')
294 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
296 conf.check_cc(fragment = '''
297 #include <jack/jack.h>
298 void callback(jack_status_t code, const char* reason, void* arg) { return; }
299 int main(int argc, char **argv) {
301 jack_on_info_shutdown(c, callback, (void*) 0);
305 msg = 'Checking for jack_on_info_shutdown',
306 define_name = 'HAVE_JACK_ON_INFO_SHUTDOWN',
309 missing_jack_message = 'missing - a version of JACK that supports jack_port_set_latency_range() is required to compile Ardour3.'
311 conf.check_cc(fragment = '''
312 #include <jack/jack.h>
313 int main(int argc, char **argv) {
315 jack_latency_range_t r;
316 jack_port_set_latency_range(p, JackCaptureLatency, &r);
320 msg = 'Checking for new JACK latency API',
323 errmsg = missing_jack_message)
325 conf.check_cc(fragment = '''
326 #include <jack/jack.h>
327 int main(int argc, char **argv) {
328 jack_port_type_get_buffer_size((jack_client_t*)0, "");
332 msg = 'Checking for new jack_port_type_get_buffer_size',
335 errmsg = missing_jack_message)
337 conf.check_cc(fragment = '''
338 #include <jack/transport.h>
339 int main(int argc, char** argv) {
341 pos.valid & JackVideoFrameOffset;
345 msg = 'Checking for JackVideoFrameOffset',
346 define_name = 'HAVE_JACK_VIDEO_SUPPORT',
351 conf.define ('HAVE_FLAC', 1)
353 conf.define ('HAVE_OGG', 1)
355 conf.write_config_header('libardour-config.h', remove=False)
358 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
359 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
360 autowaf.check_header(conf, 'cxx', 'boost/scoped_ptr.hpp')
361 autowaf.check_header(conf, 'cxx', 'boost/ptr_container/ptr_list.hpp')
365 # Library version (UNIX style major, minor, micro)
366 # major increment <=> incompatible changes
367 # minor increment <=> compatible changes (additions)
368 # micro increment <=> no interface changes
369 LIBARDOUR_LIB_VERSION = "3.0.0."
372 if bld.is_defined ('INTERNAL_SHARED_LIBS'):
373 obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=libardour_sources)
375 obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=libardour_sources)
376 obj.cxxflags = [ '-fPIC' ]
377 obj.cflags = [ '-fPIC' ]
379 obj.export_includes = ['.']
380 obj.includes = ['.', '../surfaces/control_protocol', '..']
382 obj.target = 'ardour'
383 obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
384 'JACK','SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS',
385 'OSX','BOOST','CURL','DL']
386 obj.use = ['libpbd','libmidipp','libevoral','libvamphost',
387 'libvampplugin','libtaglib','librubberband',
388 'libaudiographer','libltc']
389 obj.vnum = LIBARDOUR_LIB_VERSION
390 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
392 'PACKAGE="' + I18N_PACKAGE + '"',
393 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
394 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
395 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
396 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
400 #obj.source += ' st_stretch.cc st_pitch.cc '
401 #obj.uselib += ' SOUNDTOUCH '
402 #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
404 if bld.is_defined('HAVE_LILV') :
405 obj.source += ['lv2_plugin.cc', 'lv2_evbuf.c', 'uri_map.cc']
406 obj.uselib += ['LILV']
407 if bld.is_defined('HAVE_SUIL'):
408 obj.uselib += ['SUIL']
410 if bld.is_defined('WINDOWS_VST_SUPPORT'):
411 obj.source += [ 'windows_vst_plugin.cc']
412 obj.includes += [ '../fst' ]
413 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
415 if bld.is_defined('LXVST_SUPPORT'):
416 obj.source += [ 'lxvst_plugin.cc', 'linux_vst_support.cc', 'linux_vst_info_file.cc' ]
417 obj.defines += [ 'LXVST_SUPPORT' ]
419 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
420 obj.source += [ 'session_vst.cc', 'vst_plugin.cc' ]
422 if bld.is_defined('HAVE_COREAUDIO'):
423 obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
424 obj.use += ['libappleutility']
426 if bld.is_defined('AUDIOUNIT_SUPPORT'):
427 obj.source += [ 'audio_unit.cc' ]
429 if Options.options.fpu_optimization:
430 if (bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686'):
431 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s' ]
432 elif bld.env['build_target'] == 'x86_64':
433 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s' ]
435 # the JACK audio backend
437 obj = bld.shlib (features = 'c cxx cshlib cxxshlib', source='jack_audiobackend.cc')
438 obj.cxxflags = [ '-fPIC' ]
439 obj.name = 'jack_audiobackend'
440 obj.target = 'jack_audiobackend'
441 obj.uselib = [ 'JACK' ]
442 obj.use = [ 'ardour' ]
444 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
445 obj.includes = [ '.' ]
447 'PACKAGE="' + I18N_PACKAGE + '"',
448 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
449 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
450 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
455 if bld.is_defined('ENABLE_NLS'):
456 mo_files = bld.path.ant_glob('po/*.mo')
458 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
459 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
460 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
463 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
465 # only build these common sources once
466 testcommon = bld(features = 'cxx')
467 testcommon.includes = obj.includes + ['test', '../pbd', '..']
468 testcommon.source = ['test/test_globals.cc', 'test/testrunner.cc', 'test/test_needing_session.cc',
469 'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc']
470 testcommon.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
471 'SAMPLERATE','XML','LRDF','COREAUDIO']
472 testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost',
473 'libvampplugin','libtaglib','librubberband',
474 'libaudiographer','libltc','ardour']
475 testcommon.defines = [
476 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
477 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
478 'LOCALEDIR="' + os.path.join(
479 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
480 'VAMP_DIR="' + os.path.join(
481 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
483 testcommon.name = 'testcommon'
485 if bld.env['FPU_OPTIMIZATION']:
486 testcommon.source += [ 'sse_functions_xmm.cc' ]
487 if (bld.env['build_target'] == 'i386'
488 or bld.env['build_target'] == 'i686'):
489 testcommon.source += [ 'sse_functions.s' ]
490 elif bld.env['build_target'] == 'x86_64':
491 testcommon.source += [ 'sse_functions_64bit.s' ]
493 if bld.env['SINGLE_TESTS']:
494 create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
495 create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
496 create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
497 create_ardour_test_program(bld, obj.includes, 'interpolation', 'test_interpolation', ['test/interpolation_test.cc'])
498 create_ardour_test_program(bld, obj.includes, 'midi_clock_slave', 'test_midi_clock_slave', ['test/midi_clock_slave_test.cc'])
499 create_ardour_test_program(bld, obj.includes, 'resampled_source', 'test_resampled_source', ['test/resampled_source_test.cc'])
500 create_ardour_test_program(bld, obj.includes, 'framewalk_to_beats', 'test_framewalk_to_beats', ['test/framewalk_to_beats_test.cc'])
501 create_ardour_test_program(bld, obj.includes, 'framepos_plus_beats', 'test_framepos_plus_beats', ['test/framepos_plus_beats_test.cc'])
502 create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc'])
503 create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
504 create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
505 create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
506 create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
507 create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
508 create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc'])
511 test/automation_list_property_test.cc
514 test/interpolation_test.cc
515 test/midi_clock_slave_test.cc
516 test/resampled_source_test.cc
517 test/framewalk_to_beats_test.cc
518 test/framepos_plus_beats_test.cc
519 test/framepos_minus_beats_test.cc
520 test/playlist_equivalent_regions_test.cc
521 test/playlist_layering_test.cc
522 test/region_naming_test.cc
523 test/control_surfaces_test.cc
528 # Tests that don't work
529 # test/playlist_read_test.cc
530 # test/audio_region_read_test.cc
531 # test/combine_regions_test.cc
532 # test/mantis_3356_test.cc
534 create_ardour_test_program(bld, obj.includes, 'libardour-tests', 'run-tests', test_sources)
536 # Tester to just load a session
537 session_load_tester = bld(features = 'cxx cxxprogram')
538 session_load_tester.source = '''
544 session_load_tester.includes = obj.includes
545 session_load_tester.includes.append ('test')
546 session_load_tester.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
547 'SAMPLERATE','XML','LRDF','COREAUDIO']
548 session_load_tester.use = ['libpbd','libmidipp','ardour']
549 session_load_tester.name = 'libardour-session-load-tester'
550 session_load_tester.target = 'load-session'
551 session_load_tester.install_path = ''
552 session_load_tester.defines = [
553 'PACKAGE="libardour3profile"',
554 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
555 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
556 'LOCALEDIR="' + os.path.join(
557 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
558 'VAMP_DIR="' + os.path.join(
559 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
561 if bld.env['FPU_OPTIMIZATION']:
562 session_load_tester.source += [ 'sse_functions_xmm.cc' ]
563 if (bld.env['build_target'] == 'i386'
564 or bld.env['build_target'] == 'i686'):
565 session_load_tester.source += [ 'sse_functions.s' ]
566 elif bld.env['build_target'] == 'x86_64':
567 session_load_tester.source += [ 'sse_functions_64bit.s' ]
570 for p in ['runpc', 'lots_of_regions', 'load_session']:
571 profilingobj = bld(features = 'cxx cxxprogram')
572 profilingobj.source = '''
577 profilingobj.source.append('test/profiling/%s.cc' % p)
579 profilingobj.includes = obj.includes
580 profilingobj.includes.append ('test')
581 profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
582 'SAMPLERATE','XML','LRDF','COREAUDIO']
583 profilingobj.use = ['libpbd','libmidipp','ardour']
584 profilingobj.name = 'libardour-profiling'
585 profilingobj.target = p
586 profilingobj.install_path = ''
587 profilingobj.defines = [
588 'PACKAGE="libardour3profile"',
589 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
590 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
591 'LOCALEDIR="' + os.path.join(
592 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
593 'VAMP_DIR="' + os.path.join(
594 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
596 if bld.env['FPU_OPTIMIZATION']:
597 profilingobj.source += [ 'sse_functions_xmm.cc' ]
598 if (bld.env['build_target'] == 'i386'
599 or bld.env['build_target'] == 'i686'):
600 profilingobj.source += [ 'sse_functions.s' ]
601 elif bld.env['build_target'] == 'x86_64':
602 profilingobj.source += [ 'sse_functions_64bit.s' ]
604 def create_ardour_test_program(bld, includes, name, target, sources):
605 testobj = bld(features = 'cxx cxxprogram')
606 testobj.includes = includes + ['test', '../pbd', '..']
607 testobj.source = sources
608 testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
609 'SAMPLERATE','XML','LRDF','COREAUDIO']
610 testobj.use = ['libpbd','libmidipp','libevoral','libvamphost',
611 'libvampplugin','libtaglib','librubberband',
612 'libaudiographer','libltc','ardour','testcommon']
614 testobj.target = target
615 # not sure about install path
616 testobj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
618 'PACKAGE="libardour3test"',
619 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
620 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
621 'LOCALEDIR="' + os.path.join(
622 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
623 'VAMP_DIR="' + os.path.join(
624 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
631 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
635 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
639 autowaf.build_i18n_po(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
643 autowaf.build_i18n_mo(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,