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',
105 'location_importer.cc',
107 'lv2_bundled_search_path.cc',
109 'midi_automation_list_binder.cc',
111 'midi_clock_slave.cc',
112 'midi_diskstream.cc',
114 'midi_patch_manager.cc',
115 'midi_patch_search_path.cc',
117 'midi_playlist_source.cc',
120 'midi_ring_buffer.cc',
122 'midi_state_tracker.cc',
127 'monitor_processor.cc',
133 'pan_controllable.cc',
137 'panner_search_path.cc',
142 'playlist_factory.cc',
143 'playlist_source.cc',
154 'rc_configuration.cc',
155 'recent_sessions.cc',
157 'resampled_source.cc',
164 'route_group_member.cc',
170 'session_command.cc',
171 'session_configuration.cc',
172 'session_directory.cc',
177 'session_metadata.cc',
180 'session_playlists.cc',
181 'session_process.cc',
182 'session_rtevents.cc',
184 'session_state_utils.cc',
186 'session_transport.cc',
189 'sndfile_helpers.cc',
190 'sndfileimportable.cc',
197 'tape_file_matcher.cc',
200 'tempo_map_importer.cc',
204 'transient_detector.cc',
205 'unknown_processor.cc',
212 def flac_supported():
213 cmd = subprocess.Popen ("sndfile-info testfile.flac",
214 stdout = subprocess.PIPE,
215 stderr = subprocess.STDOUT, shell = True)
216 out = cmd.communicate()[0].decode('utf-8');
217 return re.search ('unknown format', out) == None
220 cmd = subprocess.Popen ("sndfile-info testfile.ogg",
221 stdout = subprocess.PIPE,
222 stderr = subprocess.STDOUT, shell = True)
223 out = cmd.communicate()[0].decode('utf-8');
224 return re.search ('unknown format', out) == None
227 autowaf.set_options(opt)
230 conf.load('compiler_cxx')
232 # we don't use hard-coded micro versions with ardour, so hard code it to zero
233 autowaf.build_version_files(
234 path_prefix + 'ardour/version.h',
235 path_prefix + 'version.cc',
236 'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0)
237 autowaf.configure(conf)
238 autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
239 atleast_version='0.3.2')
240 autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
241 atleast_version='0.118.2')
242 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
243 autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
244 atleast_version='0.4.0')
245 autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
246 atleast_version='0.1.0')
247 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
248 atleast_version='2.0')
249 if Options.options.lv2:
250 autowaf.check_pkg(conf, 'lv2', uselib_store='LV2',
251 atleast_version='1.0.0', mandatory=True)
252 autowaf.check_pkg(conf, 'lv2', uselib_store='NEW_LV2',
253 atleast_version='1.0.15', mandatory=False)
254 autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD',
255 atleast_version='0.14.0', mandatory=True)
256 autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD',
257 atleast_version='0.8.0', mandatory=True)
258 autowaf.check_pkg(conf, 'sratom-0', uselib_store='SRATOM',
259 atleast_version='0.2.0', mandatory=True)
260 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
261 atleast_version='0.14.0', mandatory=True)
262 autowaf.check_pkg(conf, 'lilv-0', uselib_store='NEW_LILV',
263 atleast_version='0.15.0', mandatory=False)
264 autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
265 atleast_version='0.6.0', mandatory=False)
266 conf.define ('LV2_SUPPORT', 1)
268 # autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH',
270 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT',
271 atleast_version='1.12.0', mandatory=False)
272 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
273 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
274 atleast_version='1.2.1')
275 autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
276 atleast_version='7.0.0')
278 # we don't try to detect this, since its part of our source tree
280 conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
281 conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it
283 conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
285 conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
286 conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False)
288 conf.check(header_name='jack/session.h', uselib = [ 'JACK' ],
289 define_name='HAVE_JACK_SESSION')
291 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
293 conf.check_cc(fragment = '''
294 #include <jack/jack.h>
295 void callback(jack_status_t code, const char* reason, void* arg) { return; }
296 int main(int argc, char **argv) {
298 jack_on_info_shutdown(c, callback, (void*) 0);
302 msg = 'Checking for jack_on_info_shutdown',
303 define_name = 'HAVE_JACK_ON_INFO_SHUTDOWN',
306 missing_jack_message = 'missing - a version of JACK that supports jack_port_set_latency_range() is required to compile Ardour3.'
308 conf.check_cc(fragment = '''
309 #include <jack/jack.h>
310 int main(int argc, char **argv) {
312 jack_latency_range_t r;
313 jack_port_set_latency_range(p, JackCaptureLatency, &r);
317 msg = 'Checking for new JACK latency API',
320 errmsg = missing_jack_message)
322 conf.check_cc(fragment = '''
323 #include <jack/jack.h>
324 int main(int argc, char **argv) {
325 jack_port_type_get_buffer_size((jack_client_t*)0, "");
329 msg = 'Checking for new jack_port_type_get_buffer_size',
332 errmsg = missing_jack_message)
334 conf.check_cc(fragment = '''
335 #include <jack/transport.h>
336 int main(int argc, char** argv) {
338 pos.valid & JackVideoFrameOffset;
342 msg = 'Checking for JackVideoFrameOffset',
343 define_name = 'HAVE_JACK_VIDEO_SUPPORT',
348 conf.define ('HAVE_FLAC', 1)
350 conf.define ('HAVE_OGG', 1)
352 conf.write_config_header('libardour-config.h', remove=False)
355 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
356 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
357 autowaf.check_header(conf, 'cxx', 'boost/scoped_ptr.hpp')
358 autowaf.check_header(conf, 'cxx', 'boost/ptr_container/ptr_list.hpp')
362 # Library version (UNIX style major, minor, micro)
363 # major increment <=> incompatible changes
364 # minor increment <=> compatible changes (additions)
365 # micro increment <=> no interface changes
366 LIBARDOUR_LIB_VERSION = "3.0.0."
369 if bld.is_defined ('INTERNAL_SHARED_LIBS'):
370 obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=libardour_sources)
372 obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=libardour_sources)
373 obj.cxxflags = [ '-fPIC' ]
374 obj.cflags = [ '-fPIC' ]
376 obj.export_includes = ['.']
377 obj.includes = ['.', '../surfaces/control_protocol', '..']
379 obj.target = 'ardour'
380 obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
381 'JACK','SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS',
382 'OSX','BOOST','CURL','DL']
383 obj.use = ['libpbd','libmidipp','libevoral','libvamphost',
384 'libvampplugin','libtaglib','librubberband',
385 'libaudiographer','libltc']
386 obj.vnum = LIBARDOUR_LIB_VERSION
387 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
389 'PACKAGE="' + I18N_PACKAGE + '"',
390 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
391 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
392 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
393 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
397 #obj.source += ' st_stretch.cc st_pitch.cc '
398 #obj.uselib += ' SOUNDTOUCH '
399 #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
401 if bld.is_defined('HAVE_LILV') :
402 obj.source += ['lv2_plugin.cc', 'lv2_evbuf.c', 'uri_map.cc']
403 obj.uselib += ['LILV']
404 if bld.is_defined('HAVE_SUIL'):
405 obj.uselib += ['SUIL']
407 if bld.is_defined('WINDOWS_VST_SUPPORT'):
408 obj.source += [ 'windows_vst_plugin.cc']
409 obj.includes += [ '../fst' ]
410 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
412 if bld.is_defined('LXVST_SUPPORT'):
413 obj.source += [ 'lxvst_plugin.cc', 'linux_vst_support.cc', 'linux_vst_info_file.cc' ]
414 obj.defines += [ 'LXVST_SUPPORT' ]
416 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
417 obj.source += [ 'session_vst.cc', 'vst_plugin.cc' ]
419 if bld.is_defined('HAVE_COREAUDIO'):
420 obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
421 obj.use += ['libappleutility']
423 if bld.is_defined('AUDIOUNIT_SUPPORT'):
424 obj.source += [ 'audio_unit.cc' ]
426 if Options.options.fpu_optimization:
427 if (bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686'):
428 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s' ]
429 elif bld.env['build_target'] == 'x86_64':
430 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s' ]
433 if bld.is_defined('ENABLE_NLS'):
434 mo_files = bld.path.ant_glob('po/*.mo')
436 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
437 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
438 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
441 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
443 # only build these common sources once
444 testcommon = bld(features = 'cxx')
445 testcommon.includes = obj.includes + ['test', '../pbd', '..']
446 testcommon.source = ['test/test_globals.cc', 'test/testrunner.cc', 'test/test_needing_session.cc',
447 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc' ]
448 testcommon.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
449 'SAMPLERATE','XML','LRDF','COREAUDIO']
450 testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost',
451 'libvampplugin','libtaglib','librubberband',
452 'libaudiographer','libltc','ardour']
453 testcommon.defines = [
454 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
455 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
456 'LOCALEDIR="' + os.path.join(
457 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
458 'VAMP_DIR="' + os.path.join(
459 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
461 testcommon.name = 'testcommon'
463 if bld.env['FPU_OPTIMIZATION']:
464 testcommon.source += [ 'sse_functions_xmm.cc' ]
465 if (bld.env['build_target'] == 'i386'
466 or bld.env['build_target'] == 'i686'):
467 testcommon.source += [ 'sse_functions.s' ]
468 elif bld.env['build_target'] == 'x86_64':
469 testcommon.source += [ 'sse_functions_64bit.s' ]
471 if bld.env['SINGLE_TESTS']:
472 create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
473 create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
474 create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
475 create_ardour_test_program(bld, obj.includes, 'interpolation', 'test_interpolation', ['test/interpolation_test.cc'])
476 create_ardour_test_program(bld, obj.includes, 'midi_clock_slave', 'test_midi_clock_slave', ['test/midi_clock_slave_test.cc'])
477 create_ardour_test_program(bld, obj.includes, 'resampled_source', 'test_resampled_source', ['test/resampled_source_test.cc'])
478 create_ardour_test_program(bld, obj.includes, 'framewalk_to_beats', 'test_framewalk_to_beats', ['test/framewalk_to_beats_test.cc'])
479 create_ardour_test_program(bld, obj.includes, 'framepos_plus_beats', 'test_framepos_plus_beats', ['test/framepos_plus_beats_test.cc'])
480 create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc'])
481 create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
482 create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
483 create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
484 create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
485 create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
488 test/automation_list_property_test.cc
491 test/interpolation_test.cc
492 test/midi_clock_slave_test.cc
493 test/resampled_source_test.cc
494 test/framewalk_to_beats_test.cc
495 test/framepos_plus_beats_test.cc
496 test/framepos_minus_beats_test.cc
497 test/playlist_equivalent_regions_test.cc
498 test/playlist_layering_test.cc
499 test/region_naming_test.cc
500 test/control_surfaces_test.cc
504 # Tests that don't work
505 # test/playlist_read_test.cc
506 # test/audio_region_read_test.cc
507 # test/combine_regions_test.cc
508 # test/mantis_3356_test.cc
510 create_ardour_test_program(bld, obj.includes, 'libardour-tests', 'run-tests', test_sources)
512 # Tester to just load a session
513 session_load_tester = bld(features = 'cxx cxxprogram')
514 session_load_tester.source = '''
520 session_load_tester.includes = obj.includes
521 session_load_tester.includes.append ('test')
522 session_load_tester.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
523 'SAMPLERATE','XML','LRDF','COREAUDIO']
524 session_load_tester.use = ['libpbd','libmidipp','ardour']
525 session_load_tester.name = 'libardour-session-load-tester'
526 session_load_tester.target = 'load-session'
527 session_load_tester.install_path = ''
528 session_load_tester.defines = [
529 'PACKAGE="libardour3profile"',
530 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
531 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
532 'LOCALEDIR="' + os.path.join(
533 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
534 'VAMP_DIR="' + os.path.join(
535 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
537 if bld.env['FPU_OPTIMIZATION']:
538 session_load_tester.source += [ 'sse_functions_xmm.cc' ]
539 if (bld.env['build_target'] == 'i386'
540 or bld.env['build_target'] == 'i686'):
541 session_load_tester.source += [ 'sse_functions.s' ]
542 elif bld.env['build_target'] == 'x86_64':
543 session_load_tester.source += [ 'sse_functions_64bit.s' ]
546 for p in ['runpc', 'lots_of_regions', 'load_session']:
547 profilingobj = bld(features = 'cxx cxxprogram')
548 profilingobj.source = '''
553 profilingobj.source.append('test/profiling/%s.cc' % p)
555 profilingobj.includes = obj.includes
556 profilingobj.includes.append ('test')
557 profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
558 'SAMPLERATE','XML','LRDF','COREAUDIO']
559 profilingobj.use = ['libpbd','libmidipp','ardour']
560 profilingobj.name = 'libardour-profiling'
561 profilingobj.target = p
562 profilingobj.install_path = ''
563 profilingobj.defines = [
564 'PACKAGE="libardour3profile"',
565 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
566 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
567 'LOCALEDIR="' + os.path.join(
568 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
569 'VAMP_DIR="' + os.path.join(
570 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
572 if bld.env['FPU_OPTIMIZATION']:
573 profilingobj.source += [ 'sse_functions_xmm.cc' ]
574 if (bld.env['build_target'] == 'i386'
575 or bld.env['build_target'] == 'i686'):
576 profilingobj.source += [ 'sse_functions.s' ]
577 elif bld.env['build_target'] == 'x86_64':
578 profilingobj.source += [ 'sse_functions_64bit.s' ]
580 def create_ardour_test_program(bld, includes, name, target, sources):
581 testobj = bld(features = 'cxx cxxprogram')
582 testobj.includes = includes + ['test', '../pbd', '..']
583 testobj.source = sources
584 testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
585 'SAMPLERATE','XML','LRDF','COREAUDIO']
586 testobj.use = ['libpbd','libmidipp','libevoral','libvamphost',
587 'libvampplugin','libtaglib','librubberband',
588 'libaudiographer','libltc','ardour','testcommon']
590 testobj.target = target
591 # not sure about install path
592 testobj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
594 'PACKAGE="libardour3test"',
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') + '"'
607 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
611 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
615 autowaf.build_i18n_po(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,
619 autowaf.build_i18n_mo(bld, top, 'libs/ardour', I18N_PACKAGE, libardour_sources,