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',
157 'rc_configuration.cc',
158 'recent_sessions.cc',
160 'resampled_source.cc',
167 'route_group_member.cc',
173 'session_command.cc',
174 'session_configuration.cc',
175 'session_directory.cc',
180 'session_metadata.cc',
183 'session_playlists.cc',
184 'session_process.cc',
185 'session_rtevents.cc',
187 'session_state_utils.cc',
189 'session_transport.cc',
192 'sndfile_helpers.cc',
193 'sndfileimportable.cc',
200 'tape_file_matcher.cc',
203 'tempo_map_importer.cc',
207 'transient_detector.cc',
208 'unknown_processor.cc',
216 def flac_supported():
217 cmd = subprocess.Popen ("sndfile-info testfile.flac",
218 stdout = subprocess.PIPE,
219 stderr = subprocess.STDOUT, shell = True)
220 out = cmd.communicate()[0].decode('utf-8');
221 return re.search ('unknown format', out) == None
224 cmd = subprocess.Popen ("sndfile-info testfile.ogg",
225 stdout = subprocess.PIPE,
226 stderr = subprocess.STDOUT, shell = True)
227 out = cmd.communicate()[0].decode('utf-8');
228 return re.search ('unknown format', out) == None
231 autowaf.set_options(opt)
234 conf.load('compiler_cxx')
236 # we don't use hard-coded micro versions with ardour, so hard code it to zero
237 autowaf.build_version_files(
238 path_prefix + 'ardour/version.h',
239 path_prefix + 'version.cc',
240 'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0)
241 autowaf.configure(conf)
242 autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
243 atleast_version='0.3.2')
244 autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
245 atleast_version='0.118.2')
246 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
247 autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
248 atleast_version='0.4.0')
249 autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
250 atleast_version='0.1.0')
251 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
252 atleast_version='2.0')
253 if Options.options.lv2:
254 autowaf.check_pkg(conf, 'lv2', uselib_store='LV2',
255 atleast_version='1.0.0', mandatory=True)
256 autowaf.check_pkg(conf, 'lv2', uselib_store='NEW_LV2',
257 atleast_version='1.0.15', mandatory=False)
258 autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD',
259 atleast_version='0.14.0', mandatory=True)
260 autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD',
261 atleast_version='0.8.0', mandatory=True)
262 autowaf.check_pkg(conf, 'sratom-0', uselib_store='SRATOM',
263 atleast_version='0.2.0', mandatory=True)
264 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
265 atleast_version='0.14.0', mandatory=True)
266 autowaf.check_pkg(conf, 'lilv-0', uselib_store='NEW_LILV',
267 atleast_version='0.15.0', mandatory=False)
268 autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
269 atleast_version='0.6.0', mandatory=False)
270 conf.define ('LV2_SUPPORT', 1)
272 # autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH',
274 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT',
275 atleast_version='1.12.0', mandatory=False)
276 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
277 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
278 atleast_version='1.2.1')
279 autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
280 atleast_version='7.0.0')
282 # we don't try to detect this, since its part of our source tree
284 conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
285 conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it
287 conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
289 conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
290 conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False)
292 conf.check(header_name='jack/session.h', uselib = [ 'JACK' ],
293 define_name='HAVE_JACK_SESSION')
295 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
297 conf.check_cc(fragment = '''
298 #include <jack/jack.h>
299 void callback(jack_status_t code, const char* reason, void* arg) { return; }
300 int main(int argc, char **argv) {
302 jack_on_info_shutdown(c, callback, (void*) 0);
306 msg = 'Checking for jack_on_info_shutdown',
307 define_name = 'HAVE_JACK_ON_INFO_SHUTDOWN',
310 missing_jack_message = 'missing - a version of JACK that supports jack_port_set_latency_range() is required to compile Ardour3.'
312 conf.check_cc(fragment = '''
313 #include <jack/jack.h>
314 int main(int argc, char **argv) {
316 jack_latency_range_t r;
317 jack_port_set_latency_range(p, JackCaptureLatency, &r);
321 msg = 'Checking for new JACK latency API',
324 errmsg = missing_jack_message)
326 conf.check_cc(fragment = '''
327 #include <jack/jack.h>
328 int main(int argc, char **argv) {
329 jack_port_type_get_buffer_size((jack_client_t*)0, "");
333 msg = 'Checking for new jack_port_type_get_buffer_size',
336 errmsg = missing_jack_message)
338 conf.check_cc(fragment = '''
339 #include <jack/transport.h>
340 int main(int argc, char** argv) {
342 pos.valid & JackVideoFrameOffset;
346 msg = 'Checking for JackVideoFrameOffset',
347 define_name = 'HAVE_JACK_VIDEO_SUPPORT',
352 conf.define ('HAVE_FLAC', 1)
354 conf.define ('HAVE_OGG', 1)
356 conf.write_config_header('libardour-config.h', remove=False)
359 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
360 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
361 autowaf.check_header(conf, 'cxx', 'boost/scoped_ptr.hpp')
362 autowaf.check_header(conf, 'cxx', 'boost/ptr_container/ptr_list.hpp')
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."
373 if bld.is_defined ('INTERNAL_SHARED_LIBS'):
374 obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=libardour_sources)
376 obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=libardour_sources)
377 obj.cxxflags = [ '-fPIC' ]
378 obj.cflags = [ '-fPIC' ]
380 obj.export_includes = ['.']
381 obj.includes = ['.', '../surfaces/control_protocol', '..']
383 obj.target = 'ardour'
384 obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
385 'JACK','SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS',
386 'OSX','BOOST','CURL','DL']
387 obj.use = ['libpbd','libmidipp','libevoral','libvamphost',
388 'libvampplugin','libtaglib','librubberband',
389 'libaudiographer','libltc']
390 obj.vnum = LIBARDOUR_LIB_VERSION
391 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
393 'PACKAGE="' + I18N_PACKAGE + '"',
394 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
395 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
396 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
397 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
401 #obj.source += ' st_stretch.cc st_pitch.cc '
402 #obj.uselib += ' SOUNDTOUCH '
403 #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
405 if bld.is_defined('HAVE_LILV') :
406 obj.source += ['lv2_plugin.cc', 'lv2_evbuf.c', 'uri_map.cc']
407 obj.uselib += ['LILV']
408 if bld.is_defined('HAVE_SUIL'):
409 obj.uselib += ['SUIL']
411 if bld.is_defined('WINDOWS_VST_SUPPORT'):
412 obj.source += [ 'windows_vst_plugin.cc']
413 obj.includes += [ '../fst' ]
414 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
416 if bld.is_defined('LXVST_SUPPORT'):
417 obj.source += [ 'lxvst_plugin.cc', 'linux_vst_support.cc', 'linux_vst_info_file.cc' ]
418 obj.defines += [ 'LXVST_SUPPORT' ]
420 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
421 obj.source += [ 'session_vst.cc', 'vst_plugin.cc' ]
423 if bld.is_defined('HAVE_COREAUDIO'):
424 obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
425 obj.use += ['libappleutility']
427 if bld.is_defined('AUDIOUNIT_SUPPORT'):
428 obj.source += [ 'audio_unit.cc' ]
430 if Options.options.fpu_optimization:
431 if (bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686'):
432 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s' ]
433 elif bld.env['build_target'] == 'x86_64':
434 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s' ]
436 # the JACK audio backend
438 obj = bld.shlib (features = 'c cxx cshlib cxxshlib',
441 'jack_connection.cc',
442 'jack_audiobackend.cc'
444 obj.cxxflags = [ '-fPIC' ]
445 obj.name = 'jack_audiobackend'
446 obj.target = 'jack_audiobackend'
447 obj.uselib = [ 'JACK' ]
448 obj.use = [ 'ardour' ]
450 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
451 obj.includes = [ '.' ]
453 'PACKAGE="' + I18N_PACKAGE + '"',
454 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
455 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
456 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
461 if bld.is_defined('ENABLE_NLS'):
462 mo_files = bld.path.ant_glob('po/*.mo')
464 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
465 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
466 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
469 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
471 # only build these common sources once
472 testcommon = bld(features = 'cxx')
473 testcommon.includes = obj.includes + ['test', '../pbd', '..']
474 testcommon.source = ['test/test_globals.cc', 'test/testrunner.cc', 'test/test_needing_session.cc',
475 'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc']
476 testcommon.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
477 'SAMPLERATE','XML','LRDF','COREAUDIO']
478 testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost',
479 'libvampplugin','libtaglib','librubberband',
480 'libaudiographer','libltc','ardour']
481 testcommon.defines = [
482 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
483 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
484 'LOCALEDIR="' + os.path.join(
485 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
486 'VAMP_DIR="' + os.path.join(
487 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
489 testcommon.name = 'testcommon'
491 if bld.env['FPU_OPTIMIZATION']:
492 testcommon.source += [ 'sse_functions_xmm.cc' ]
493 if (bld.env['build_target'] == 'i386'
494 or bld.env['build_target'] == 'i686'):
495 testcommon.source += [ 'sse_functions.s' ]
496 elif bld.env['build_target'] == 'x86_64':
497 testcommon.source += [ 'sse_functions_64bit.s' ]
499 if bld.env['SINGLE_TESTS']:
500 create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
501 create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
502 create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
503 create_ardour_test_program(bld, obj.includes, 'interpolation', 'test_interpolation', ['test/interpolation_test.cc'])
504 create_ardour_test_program(bld, obj.includes, 'midi_clock_slave', 'test_midi_clock_slave', ['test/midi_clock_slave_test.cc'])
505 create_ardour_test_program(bld, obj.includes, 'resampled_source', 'test_resampled_source', ['test/resampled_source_test.cc'])
506 create_ardour_test_program(bld, obj.includes, 'framewalk_to_beats', 'test_framewalk_to_beats', ['test/framewalk_to_beats_test.cc'])
507 create_ardour_test_program(bld, obj.includes, 'framepos_plus_beats', 'test_framepos_plus_beats', ['test/framepos_plus_beats_test.cc'])
508 create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc'])
509 create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
510 create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
511 create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
512 create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
513 create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
514 create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc'])
517 test/automation_list_property_test.cc
520 test/interpolation_test.cc
521 test/midi_clock_slave_test.cc
522 test/resampled_source_test.cc
523 test/framewalk_to_beats_test.cc
524 test/framepos_plus_beats_test.cc
525 test/framepos_minus_beats_test.cc
526 test/playlist_equivalent_regions_test.cc
527 test/playlist_layering_test.cc
528 test/region_naming_test.cc
529 test/control_surfaces_test.cc
534 # Tests that don't work
535 # test/playlist_read_test.cc
536 # test/audio_region_read_test.cc
537 # test/combine_regions_test.cc
538 # test/mantis_3356_test.cc
540 create_ardour_test_program(bld, obj.includes, 'libardour-tests', 'run-tests', test_sources)
542 # Tester to just load a session
543 session_load_tester = bld(features = 'cxx cxxprogram')
544 session_load_tester.source = '''
550 session_load_tester.includes = obj.includes
551 session_load_tester.includes.append ('test')
552 session_load_tester.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
553 'SAMPLERATE','XML','LRDF','COREAUDIO']
554 session_load_tester.use = ['libpbd','libmidipp','ardour']
555 session_load_tester.name = 'libardour-session-load-tester'
556 session_load_tester.target = 'load-session'
557 session_load_tester.install_path = ''
558 session_load_tester.defines = [
559 'PACKAGE="libardour3profile"',
560 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
561 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
562 'LOCALEDIR="' + os.path.join(
563 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
564 'VAMP_DIR="' + os.path.join(
565 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
567 if bld.env['FPU_OPTIMIZATION']:
568 session_load_tester.source += [ 'sse_functions_xmm.cc' ]
569 if (bld.env['build_target'] == 'i386'
570 or bld.env['build_target'] == 'i686'):
571 session_load_tester.source += [ 'sse_functions.s' ]
572 elif bld.env['build_target'] == 'x86_64':
573 session_load_tester.source += [ 'sse_functions_64bit.s' ]
576 for p in ['runpc', 'lots_of_regions', 'load_session']:
577 profilingobj = bld(features = 'cxx cxxprogram')
578 profilingobj.source = '''
583 profilingobj.source.append('test/profiling/%s.cc' % p)
585 profilingobj.includes = obj.includes
586 profilingobj.includes.append ('test')
587 profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
588 'SAMPLERATE','XML','LRDF','COREAUDIO']
589 profilingobj.use = ['libpbd','libmidipp','ardour']
590 profilingobj.name = 'libardour-profiling'
591 profilingobj.target = p
592 profilingobj.install_path = ''
593 profilingobj.defines = [
594 'PACKAGE="libardour3profile"',
595 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
596 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
597 'LOCALEDIR="' + os.path.join(
598 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
599 'VAMP_DIR="' + os.path.join(
600 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
602 if bld.env['FPU_OPTIMIZATION']:
603 profilingobj.source += [ 'sse_functions_xmm.cc' ]
604 if (bld.env['build_target'] == 'i386'
605 or bld.env['build_target'] == 'i686'):
606 profilingobj.source += [ 'sse_functions.s' ]
607 elif bld.env['build_target'] == 'x86_64':
608 profilingobj.source += [ 'sse_functions_64bit.s' ]
610 def create_ardour_test_program(bld, includes, name, target, sources):
611 testobj = bld(features = 'cxx cxxprogram')
612 testobj.includes = includes + ['test', '../pbd', '..']
613 testobj.source = sources
614 testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
615 'SAMPLERATE','XML','LRDF','COREAUDIO']
616 testobj.use = ['libpbd','libmidipp','libevoral','libvamphost',
617 'libvampplugin','libtaglib','librubberband',
618 'libaudiographer','libltc','ardour','testcommon']
620 testobj.target = target
621 # not sure about install path
622 testobj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
624 'PACKAGE="libardour3test"',
625 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
626 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
627 'LOCALEDIR="' + os.path.join(
628 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
629 'VAMP_DIR="' + os.path.join(
630 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
637 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
641 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
645 autowaf.build_i18n_po(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
649 autowaf.build_i18n_mo(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,