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' ]
436 if bld.is_defined('ENABLE_NLS'):
437 mo_files = bld.path.ant_glob('po/*.mo')
439 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
440 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
441 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
444 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
446 # only build these common sources once
447 testcommon = bld(features = 'cxx')
448 testcommon.includes = obj.includes + ['test', '../pbd', '..']
449 testcommon.source = ['test/test_globals.cc', 'test/testrunner.cc', 'test/test_needing_session.cc',
450 'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc']
451 testcommon.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
452 'SAMPLERATE','XML','LRDF','COREAUDIO']
453 testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost',
454 'libvampplugin','libtaglib','librubberband',
455 'libaudiographer','libltc','ardour']
456 testcommon.defines = [
457 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
458 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
459 'LOCALEDIR="' + os.path.join(
460 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
461 'VAMP_DIR="' + os.path.join(
462 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
464 testcommon.name = 'testcommon'
466 if bld.env['FPU_OPTIMIZATION']:
467 testcommon.source += [ 'sse_functions_xmm.cc' ]
468 if (bld.env['build_target'] == 'i386'
469 or bld.env['build_target'] == 'i686'):
470 testcommon.source += [ 'sse_functions.s' ]
471 elif bld.env['build_target'] == 'x86_64':
472 testcommon.source += [ 'sse_functions_64bit.s' ]
474 if bld.env['SINGLE_TESTS']:
475 create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
476 create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
477 create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
478 create_ardour_test_program(bld, obj.includes, 'interpolation', 'test_interpolation', ['test/interpolation_test.cc'])
479 create_ardour_test_program(bld, obj.includes, 'midi_clock_slave', 'test_midi_clock_slave', ['test/midi_clock_slave_test.cc'])
480 create_ardour_test_program(bld, obj.includes, 'resampled_source', 'test_resampled_source', ['test/resampled_source_test.cc'])
481 create_ardour_test_program(bld, obj.includes, 'framewalk_to_beats', 'test_framewalk_to_beats', ['test/framewalk_to_beats_test.cc'])
482 create_ardour_test_program(bld, obj.includes, 'framepos_plus_beats', 'test_framepos_plus_beats', ['test/framepos_plus_beats_test.cc'])
483 create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc'])
484 create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
485 create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
486 create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
487 create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
488 create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
489 create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc'])
492 test/automation_list_property_test.cc
495 test/interpolation_test.cc
496 test/midi_clock_slave_test.cc
497 test/resampled_source_test.cc
498 test/framewalk_to_beats_test.cc
499 test/framepos_plus_beats_test.cc
500 test/framepos_minus_beats_test.cc
501 test/playlist_equivalent_regions_test.cc
502 test/playlist_layering_test.cc
503 test/region_naming_test.cc
504 test/control_surfaces_test.cc
509 # Tests that don't work
510 # test/playlist_read_test.cc
511 # test/audio_region_read_test.cc
512 # test/combine_regions_test.cc
513 # test/mantis_3356_test.cc
515 create_ardour_test_program(bld, obj.includes, 'libardour-tests', 'run-tests', test_sources)
517 # Tester to just load a session
518 session_load_tester = bld(features = 'cxx cxxprogram')
519 session_load_tester.source = '''
525 session_load_tester.includes = obj.includes
526 session_load_tester.includes.append ('test')
527 session_load_tester.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
528 'SAMPLERATE','XML','LRDF','COREAUDIO']
529 session_load_tester.use = ['libpbd','libmidipp','ardour']
530 session_load_tester.name = 'libardour-session-load-tester'
531 session_load_tester.target = 'load-session'
532 session_load_tester.install_path = ''
533 session_load_tester.defines = [
534 'PACKAGE="libardour3profile"',
535 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
536 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
537 'LOCALEDIR="' + os.path.join(
538 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
539 'VAMP_DIR="' + os.path.join(
540 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
542 if bld.env['FPU_OPTIMIZATION']:
543 session_load_tester.source += [ 'sse_functions_xmm.cc' ]
544 if (bld.env['build_target'] == 'i386'
545 or bld.env['build_target'] == 'i686'):
546 session_load_tester.source += [ 'sse_functions.s' ]
547 elif bld.env['build_target'] == 'x86_64':
548 session_load_tester.source += [ 'sse_functions_64bit.s' ]
551 for p in ['runpc', 'lots_of_regions', 'load_session']:
552 profilingobj = bld(features = 'cxx cxxprogram')
553 profilingobj.source = '''
558 profilingobj.source.append('test/profiling/%s.cc' % p)
560 profilingobj.includes = obj.includes
561 profilingobj.includes.append ('test')
562 profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
563 'SAMPLERATE','XML','LRDF','COREAUDIO']
564 profilingobj.use = ['libpbd','libmidipp','ardour']
565 profilingobj.name = 'libardour-profiling'
566 profilingobj.target = p
567 profilingobj.install_path = ''
568 profilingobj.defines = [
569 'PACKAGE="libardour3profile"',
570 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
571 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
572 'LOCALEDIR="' + os.path.join(
573 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
574 'VAMP_DIR="' + os.path.join(
575 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
577 if bld.env['FPU_OPTIMIZATION']:
578 profilingobj.source += [ 'sse_functions_xmm.cc' ]
579 if (bld.env['build_target'] == 'i386'
580 or bld.env['build_target'] == 'i686'):
581 profilingobj.source += [ 'sse_functions.s' ]
582 elif bld.env['build_target'] == 'x86_64':
583 profilingobj.source += [ 'sse_functions_64bit.s' ]
585 def create_ardour_test_program(bld, includes, name, target, sources):
586 testobj = bld(features = 'cxx cxxprogram')
587 testobj.includes = includes + ['test', '../pbd', '..']
588 testobj.source = sources
589 testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
590 'SAMPLERATE','XML','LRDF','COREAUDIO']
591 testobj.use = ['libpbd','libmidipp','libevoral','libvamphost',
592 'libvampplugin','libtaglib','librubberband',
593 'libaudiographer','libltc','ardour','testcommon']
595 testobj.target = target
596 # not sure about install path
597 testobj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
599 'PACKAGE="libardour3test"',
600 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
601 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
602 'LOCALEDIR="' + os.path.join(
603 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
604 'VAMP_DIR="' + os.path.join(
605 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
612 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
616 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
620 autowaf.build_i18n_po(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
624 autowaf.build_i18n_mo(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,