From 5f00d2f3a7afaccaeb9f3057d55d5e1e59c54e47 Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Sat, 26 Oct 2013 16:58:14 +0200 Subject: [PATCH] allow linking unbundled versions of some libraries (libltc, rubberband, taglib, vamp-sdk) --- gtk2_ardour/editor_timefx.cc | 2 +- gtk2_ardour/time_fx_dialog.cc | 2 +- gtk2_ardour/wscript | 8 ++++-- libs/ardour/ardour/audioanalyser.h | 2 +- libs/ardour/ardour/audiofile_tagger.h | 6 ++-- libs/ardour/ardour/session.h | 3 +- libs/ardour/ardour/slave.h | 2 +- libs/ardour/audioanalyser.cc | 2 +- libs/ardour/audiofile_tagger.cc | 12 ++++---- libs/ardour/rb_effect.cc | 3 +- libs/ardour/wscript | 31 +++++++++++++++------ libs/libltc/wscript | 11 ++++++-- libs/rubberband/wscript | 10 +++++-- libs/taglib/wscript | 10 +++++-- libs/vamp-plugins/AmplitudeFollower.h | 2 +- libs/vamp-plugins/Onset.h | 2 +- libs/vamp-plugins/OnsetDetect.h | 2 +- libs/vamp-plugins/PercussionOnsetDetector.h | 2 +- libs/vamp-plugins/SpectralCentroid.h | 2 +- libs/vamp-plugins/ZeroCrossing.h | 2 +- libs/vamp-plugins/plugins.cpp | 4 +-- libs/vamp-sdk/wscript | 16 +++++++---- wscript | 17 ++++++++--- 23 files changed, 102 insertions(+), 51 deletions(-) diff --git a/gtk2_ardour/editor_timefx.cc b/gtk2_ardour/editor_timefx.cc index 2f0b09ed17..06823fda19 100644 --- a/gtk2_ardour/editor_timefx.cc +++ b/gtk2_ardour/editor_timefx.cc @@ -45,7 +45,7 @@ #include "ardour/stretch.h" #ifdef USE_RUBBERBAND -#include "rubberband/RubberBandStretcher.h" +#include using namespace RubberBand; #endif diff --git a/gtk2_ardour/time_fx_dialog.cc b/gtk2_ardour/time_fx_dialog.cc index 15d46f10ad..5d8bf57a3b 100644 --- a/gtk2_ardour/time_fx_dialog.cc +++ b/gtk2_ardour/time_fx_dialog.cc @@ -37,7 +37,7 @@ #include "region_selection.h" #ifdef USE_RUBBERBAND -#include "rubberband/RubberBandStretcher.h" +#include using namespace RubberBand; #endif diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index ddafbb9e3a..3ca90744c7 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -417,11 +417,13 @@ def build(bld): obj.uselib += ' AUDIOUNITS OSX GTKOSX LO ' obj.use = [ 'libpbd', 'libmidipp', - 'libtaglib', 'ardour', 'libardour_cp', - 'libgtkmm2ext', - 'libtaglib' ] + 'libgtkmm2ext'] + if bld.is_defined('USE_EXTERNAL_LIBS'): + obj.uselib += ' TAGLIB' + else: + obj.use.append('libtaglib') if sys.platform == 'darwin': obj.use += ' libappleutility' obj.defines = [ diff --git a/libs/ardour/ardour/audioanalyser.h b/libs/ardour/ardour/audioanalyser.h index 035390e99f..f525cbd99f 100644 --- a/libs/ardour/ardour/audioanalyser.h +++ b/libs/ardour/ardour/audioanalyser.h @@ -25,7 +25,7 @@ #include #include #include -#include "vamp-sdk/Plugin.h" +#include #include "ardour/types.h" namespace ARDOUR { diff --git a/libs/ardour/ardour/audiofile_tagger.h b/libs/ardour/ardour/audiofile_tagger.h index 0519e2233c..656626a5f3 100644 --- a/libs/ardour/ardour/audiofile_tagger.h +++ b/libs/ardour/ardour/audiofile_tagger.h @@ -23,9 +23,9 @@ #include -#include "taglib/tag.h" -#include "taglib/taglib.h" -#include "taglib/xiphcomment.h" +#include +#include +#include namespace ARDOUR { diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 75a5dce8ef..02e883ed11 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -36,6 +36,8 @@ #include +#include + #include "pbd/error.h" #include "pbd/event_loop.h" #include "pbd/rcu.h" @@ -48,7 +50,6 @@ #include "midi++/types.h" #include "timecode/time.h" -#include "ltc/ltc.h" #include "ardour/ardour.h" #include "ardour/chan_count.h" diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index a0b7b878e4..ca3f618af1 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -25,11 +25,11 @@ #include #include +#include #include "pbd/signals.h" #include "timecode/time.h" -#include "ltc/ltc.h" #include "ardour/types.h" #include "midi++/parser.h" diff --git a/libs/ardour/audioanalyser.cc b/libs/ardour/audioanalyser.cc index cf8329ae9c..fd30744a74 100644 --- a/libs/ardour/audioanalyser.cc +++ b/libs/ardour/audioanalyser.cc @@ -19,7 +19,7 @@ #include -#include "vamp-hostsdk/PluginLoader.h" +#include #include #include diff --git a/libs/ardour/audiofile_tagger.cc b/libs/ardour/audiofile_tagger.cc index 57650860ee..61a05d49ce 100644 --- a/libs/ardour/audiofile_tagger.cc +++ b/libs/ardour/audiofile_tagger.cc @@ -24,12 +24,12 @@ #include "pbd/convert.h" -#include "taglib/fileref.h" -#include "taglib/flacfile.h" -#include "taglib/oggfile.h" -#include "taglib/tag.h" -#include "taglib/taglib.h" -#include "taglib/xiphcomment.h" +#include +#include +#include +#include +#include +#include /* Convert string to TagLib::String */ #define TL_STR(string) TagLib::String ((string).c_str(), TagLib::String::UTF8) diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc index a5d47d2668..804b79f87d 100644 --- a/libs/ardour/rb_effect.cc +++ b/libs/ardour/rb_effect.cc @@ -20,8 +20,9 @@ #include #include +#include + #include "pbd/error.h" -#include "rubberband/RubberBandStretcher.h" #include "ardour/audioregion.h" #include "ardour/audiosource.h" diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 4d569837bb..7975599d89 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -333,9 +333,14 @@ def build(bld): obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID', 'SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS', 'OSX','BOOST','CURL','DL'] - obj.use = ['libpbd','libmidipp','libevoral','libvamphost', - 'libvampplugin','libtaglib','librubberband', + obj.use = ['libpbd','libmidipp','libevoral','libvampplugin', 'libaudiographer','libltc','libtimecode'] + if bld.is_defined('USE_EXTERNAL_LIBS'): + obj.uselib.extend(['RUBBERBAND', 'TAGLIB', 'LIBLTC', 'VAMPSDK', + 'VAMPHOSTSDK']) + else: + obj.use.extend(['libltc', 'librubberband', 'libtaglib', 'libvamphost']) + obj.vnum = LIBARDOUR_LIB_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') obj.defines = [ @@ -400,9 +405,13 @@ def build(bld): 'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc'] testcommon.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD', 'SAMPLERATE','XML','LRDF','COREAUDIO'] - testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost', - 'libvampplugin','libtaglib','librubberband', - 'libaudiographer','libltc','ardour'] + testcommon.use = ['libpbd','libmidipp','libevoral', + 'libvampplugin','libaudiographer','ardour'] + if bld.is_defined('USE_EXTERNAL_LIBS'): + testcommon.uselib.extend(['RUBBERBAND', 'TAGLIB', 'LIBLTC', 'VAMPSDK', + 'VAMPHOSTSDK']) + else: + testcommon.use.extend(['libltc', 'librubberband', 'libtaglib', 'libvamphost']) testcommon.defines = [ 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"', 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"', @@ -538,9 +547,15 @@ def create_ardour_test_program(bld, includes, name, target, sources): testobj.source = sources testobj.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD', 'SAMPLERATE','XML','LRDF','COREAUDIO'] - testobj.use = ['libpbd','libmidipp','libevoral','libvamphost', - 'libvampplugin','libtaglib','librubberband', - 'libaudiographer','libltc','ardour','testcommon'] + testobj.use = ['libpbd','libmidipp','libevoral','libvampplugin', + 'libaudiographer','ardour','testcommon'] + if bld.is_defined('USE_EXTERNAL_LIBS'): + testcommon.uselib.extend(['RUBBERBAND', 'TAGLIB', 'LIBLTC', 'VAMPSDK', + 'VAMPHOSTSDK']) + else: + testcommon.use.extend(['libltc', 'librubberband', 'libtaglib', + 'libvamphost']) + testobj.name = name testobj.target = target # not sure about install path diff --git a/libs/libltc/wscript b/libs/libltc/wscript index 9be750ee55..88f1c2f570 100644 --- a/libs/libltc/wscript +++ b/libs/libltc/wscript @@ -29,10 +29,15 @@ def options(opt): autowaf.set_options(opt) def configure(conf): - conf.load('compiler_c') - autowaf.configure(conf) + if conf.is_defined('USE_EXTERNAL_LIBS'): + autowaf.check_pkg(conf, 'ltc', uselib_store='LIBLTC', atleast_version=LIBLTC_LIB_VERSION, mandatory=True) + else: + conf.load('compiler_c') + autowaf.configure(conf) def build(bld): + if bld.is_defined('USE_EXTERNAL_LIBS'): + return obj = bld(features = 'c cshlib') obj.source = ''' ltc.c @@ -41,7 +46,7 @@ def build(bld): decoder.c ''' - obj.export_includes = ['.'] + obj.export_includes = ['./ltc'] obj.includes = ['.'] obj.name = 'libltc' obj.target = 'ltc' diff --git a/libs/rubberband/wscript b/libs/rubberband/wscript index 7e9ca0250c..e21492ebf4 100644 --- a/libs/rubberband/wscript +++ b/libs/rubberband/wscript @@ -24,10 +24,16 @@ def options(opt): autowaf.set_options(opt) def configure(conf): - conf.load('compiler_cxx') - autowaf.configure(conf) + if conf.is_defined('USE_EXTERNAL_LIBS'): + autowaf.check_pkg(conf, 'rubberband', uselib_store='RUBBERBAND', atleast_version='1.0', mandatory=True) + else: + conf.load('compiler_cxx') + autowaf.configure(conf) def build(bld): + if bld.is_defined('USE_EXTERNAL_LIBS'): + return + # Library obj = bld(features = 'cxx cxxshlib') prefix = 'libs/rubberband/' diff --git a/libs/taglib/wscript b/libs/taglib/wscript index a6994d6391..8e2805c709 100644 --- a/libs/taglib/wscript +++ b/libs/taglib/wscript @@ -24,10 +24,16 @@ def options(opt): autowaf.set_options(opt) def configure(conf): - conf.load('compiler_cxx') - autowaf.configure(conf) + if conf.is_defined('USE_EXTERNAL_LIBS'): + autowaf.check_pkg(conf, 'taglib', uselib_store='TAGLIB', atleast_version="1.4", mandatory=True) + else: + conf.load('compiler_cxx') + autowaf.configure(conf) def build(bld): + if bld.is_defined('USE_EXTERNAL_LIBS'): + return + # Library obj = bld(features = 'cxx cxxshlib') sources = bld.path.ant_glob('taglib/*.cpp') diff --git a/libs/vamp-plugins/AmplitudeFollower.h b/libs/vamp-plugins/AmplitudeFollower.h index 6c3426e324..3aa91f51f7 100644 --- a/libs/vamp-plugins/AmplitudeFollower.h +++ b/libs/vamp-plugins/AmplitudeFollower.h @@ -37,7 +37,7 @@ #ifndef _AMPLITUDE_FOLLOWER_PLUGIN_H_ #define _AMPLITUDE_FOLLOWER_PLUGIN_H_ -#include "vamp-sdk/Plugin.h" +#include /** * Example plugin implementing the SuperCollider amplitude follower diff --git a/libs/vamp-plugins/Onset.h b/libs/vamp-plugins/Onset.h index c858151b21..314e107308 100644 --- a/libs/vamp-plugins/Onset.h +++ b/libs/vamp-plugins/Onset.h @@ -17,7 +17,7 @@ #ifndef _ONSET_PLUGIN_H_ #define _ONSET_PLUGIN_H_ -#include "vamp-sdk/Plugin.h" +#include #include class Onset : public Vamp::Plugin diff --git a/libs/vamp-plugins/OnsetDetect.h b/libs/vamp-plugins/OnsetDetect.h index 3ef50afbb3..d244f66c2d 100644 --- a/libs/vamp-plugins/OnsetDetect.h +++ b/libs/vamp-plugins/OnsetDetect.h @@ -15,7 +15,7 @@ #ifndef _ONSET_DETECT_PLUGIN_H_ #define _ONSET_DETECT_PLUGIN_H_ -#include "vamp-sdk/Plugin.h" +#include class OnsetDetectorData; diff --git a/libs/vamp-plugins/PercussionOnsetDetector.h b/libs/vamp-plugins/PercussionOnsetDetector.h index d54c0cfa13..3cb094ebba 100644 --- a/libs/vamp-plugins/PercussionOnsetDetector.h +++ b/libs/vamp-plugins/PercussionOnsetDetector.h @@ -37,7 +37,7 @@ #ifndef _PERCUSSION_ONSET_DETECTOR_PLUGIN_H_ #define _PERCUSSION_ONSET_DETECTOR_PLUGIN_H_ -#include "vamp-sdk/Plugin.h" +#include /** * Example plugin that detects percussive events. diff --git a/libs/vamp-plugins/SpectralCentroid.h b/libs/vamp-plugins/SpectralCentroid.h index 02cc8d981d..8046338a4d 100644 --- a/libs/vamp-plugins/SpectralCentroid.h +++ b/libs/vamp-plugins/SpectralCentroid.h @@ -37,7 +37,7 @@ #ifndef _SPECTRAL_CENTROID_PLUGIN_H_ #define _SPECTRAL_CENTROID_PLUGIN_H_ -#include "vamp-sdk/Plugin.h" +#include /** * Example plugin that calculates the centre of gravity of the diff --git a/libs/vamp-plugins/ZeroCrossing.h b/libs/vamp-plugins/ZeroCrossing.h index ede2a74492..e6f81608db 100644 --- a/libs/vamp-plugins/ZeroCrossing.h +++ b/libs/vamp-plugins/ZeroCrossing.h @@ -37,7 +37,7 @@ #ifndef _ZERO_CROSSING_PLUGIN_H_ #define _ZERO_CROSSING_PLUGIN_H_ -#include "vamp-sdk/Plugin.h" +#include /** * Example plugin that calculates the positions and density of diff --git a/libs/vamp-plugins/plugins.cpp b/libs/vamp-plugins/plugins.cpp index 4a2523bc1d..6a04077882 100644 --- a/libs/vamp-plugins/plugins.cpp +++ b/libs/vamp-plugins/plugins.cpp @@ -38,8 +38,8 @@ #include "libvampplugins-config.h" #endif -#include "vamp/vamp.h" -#include "vamp-sdk/PluginAdapter.h" +#include +#include #include "ZeroCrossing.h" #include "SpectralCentroid.h" diff --git a/libs/vamp-sdk/wscript b/libs/vamp-sdk/wscript index aa4dfdc1da..e919640c40 100644 --- a/libs/vamp-sdk/wscript +++ b/libs/vamp-sdk/wscript @@ -23,13 +23,19 @@ def options(opt): autowaf.set_options(opt) def configure(conf): - conf.load('compiler_cxx') - autowaf.configure(conf) - autowaf.check_pkg(conf, 'fftw3', uselib_store='FFTW3', mandatory=True) - autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F', mandatory=True) - conf.env.append_value('CXXFLAGS', '-DHAVE_FFTW3') + if conf.is_defined('USE_EXTERNAL_LIBS'): + autowaf.check_pkg(conf, 'vamp-sdk', uselib_store='VAMPSDK', mandatory=True) + autowaf.check_pkg(conf, 'vamp-hostsdk', uselib_store='VAMPHOSTSDK', mandatory=True) + else: + conf.load('compiler_cxx') + autowaf.configure(conf) + autowaf.check_pkg(conf, 'fftw3', uselib_store='FFTW3', mandatory=True) + autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F', mandatory=True) + conf.env.append_value('CXXFLAGS', '-DHAVE_FFTW3') def build(bld): + if bld.is_defined('USE_EXTERNAL_LIBS'): + return # Host Library obj = bld(features = 'cxx cxxshlib') obj.source = ''' diff --git a/wscript b/wscript index 3d016326d5..04d6373740 100644 --- a/wscript +++ b/wscript @@ -428,6 +428,8 @@ def options(opt): help='Build internal libs as shared libraries') opt.add_option('--internal-static-libs', action='store_false', dest='internal_shared_libs', help='Build internal libs as static libraries') + opt.add_option('--use-external-libs', action='store_true', default=False, dest='use_external_libs', + help='Use external/system versions of some bundled libraries') opt.add_option('--lv2', action='store_true', default=True, dest='lv2', help='Compile with support for LV2 (if Lilv+Suil is available)') opt.add_option('--no-lv2', action='store_false', dest='lv2', @@ -600,6 +602,9 @@ def configure(conf): if Options.options.internal_shared_libs: conf.define('INTERNAL_SHARED_LIBS', 1) + if Options.options.use_external_libs: + conf.define('USE_EXTERNAL_LIBS', 1) + if Options.options.boost_include != '': conf.env.append_value('CXXFLAGS', '-I' + Options.options.boost_include) @@ -700,6 +705,7 @@ const char* const ardour_config_info = "\\n\\ write_config_text('Install prefix', conf.env['PREFIX']) write_config_text('Strict compiler flags', conf.env['STRICT']) write_config_text('Internal Shared Libraries', conf.is_defined('INTERNAL_SHARED_LIBS')) + write_config_text('Use External Libraries', conf.is_defined('USE_EXTERNAL_LIBS')) write_config_text('Architecture flags', opts.arch) write_config_text('Aubio', conf.is_defined('HAVE_AUBIO')) @@ -745,14 +751,17 @@ def build(bld): # add directories that contain only headers, to workaround an issue with waf bld.path.find_dir ('libs/evoral/evoral') - bld.path.find_dir ('libs/vamp-sdk/vamp-sdk') + if not bld.is_defined('USE_EXTERNAL_LIBS'): + bld.path.find_dir ('libs/vamp-sdk/vamp-sdk') bld.path.find_dir ('libs/surfaces/control_protocol/control_protocol') bld.path.find_dir ('libs/timecode/timecode') - bld.path.find_dir ('libs/libltc/ltc') - bld.path.find_dir ('libs/rubberband/rubberband') + if not bld.is_defined('USE_EXTERNAL_LIBS'): + bld.path.find_dir ('libs/libltc/ltc') + bld.path.find_dir ('libs/rubberband/rubberband') bld.path.find_dir ('libs/gtkmm2ext/gtkmm2ext') bld.path.find_dir ('libs/ardour/ardour') - bld.path.find_dir ('libs/taglib/taglib') + if not bld.is_defined('USE_EXTERNAL_LIBS'): + bld.path.find_dir ('libs/taglib/taglib') bld.path.find_dir ('libs/pbd/pbd') autowaf.set_recursive()