2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
9 # default state file version for this build
10 CURRENT_SESSION_FILE_VERSION = 3001
12 # Variables for 'waf dist'
13 APPNAME = 'libardour3'
14 I18N_PACKAGE = 'ardour3'
20 path_prefix = 'libs/ardour/'
26 'audio_diskstream.cc',
29 'audio_playlist_importer.cc',
30 'audio_playlist_source.cc',
32 'audio_region_importer.cc',
34 'audio_track_importer.cc',
37 'audiofile_tagger.cc',
44 'automation_control.cc',
46 'automation_watch.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',
106 'ladspa_search_path.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',
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',
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 if Options.options.dist_target == 'auto':
246 if re.search ("linux", sys.platform) != None:
247 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
248 if Options.options.dist_target == 'mingw':
249 autowaf.check_pkg(conf, 'portaudio-2.0', uselib_store='PORTAUDIO',
250 atleast_version='19')
251 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
252 autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
253 atleast_version='0.4.0')
254 autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
255 atleast_version='0.1.0')
256 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
257 atleast_version='2.0')
258 if Options.options.lv2:
259 autowaf.check_pkg(conf, 'lv2', uselib_store='LV2',
260 atleast_version='1.0.0', mandatory=True)
261 autowaf.check_pkg(conf, 'lv2', uselib_store='NEW_LV2',
262 atleast_version='1.0.15', mandatory=False)
263 autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD',
264 atleast_version='0.14.0', mandatory=True)
265 autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD',
266 atleast_version='0.8.0', mandatory=True)
267 autowaf.check_pkg(conf, 'sratom-0', uselib_store='SRATOM',
268 atleast_version='0.2.0', mandatory=True)
269 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
270 atleast_version='0.14.0', mandatory=True)
271 autowaf.check_pkg(conf, 'lilv-0', uselib_store='NEW_LILV',
272 atleast_version='0.15.0', mandatory=False)
273 autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
274 atleast_version='0.6.0', mandatory=False)
275 conf.define ('LV2_SUPPORT', 1)
277 # autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH',
279 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT',
280 atleast_version='1.12.0', mandatory=False)
281 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
282 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
283 atleast_version='1.2.1')
284 autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
285 atleast_version='7.0.0')
287 # we don't try to detect this, since its part of our source tree
289 conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
290 conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it
292 conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
294 conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
295 conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False)
297 conf.check(header_name='jack/session.h', uselib = [ 'JACK' ],
298 define_name='HAVE_JACK_SESSION')
300 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
302 conf.check_cc(fragment = '''
303 #include <jack/jack.h>
304 void callback(jack_status_t code, const char* reason, void* arg) { return; }
305 int main(int argc, char **argv) {
307 jack_on_info_shutdown(c, callback, (void*) 0);
311 msg = 'Checking for jack_on_info_shutdown',
312 define_name = 'HAVE_JACK_ON_INFO_SHUTDOWN',
315 missing_jack_message = 'missing - a version of JACK that supports jack_port_set_latency_range() is required to compile Ardour3.'
317 conf.check_cc(fragment = '''
318 #include <jack/jack.h>
319 int main(int argc, char **argv) {
321 jack_latency_range_t r;
322 jack_port_set_latency_range(p, JackCaptureLatency, &r);
326 msg = 'Checking for new JACK latency API',
329 errmsg = missing_jack_message)
331 conf.check_cc(fragment = '''
332 #include <jack/jack.h>
333 int main(int argc, char **argv) {
334 jack_port_type_get_buffer_size((jack_client_t*)0, "");
338 msg = 'Checking for new jack_port_type_get_buffer_size',
341 errmsg = missing_jack_message)
343 conf.check_cc(fragment = '''
344 #include <jack/transport.h>
345 int main(int argc, char** argv) {
347 pos.valid & JackVideoFrameOffset;
351 msg = 'Checking for JackVideoFrameOffset',
352 define_name = 'HAVE_JACK_VIDEO_SUPPORT',
357 conf.define ('HAVE_FLAC', 1)
359 conf.define ('HAVE_OGG', 1)
361 conf.write_config_header('libardour-config.h', remove=False)
364 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
365 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
366 autowaf.check_header(conf, 'cxx', 'boost/scoped_ptr.hpp')
367 autowaf.check_header(conf, 'cxx', 'boost/ptr_container/ptr_list.hpp')
371 # Library version (UNIX style major, minor, micro)
372 # major increment <=> incompatible changes
373 # minor increment <=> compatible changes (additions)
374 # micro increment <=> no interface changes
375 LIBARDOUR_LIB_VERSION = "3.0.0."
378 if bld.is_defined ('INTERNAL_SHARED_LIBS'):
379 obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=libardour_sources)
381 obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=libardour_sources)
382 obj.cxxflags = [ '-fPIC' ]
383 obj.cflags = [ '-fPIC' ]
385 obj.export_includes = ['.']
386 obj.includes = ['.', '../surfaces/control_protocol', '..']
388 obj.target = 'ardour'
389 obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
390 'JACK', 'ALSA', 'PORTAUDIO', 'SNDFILE','SAMPLERATE','LRDF',
391 'AUDIOUNITS', 'OSX','BOOST','CURL','DL']
392 obj.use = ['libpbd','libmidipp','libevoral','libvamphost',
393 'libvampplugin','libtaglib','librubberband',
394 'libaudiographer','libltc']
395 obj.vnum = LIBARDOUR_LIB_VERSION
396 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
398 'PACKAGE="' + I18N_PACKAGE + '"',
399 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
400 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
401 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
402 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
406 #obj.source += ' st_stretch.cc st_pitch.cc '
407 #obj.uselib += ' SOUNDTOUCH '
408 #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
410 if bld.is_defined('HAVE_LILV') :
411 obj.source += ['lv2_plugin.cc', 'lv2_evbuf.c', 'uri_map.cc']
412 obj.uselib += ['LILV']
413 if bld.is_defined('HAVE_SUIL'):
414 obj.uselib += ['SUIL']
416 if bld.is_defined('WINDOWS_VST_SUPPORT'):
417 obj.source += [ 'windows_vst_plugin.cc']
418 obj.includes += [ '../fst' ]
419 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
421 if bld.is_defined('LXVST_SUPPORT'):
422 obj.source += [ 'lxvst_plugin.cc', 'linux_vst_support.cc', 'linux_vst_info_file.cc' ]
423 obj.defines += [ 'LXVST_SUPPORT' ]
425 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
426 obj.source += [ 'session_vst.cc', 'vst_plugin.cc' ]
428 if bld.is_defined('HAVE_COREAUDIO'):
429 obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
430 obj.use += ['libappleutility']
432 if bld.is_defined('AUDIOUNIT_SUPPORT'):
433 obj.source += [ 'audio_unit.cc' ]
435 if Options.options.fpu_optimization:
436 if (bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686'):
437 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s' ]
438 elif bld.env['build_target'] == 'x86_64':
439 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s' ]
442 if bld.is_defined('ENABLE_NLS'):
443 mo_files = bld.path.ant_glob('po/*.mo')
445 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
446 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
447 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
450 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
452 # only build these common sources once
453 testcommon = bld(features = 'cxx')
454 testcommon.includes = obj.includes + ['test', '../pbd', '..']
455 testcommon.source = ['test/test_globals.cc', 'test/testrunner.cc', 'test/test_needing_session.cc',
456 'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc']
457 testcommon.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
458 'SAMPLERATE','XML','LRDF','COREAUDIO']
459 testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost',
460 'libvampplugin','libtaglib','librubberband',
461 'libaudiographer','libltc','ardour']
462 testcommon.defines = [
463 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
464 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
465 'LOCALEDIR="' + os.path.join(
466 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
467 'VAMP_DIR="' + os.path.join(
468 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
470 testcommon.name = 'testcommon'
472 if bld.env['FPU_OPTIMIZATION']:
473 testcommon.source += [ 'sse_functions_xmm.cc' ]
474 if (bld.env['build_target'] == 'i386'
475 or bld.env['build_target'] == 'i686'):
476 testcommon.source += [ 'sse_functions.s' ]
477 elif bld.env['build_target'] == 'x86_64':
478 testcommon.source += [ 'sse_functions_64bit.s' ]
480 if bld.env['SINGLE_TESTS']:
481 create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
482 create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
483 create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
484 create_ardour_test_program(bld, obj.includes, 'interpolation', 'test_interpolation', ['test/interpolation_test.cc'])
485 create_ardour_test_program(bld, obj.includes, 'midi_clock_slave', 'test_midi_clock_slave', ['test/midi_clock_slave_test.cc'])
486 create_ardour_test_program(bld, obj.includes, 'resampled_source', 'test_resampled_source', ['test/resampled_source_test.cc'])
487 create_ardour_test_program(bld, obj.includes, 'framewalk_to_beats', 'test_framewalk_to_beats', ['test/framewalk_to_beats_test.cc'])
488 create_ardour_test_program(bld, obj.includes, 'framepos_plus_beats', 'test_framepos_plus_beats', ['test/framepos_plus_beats_test.cc'])
489 create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc'])
490 create_ardour_test_program(bld, obj.includes, 'jack_utils', 'test_jack_utils', ['test/jack_utils_test.cc'])
491 create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
492 create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
493 create_ardour_test_program(bld, obj.includes, 'plugins_test', 'test_plugins', ['test/plugins_test.cc'])
494 create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
495 create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
496 create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
497 create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc'])
500 test/automation_list_property_test.cc
503 test/interpolation_test.cc
504 test/midi_clock_slave_test.cc
505 test/resampled_source_test.cc
506 test/framewalk_to_beats_test.cc
507 test/framepos_plus_beats_test.cc
508 test/framepos_minus_beats_test.cc
509 test/jack_utils_test.cc
510 test/playlist_equivalent_regions_test.cc
511 test/playlist_layering_test.cc
513 test/region_naming_test.cc
514 test/control_surfaces_test.cc
519 # Tests that don't work
520 # test/playlist_read_test.cc
521 # test/audio_region_read_test.cc
522 # test/combine_regions_test.cc
523 # test/mantis_3356_test.cc
525 create_ardour_test_program(bld, obj.includes, 'libardour-tests', 'run-tests', test_sources)
527 # Tester to just load a session
528 session_load_tester = bld(features = 'cxx cxxprogram')
529 session_load_tester.source = '''
535 session_load_tester.includes = obj.includes
536 session_load_tester.includes.append ('test')
537 session_load_tester.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
538 'SAMPLERATE','XML','LRDF','COREAUDIO']
539 session_load_tester.use = ['libpbd','libmidipp','ardour']
540 session_load_tester.name = 'libardour-session-load-tester'
541 session_load_tester.target = 'load-session'
542 session_load_tester.install_path = ''
543 session_load_tester.defines = [
544 'PACKAGE="libardour3profile"',
545 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
546 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
547 'LOCALEDIR="' + os.path.join(
548 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
549 'VAMP_DIR="' + os.path.join(
550 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
552 if bld.env['FPU_OPTIMIZATION']:
553 session_load_tester.source += [ 'sse_functions_xmm.cc' ]
554 if (bld.env['build_target'] == 'i386'
555 or bld.env['build_target'] == 'i686'):
556 session_load_tester.source += [ 'sse_functions.s' ]
557 elif bld.env['build_target'] == 'x86_64':
558 session_load_tester.source += [ 'sse_functions_64bit.s' ]
561 for p in ['runpc', 'lots_of_regions', 'load_session']:
562 profilingobj = bld(features = 'cxx cxxprogram')
563 profilingobj.source = '''
568 profilingobj.source.append('test/profiling/%s.cc' % p)
570 profilingobj.includes = obj.includes
571 profilingobj.includes.append ('test')
572 profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
573 'SAMPLERATE','XML','LRDF','COREAUDIO']
574 profilingobj.use = ['libpbd','libmidipp','ardour']
575 profilingobj.name = 'libardour-profiling'
576 profilingobj.target = p
577 profilingobj.install_path = ''
578 profilingobj.defines = [
579 'PACKAGE="libardour3profile"',
580 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
581 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
582 'LOCALEDIR="' + os.path.join(
583 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
584 'VAMP_DIR="' + os.path.join(
585 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
587 if bld.env['FPU_OPTIMIZATION']:
588 profilingobj.source += [ 'sse_functions_xmm.cc' ]
589 if (bld.env['build_target'] == 'i386'
590 or bld.env['build_target'] == 'i686'):
591 profilingobj.source += [ 'sse_functions.s' ]
592 elif bld.env['build_target'] == 'x86_64':
593 profilingobj.source += [ 'sse_functions_64bit.s' ]
595 def create_ardour_test_program(bld, includes, name, target, sources):
596 testobj = bld(features = 'cxx cxxprogram')
597 testobj.includes = includes + ['test', '../pbd', '..']
598 testobj.source = sources
599 testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
600 'SAMPLERATE','XML','LRDF','COREAUDIO']
601 testobj.use = ['libpbd','libmidipp','libevoral','libvamphost',
602 'libvampplugin','libtaglib','librubberband',
603 'libaudiographer','libltc','ardour','testcommon']
605 testobj.target = target
606 # not sure about install path
607 testobj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
609 'PACKAGE="libardour3test"',
610 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
611 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
612 'LOCALEDIR="' + os.path.join(
613 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
614 'VAMP_DIR="' + os.path.join(
615 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
622 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
626 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
630 autowaf.build_i18n_po(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
634 autowaf.build_i18n_mo(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,