2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
10 # default state file version for this build
11 CURRENT_SESSION_FILE_VERSION = 3001
13 I18N_PACKAGE = 'ardour'
19 path_prefix = 'libs/ardour/'
27 'audio_diskstream.cc',
30 'audio_playlist_importer.cc',
31 'audio_playlist_source.cc',
33 'audio_region_importer.cc',
35 'audio_track_importer.cc',
38 'audiofile_tagger.cc',
45 'automation_control.cc',
47 'automation_watch.cc',
48 'beats_frames_converter.cc',
55 'capturing_processor.cc',
59 'control_protocol_manager.cc',
68 'dsp_load_calculator.cc',
69 'element_import_handler.cc',
70 'element_importer.cc',
75 'export_channel_configuration.cc',
78 'export_format_base.cc',
79 'export_format_manager.cc',
80 'export_format_specification.cc',
82 'export_graph_builder.cc',
85 'export_profile_manager.cc',
89 'filename_extensions.cc',
90 'filesystem_paths.cc',
100 'internal_return.cc',
109 'location_importer.cc',
112 'midi_automation_list_binder.cc',
114 'midi_channel_filter.cc',
115 'midi_clock_slave.cc',
116 'midi_diskstream.cc',
118 'midi_patch_manager.cc',
120 'midi_playlist_source.cc',
123 'midi_ring_buffer.cc',
124 'midi_scene_change.cc',
125 'midi_scene_changer.cc',
127 'midi_state_tracker.cc',
131 'midiport_manager.cc',
133 'monitor_processor.cc',
141 'pan_controllable.cc',
146 'parameter_descriptor.cc',
149 'playlist_factory.cc',
150 'playlist_source.cc',
162 'rc_configuration.cc',
163 'recent_sessions.cc',
165 'resampled_source.cc',
172 'route_group_member.cc',
180 'session_command.cc',
181 'session_configuration.cc',
182 'session_directory.cc',
187 'session_metadata.cc',
190 'session_playlists.cc',
191 'session_process.cc',
192 'session_rtevents.cc',
194 'session_state_utils.cc',
196 'session_transport.cc',
199 'sndfile_helpers.cc',
200 'sndfileimportable.cc',
202 'soundcloud_upload.cc',
210 'tape_file_matcher.cc',
213 'tempo_map_importer.cc',
217 'transient_detector.cc',
219 'unknown_processor.cc',
226 def flac_supported():
227 cmd = subprocess.Popen ("sndfile-info testfile.flac",
228 stdout = subprocess.PIPE,
229 stderr = subprocess.STDOUT, shell = True)
230 out = cmd.communicate()[0].decode('utf-8');
231 return re.search ('unknown format', out) == None
234 cmd = subprocess.Popen ("sndfile-info testfile.ogg",
235 stdout = subprocess.PIPE,
236 stderr = subprocess.STDOUT, shell = True)
237 out = cmd.communicate()[0].decode('utf-8');
238 return re.search ('unknown format', out) == None
241 autowaf.set_options(opt)
244 conf.load('compiler_cxx')
246 # we don't use hard-coded micro versions with ardour, so hard code it to zero
247 autowaf.configure(conf)
248 autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
249 atleast_version='0.3.2')
250 autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO4',
251 atleast_version='0.4.0', mandatory=False)
252 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
253 if Options.options.dist_target != 'mingw':
254 if not Options.options.no_lrdf:
255 autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
256 atleast_version='0.4.0')
257 autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
258 atleast_version='0.3.2')
259 autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
260 atleast_version='0.1.0')
261 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
262 atleast_version='2.0')
264 if Options.options.lv2:
265 autowaf.check_pkg(conf, 'lv2', uselib_store='LV2',
266 atleast_version='1.0.0', mandatory=True)
267 autowaf.check_pkg(conf, 'lv2', uselib_store='LV2_1_2_0',
268 atleast_version='1.2.0', mandatory=False)
269 autowaf.check_pkg(conf, 'lv2', uselib_store='LV2_1_10_0',
270 atleast_version='1.10.0', mandatory=False)
271 autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD',
272 atleast_version='0.14.0', mandatory=True)
273 autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD',
274 atleast_version='0.8.0', mandatory=True)
275 autowaf.check_pkg(conf, 'sratom-0', uselib_store='SRATOM',
276 atleast_version='0.2.0', mandatory=True)
277 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
278 atleast_version='0.14.0', mandatory=True)
279 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV_0_16_0',
280 atleast_version='0.16.0', mandatory=False)
281 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV_0_19_2',
282 atleast_version='0.19.2', mandatory=False)
283 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV_0_21_3',
284 atleast_version='0.21.3', mandatory=False)
285 autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
286 atleast_version='0.6.0', mandatory=False)
287 conf.define ('LV2_SUPPORT', 1)
289 # autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH',
291 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT',
292 atleast_version='1.12.0', mandatory=False)
293 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
294 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
295 atleast_version='1.2.1')
296 autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
297 atleast_version='7.0.0')
299 # controls whether we actually use it in preference to soundtouch
300 # Note: as of 2104, soundtouch (WSOLA) has been out-of-use for years.
301 conf.define('USE_RUBBERBAND', 1)
303 conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
305 conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
306 conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False)
308 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
311 conf.define ('HAVE_FLAC', 1)
313 conf.define ('HAVE_OGG', 1)
315 conf.write_config_header('libardour-config.h', remove=False)
318 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
319 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
320 autowaf.check_header(conf, 'cxx', 'boost/scoped_ptr.hpp')
321 autowaf.check_header(conf, 'cxx', 'boost/ptr_container/ptr_list.hpp')
322 if conf.env['WINDOWS_VST_SUPPORT'] == True and Options.options.dist_target == 'mingw':
323 conf.check(compiler='cxx',
326 uselib_store='GDI32')
330 # Library version (UNIX style major, minor, micro)
331 # major increment <=> incompatible changes
332 # minor increment <=> compatible changes (additions)
333 # micro increment <=> no interface changes
334 LIBARDOUR_LIB_VERSION = "3.0.0"
336 sources = libardour_sources
337 if bld.is_tracks_build():
338 sources += [ 'engine_state_controller.cc' ]
341 if bld.is_defined ('INTERNAL_SHARED_LIBS'):
342 obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=sources)
343 # macros for this shared library
344 obj.defines = [ 'LIBARDOUR_DLL_EXPORTS=1' ]
346 obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=sources)
347 obj.cxxflags = [ bld.env['compiler_flags_dict']['pic'] ]
348 obj.cflags = [ bld.env['compiler_flags_dict']['pic'] ]
351 obj.export_includes = ['.']
352 obj.includes = ['.', '../surfaces/control_protocol', '..']
353 obj.name = 'libardour'
354 obj.target = 'ardour'
355 obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
356 'SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS',
357 'OSX','BOOST','CURL','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND']
358 obj.use = ['libpbd','libmidipp','libevoral',
362 if bld.env['build_target'] != 'mingw':
364 if bld.is_defined('USE_EXTERNAL_LIBS'):
365 obj.uselib.extend(['VAMPSDK', 'LIBLTC'])
367 obj.use.extend(['librubberband', 'libltc_includes', 'libltc'])
369 obj.vnum = LIBARDOUR_LIB_VERSION
370 obj.install_path = bld.env['LIBDIR']
372 'PACKAGE="' + I18N_PACKAGE + str(bld.env['MAJOR']) + '"',
373 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
374 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
375 'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
376 'LIBARDOUR="' + bld.env['lwrcase_dirname'] + '"',
380 #obj.source += ' st_stretch.cc st_pitch.cc '
381 #obj.uselib += ' SOUNDTOUCH '
382 #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
384 if bld.is_defined('HAVE_LILV') :
385 obj.source += ['lv2_plugin.cc', 'lv2_evbuf.c', 'uri_map.cc']
386 obj.uselib += ['LILV']
387 if bld.is_defined('HAVE_SUIL'):
388 obj.uselib += ['SUIL']
390 if bld.is_defined('WINDOWS_VST_SUPPORT'):
391 obj.source += [ 'windows_vst_plugin.cc']
392 obj.includes += [ '../fst' ]
393 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
394 if bld.env['build_target'] == 'mingw':
395 obj.use += [ 'vstwin' ]
396 obj.uselib += ['GDI32']
398 if bld.is_defined('LXVST_SUPPORT'):
399 obj.source += [ 'lxvst_plugin.cc', 'linux_vst_support.cc' ]
400 obj.defines += [ 'LXVST_SUPPORT' ]
402 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
403 obj.source += [ 'session_vst.cc', 'vst_plugin.cc', 'vst_info_file.cc' ]
405 if bld.is_defined('HAVE_COREAUDIO'):
406 obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
407 obj.use += ['libappleutility']
409 if bld.is_defined('AUDIOUNIT_SUPPORT'):
410 obj.source += [ 'audio_unit.cc' ]
414 if Options.options.fpu_optimization:
415 if (bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686'):
416 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s', ]
417 avx_sources = [ 'sse_functions_avx_linux.cc' ]
418 elif bld.env['build_target'] == 'x86_64':
419 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s', ]
420 avx_sources = [ 'sse_functions_avx_linux.cc' ]
421 elif bld.env['build_target'] == 'mingw':
422 # usability of the 64 bit windows assembler depends on the compiler target,
423 # not the build host, which in turn can only be inferred from the name
425 if re.search ('x86_64-w64', str(bld.env['CC'])):
426 obj.source += [ 'sse_functions_xmm.cc' ]
427 obj.source += [ 'sse_functions_64bit_win.s', 'sse_avx_functions_64bit_win.s' ]
428 avx_sources = [ 'sse_functions_avx.cc' ]
431 # as long as we want to use AVX intrinsics in this file,
432 # compile it with -mavx flag - append avx flag to the existing
433 avx_cxxflags = list(bld.env['CXXFLAGS'])
434 avx_cxxflags.append (bld.env['compiler_flags_dict']['avx'])
435 avx_cxxflags.append (bld.env['compiler_flags_dict']['pic'])
436 bld(features = 'cxx',
437 source = avx_sources,
438 cxxflags = avx_cxxflags,
440 use = [ 'libtimecode', 'libpbd', 'libevoral', ],
441 target = 'sse_avx_functions')
443 obj.use += ['sse_avx_functions' ]
446 if bld.is_defined('ENABLE_NLS'):
447 mo_files = bld.path.ant_glob('po/*.mo')
449 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
450 bld.install_as(os.path.join(bld.env['LOCALEDIR'], lang, 'LC_MESSAGES', I18N_PACKAGE + str(bld.env['MAJOR']) + '.mo'),
453 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
455 # only build these common sources once
456 testcommon = bld(features = 'cxx')
457 testcommon.includes = obj.includes + ['test', '../pbd', '..']
458 testcommon.source = ['test/testrunner.cc', 'test/test_needing_session.cc',
459 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc', 'test/test_ui.cc']
460 testcommon.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
461 'SAMPLERATE','XML','LRDF','COREAUDIO','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND']
462 testcommon.use = ['libpbd','libmidipp','libevoral',
463 'libaudiographer','libardour']
464 if bld.is_defined('USE_EXTERNAL_LIBS'):
465 testcommon.uselib.extend(['LIBLTC',])
467 testcommon.use.extend(['libltc', 'librubberband'])
468 testcommon.defines = [
469 'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'test"',
470 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
471 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
472 'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
474 testcommon.name = 'testcommon'
476 if bld.env['SINGLE_TESTS']:
477 create_ardour_test_program(bld, obj.includes, 'audio_engine_test', 'test_audio_engine', ['test/audio_engine_test.cc'])
478 create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
479 create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
480 create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
481 create_ardour_test_program(bld, obj.includes, 'interpolation', 'test_interpolation', ['test/interpolation_test.cc'])
482 create_ardour_test_program(bld, obj.includes, 'midi_clock_slave', 'test_midi_clock_slave', ['test/midi_clock_slave_test.cc'])
483 create_ardour_test_program(bld, obj.includes, 'resampled_source', 'test_resampled_source', ['test/resampled_source_test.cc'])
484 create_ardour_test_program(bld, obj.includes, 'framewalk_to_beats', 'test_framewalk_to_beats', ['test/framewalk_to_beats_test.cc'])
485 create_ardour_test_program(bld, obj.includes, 'framepos_plus_beats', 'test_framepos_plus_beats', ['test/framepos_plus_beats_test.cc'])
486 create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc'])
487 create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
488 create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
489 create_ardour_test_program(bld, obj.includes, 'plugins_test', 'test_plugins', ['test/plugins_test.cc'])
490 create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
491 create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
492 create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
493 create_ardour_test_program(bld, obj.includes, 'sha1_test', 'test_sha1', ['test/sha1_test.cc'])
494 create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc'])
497 test/audio_engine_test.cc
498 test/automation_list_property_test.cc
501 test/interpolation_test.cc
502 test/midi_clock_slave_test.cc
503 test/resampled_source_test.cc
504 test/framewalk_to_beats_test.cc
505 test/framepos_plus_beats_test.cc
506 test/framepos_minus_beats_test.cc
507 test/playlist_equivalent_regions_test.cc
508 test/playlist_layering_test.cc
510 test/region_naming_test.cc
511 test/control_surfaces_test.cc
517 # Tests that don't work
518 # test/playlist_read_test.cc
519 # test/audio_region_read_test.cc
520 # test/combine_regions_test.cc
521 # test/mantis_3356_test.cc
523 create_ardour_test_program(bld, obj.includes, 'libardour-tests', 'run-tests', test_sources)
525 # Tester to just load a session
526 session_load_tester = bld(features = 'cxx cxxprogram')
527 session_load_tester.source = '''
533 session_load_tester.includes = obj.includes
534 session_load_tester.includes.append ('test')
535 session_load_tester.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
536 'SAMPLERATE','XML','LRDF','COREAUDIO']
537 session_load_tester.use = ['libpbd','libmidipp','libardour']
538 session_load_tester.name = 'libardour-session-load-tester'
539 session_load_tester.target = 'load-session'
540 session_load_tester.install_path = ''
541 session_load_tester.defines = [
542 'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'profile"',
543 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
544 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
545 'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
549 for p in ['runpc', 'lots_of_regions', 'load_session']:
550 profilingobj = bld(features = 'cxx cxxprogram')
551 profilingobj.source = '''
556 profilingobj.source.append('test/profiling/%s.cc' % p)
558 profilingobj.includes = obj.includes
559 profilingobj.includes.append ('test')
560 profilingobj.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
561 'SAMPLERATE','XML','LRDF','COREAUDIO']
562 profilingobj.use = ['libpbd','libmidipp','libardour']
563 profilingobj.name = 'libardour-profiling'
564 profilingobj.target = p
565 profilingobj.install_path = ''
566 profilingobj.defines = [
567 'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'profile"',
568 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
569 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
570 'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
573 def create_ardour_test_program(bld, includes, name, target, sources):
574 testobj = bld(features = 'cxx cxxprogram')
575 testobj.includes = includes + ['test', '../pbd', '..']
576 testobj.source = sources
577 testobj.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
578 'SAMPLERATE','XML','LRDF','COREAUDIO','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND']
579 testobj.use = ['libpbd','libmidipp','libevoral',
580 'libaudiographer','libardour','testcommon']
581 if bld.is_defined('USE_EXTERNAL_LIBS'):
582 testobj.uselib.extend(['LIBLTC'])
584 testobj.use.extend(['libltc'])
587 testobj.target = target
588 # not sure about install path
589 testobj.install_path = bld.env['LIBDIR']
591 'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'test"',
592 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
593 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
594 'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
601 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
605 autowaf.build_i18n(bld, top, 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
609 autowaf.build_i18n_po(bld, top, 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
613 autowaf.build_i18n_mo(bld, top, 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,