Consistent test source file naming (not the Ardour convention though, maybe should...
[ardour.git] / libs / ardour / wscript
index 58e22cca27f79c773f402a8c0cbe8e6c675f59dc..57b2a6cdeb307c48ffbea3f5a168ab293c5da117 100644 (file)
@@ -3,6 +3,8 @@ import autowaf
 import os
 import glob
 import Options
+import re
+import subprocess
 from w18n import build_i18n
 
 # Version of this package (even if built as a child)
@@ -17,6 +19,9 @@ LIBARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
 # micro increment <=> no interface changes
 LIBARDOUR_LIB_VERSION = '3.0.0'
 
+# default state file version for this build
+CURRENT_SESSION_FILE_VERSION = 3000
+
 # Variables for 'waf dist'
 APPNAME = 'libardour'
 VERSION = LIBARDOUR_VERSION
@@ -50,11 +55,13 @@ libardour_sources = [
        'automation.cc',
        'automation_control.cc',
        'automation_list.cc',
+       'bbt_time.cc',
        'beats_frames_converter.cc',
        'broadcast_info.cc',
        'buffer.cc',
        'buffer_set.cc',
        'bundle.cc',
+       'butler.cc',
        'chan_count.cc',
        'chan_mapping.cc',
        'configuration.cc',
@@ -119,6 +126,7 @@ libardour_sources = [
        'midi_track.cc',
        'mix.cc',
        'mtc_slave.cc',
+       'mtdm.cc',
        'mute_master.cc',
        'named_selection.cc',
        'onset_detector.cc',
@@ -181,6 +189,20 @@ libardour_sources = [
        'version.cc'
 ]
 
+def flac_supported():
+       cmd = subprocess.Popen ("sndfile-info testfile.flac", 
+                               stdout = subprocess.PIPE,
+                               stderr = subprocess.STDOUT, shell = True)
+       out = cmd.communicate()[0];
+       return re.search ('unknown format', out) == None
+
+def ogg_supported():
+       cmd = subprocess.Popen ("sndfile-info testfile.ogg", 
+                               stdout = subprocess.PIPE,
+                               stderr = subprocess.STDOUT, shell = True)
+       out = cmd.communicate()[0];
+       return re.search ('unknown format', out) == None
+
 def set_options(opt):
        autowaf.set_options(opt)
 
@@ -188,7 +210,7 @@ def configure(conf):
        autowaf.build_version_files(path_prefix+'ardour/version.h', path_prefix+'version.cc',
                        'libardour3', MAJOR, MINOR, MICRO)
        autowaf.configure(conf)
-       autowaf.check_tool(conf, 'compiler_cxx gas')
+       conf.check_tool('compiler_cxx gas')
        autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', atleast_version='0.3.2')
        autowaf.check_pkg(conf, 'jack', uselib_store='JACK', atleast_version='0.109.0')
        autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
@@ -207,21 +229,21 @@ def configure(conf):
        conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
        conf.define('USE_RUBBERBAND', 1)  # controls whether we actually use it
 
+       conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
+
        conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H')
        conf.check(header_name='wordexp.h', define_name='HAVE_WORDEXP')
        
-       if conf.env['IS_OSX']:
-               conf.check_cc (header_name = '/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h',
-                              linkflags = [ '-framework', 'CoreMIDI' ])
-               
-               conf.check_cc (header_name = '/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h',
-                              linkflags = [ '-framework', 'AudioToolbox' ])
-               
-               conf.check_cc (header_name = '/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h',
-                             define_name = 'HAVE_COREAUDIO')
-               
-               conf.check_cc (header_name = '/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h',
-                              define_name = 'HAVE_AUDIOUNITS', linkflags = [ '-framework', 'AudioUnit' ])
+       if flac_supported():
+               conf.define ('HAVE_FLAC', 1)
+               autowaf.display_msg(conf, 'Checking for FLAC support', True)
+       else:
+               autowaf.display_msg(conf, 'Checking for FLAC support', False)
+       if ogg_supported():
+               conf.define ('HAVE_OGG', 1)
+               autowaf.display_msg(conf, 'Checking for Ogg/Vorbis support', True)
+       else:
+               autowaf.display_msg(conf, 'Checking for Ogg/Vorbis Support', False)
 
        conf.write_config_header('libardour-config.h')
 
@@ -229,15 +251,16 @@ def configure(conf):
        autowaf.check_header(conf, 'boost/shared_ptr.hpp')
        autowaf.check_header(conf, 'boost/weak_ptr.hpp')
 
+
 def build(bld):
        # Library
        obj              = bld.new_task_gen('cxx', 'shlib')
        obj.source       = libardour_sources
        obj.export_incdirs = ['.']
-       obj.includes     = ['.', '../surfaces/control_protocol']
+       obj.includes     = ['.', '../surfaces/control_protocol', '..']
        obj.name         = 'libardour'
        obj.target       = 'ardour'
-       obj.uselib       = 'GLIBMM AUBIO SIGCPP XML UUID JACK SNDFILE SAMPLERATE LRDF'
+       obj.uselib       = 'GLIBMM AUBIO SIGCPP XML UUID JACK SNDFILE SAMPLERATE LRDF OSX'
        obj.uselib_local = 'libpbd libmidipp libevoral libvamphost libvampplugin libtaglib librubberband'
        obj.vnum         = LIBARDOUR_LIB_VERSION
        obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
@@ -251,6 +274,14 @@ def build(bld):
                        os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"']
        #obj.source += ' st_stretch.cc st_pitch.cc '
        #obj.uselib += ' SOUNDTOUCH '
+       #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
+       
+       obj.env.append_value('LINKFLAGS', 'default/libs/surfaces/control_protocol/smpte_1.o')
+       #
+       #       TODO: The above is an ugly hack that shouldn't be needed.  We really need
+       #       to refactor SMPTE out of libardour_cp to get rid of that circular dependency
+       #       alltogether.
+       #
        if bld.env['HAVE_SLV2']:
                obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc', 'uri_map.cc' ]
                obj.uselib += ' SLV2 '
@@ -259,14 +290,13 @@ def build(bld):
                obj.source += [ 'vst_plugin.cc', 'session_vst.cc' ]
 
        if bld.env['HAVE_COREAUDIO'] and bld.env['COREAUDIO']:
-               obj.sources += [ 'coreaudio.cc', 'caimportable.cc' ]
+               obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
 
-       if bld.env['HAVE_AUDIOUNITS'] and bld.env['AUDIOUNITS']:
-               obj.sources += [ 'audio_unit.cc' ]
+       if bld.env['HAVE_AUDIOUNITS'] or bld.env['HAVE_COREAUDIO']:
+               obj.uselib_local += ' libappleutility'  
 
-       if bld.env['IS_OSX']:
-               # this avoids issues with circular dependencies between libardour and libardour_cp.
-               obj.linkflags += '-undefined suppress -flat_namespace'
+       if bld.env['HAVE_AUDIOUNITS'] and bld.env['AUDIOUNITS']:
+               obj.source += [ 'audio_unit.cc' ]
 
        if bld.env['FPU_OPTIMIZATION']:
                obj.source += [ 'sse_functions_xmm.cc' ]
@@ -282,20 +312,21 @@ def build(bld):
                        lang = os.path.basename (mo).replace ('.mo', '')
                        bld.install_as (os.path.join (bld.env['PREFIX'], 'share', 'locale', lang, 'LC_MESSAGES', APPNAME + '.mo'), mo)
 
-       if bld.env['HAVE_CPPUNIT']:
+       if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
                # Unit tests
                testobj              = bld.new_task_gen('cxx', 'program')
                testobj.source       = '''
                        interpolation.cc
-                       tests/interpolation-test.cc
-                       tests/testrunner.cpp
+                       test/BBTTest.cpp
+                       test/InterpolationTest.cpp
+                       test/testrunner.cpp
                '''
                testobj.includes     = obj.includes + ['../pbd/']
                testobj.uselib       = 'CPPUNIT SIGCPP JACK GLIBMM SAMPLERATE'
+               testobj.name         = 'libardour-tests'
                testobj.target       = 'run-tests'
                testobj.install_path = ''
 
-
 def shutdown():
        autowaf.shutdown()