diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 299e3e0c53..d847ee311c 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -39,9 +39,6 @@ def configure(conf): conf.check_tool('misc') # subst tool - conf.env.append_value('CCFLAGS', '-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE') - conf.env.append_value('CXXFLAGS', '-DENABLE_NLS') - conf.write_config_header('gtk2ardour-config.h') # TODO @@ -224,17 +221,17 @@ def build(bld): version.cc waveview.cc ''' - obj.source += ' x11.cc' obj.includes = ['.'] obj.name = 'gtk2_ardour' obj.target = 'ardour-3.0' obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK GNOMECANVAS OGG ALSA' obj.uselib += ' GTKMM GNOMECANVASMM' - obj.uselib_local = '''libpbd libmidipp libtaglib libardour libsurfaces + obj.uselib_local = '''libpbd libmidipp libtaglib libardour libardour_cp libgtkmm2ext libtaglib''' - obj.cxxflags = ['-DVERSIONSTRING="' + GTK2_ARDOUR_VERSION + '"'] - obj.cxxflags += ['-DPACKAGE="gtk2_ardour"'] + obj.cflags = ['-DPACKAGE="gtk2_ardour"'] + obj.cxxflags = ['-DPACKAGE="gtk2_ardour"'] + obj.cxxflags += ['-DVERSIONSTRING="' + GTK2_ARDOUR_VERSION + '"'] obj.cxxflags += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIRNAME']) + '"'] obj.cxxflags += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIRNAME']) + '"'] obj.cxxflags += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIRNAME']) + '"'] @@ -244,6 +241,27 @@ def build(bld): obj.source += ' lv2_plugin_ui.cc ' obj.uselib += ' SLV2 ' + if bld.env['FREESOUND']: + obj.source += 'sfdb_freesound_mootcher.cc ' + + if bld.env['VST']: + obj.source += ' vst_pluginui.cc ' + obj.cxxflags += [ '-DVST_SUPPORT' ] + + if bld.env['GTKOSX']: + obj.features += ' objc ' + obj.source += ' cocoacarbon.mm ' + obj.cxxflags += [ '-DTOP_MENUBAR', '-DGTKOSX' ] + obj.linkflags += [ '-framework', 'AppKit', '-framework', 'CoreAudioKit' ] + + if bld.env['AUDIOUNITS']: + obj.source += ' au_pluginui.mm ' + obj.cxxflags += [ '-DHAVE_AUDIOUNITS' ] + obj.uselib_local += ' libappleutility ' + + else: + obj.source += ' x11.cc ' + # Wrappers wrapper_subst_dict = { diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h index 1350a3c5ab..1c77918789 100644 --- a/libs/ardour/ardour/buffer_set.h +++ b/libs/ardour/ardour/buffer_set.h @@ -74,6 +74,7 @@ public: void is_silent(bool yn) { _is_silent = yn; } bool is_silent() const { return _is_silent; } void silence (nframes_t nframes, nframes_t offset); + bool is_mirror() const { return _is_mirror; } void set_count(const ChanCount& count) { assert(count <= _available); _count = count; } @@ -169,7 +170,7 @@ private: /// Available counts (number of buffers actually allocated) ChanCount _available; - /// Whether we (don't) 'own' the contained buffers (otherwise we mirror a PortSet) + /// False if we 'own' the contained buffers, if true we mirror a PortSet) bool _is_mirror; /// Whether the buffer set should be considered silent diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index e46823d075..5cb11a9348 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -34,13 +34,20 @@ class Panner; class Delivery : public IOProcessor { public: enum Role { - Insert = 0x1, + /* main outputs - delivers out-of-place to port buffers, and cannot be removed */ + Main = 0x1, + /* send - delivers to port buffers, leaves input buffers untouched */ Send = 0x2, - Listen = 0x4, - Main = 0x8, + /* insert - delivers to port buffers and receives in-place from port buffers */ + Insert = 0x4, + /* listen - internal send used only to deliver to control/monitor bus */ + Listen = 0x8, + /* aux - internal send used to deliver to any bus, by user request */ Aux = 0x10 }; + static bool role_requires_output_ports (Role r) { return r == Main || r == Send || r == Insert; } + /* Delivery to an existing output */ Delivery (Session& s, boost::shared_ptr io, boost::shared_ptr mm, const std::string& name, Role); diff --git a/libs/ardour/ardour/pitch.h b/libs/ardour/ardour/pitch.h index 3173f9ff23..589c370409 100644 --- a/libs/ardour/ardour/pitch.h +++ b/libs/ardour/ardour/pitch.h @@ -20,6 +20,10 @@ #ifndef __ardour_pitch_h__ #define __ardour_pitch_h__ +#ifdef WAF_BUILD +#include "libardour-config.h" +#endif + #include "ardour/filter.h" namespace ARDOUR { diff --git a/libs/ardour/ardour/stretch.h b/libs/ardour/ardour/stretch.h index 0b0de1be57..b878d4794e 100644 --- a/libs/ardour/ardour/stretch.h +++ b/libs/ardour/ardour/stretch.h @@ -20,6 +20,10 @@ #ifndef __ardour_stretch_h__ #define __ardour_stretch_h__ +#ifdef WAF_BUILD +#include "libardour-config.h" +#endif + #include "ardour/filter.h" #ifdef USE_RUBBERBAND diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 42467d540c..1e0e13a276 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -1953,7 +1953,7 @@ AudioDiskstream::get_state () Location* pi; if (_session.config.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) { - snprintf (buf, sizeof (buf), "%" PRIu32, pi->start()); + snprintf (buf, sizeof (buf), "%" PRId64, pi->start()); } else { snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame()); } diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 49f4569a1c..efe123c059 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -47,7 +47,7 @@ bool Delivery::panners_legal = false; /* deliver to an existing IO object */ Delivery::Delivery (Session& s, boost::shared_ptr io, boost::shared_ptr mm, const string& name, Role r) - : IOProcessor(s, boost::shared_ptr(), (r == Listen ? boost::shared_ptr() : io), name) + : IOProcessor(s, boost::shared_ptr(), (role_requires_output_ports (r) ? io : boost::shared_ptr()), name) , _role (r) , _output_buffers (new BufferSet()) , _current_gain (1.0) @@ -71,7 +71,7 @@ Delivery::Delivery (Session& s, boost::shared_ptr io, boost::shared_ptr mm, const string& name, Role r) - : IOProcessor(s, false, (r == Listen ? false : true), name) + : IOProcessor(s, false, (role_requires_output_ports (r) ? true : false), name) , _role (r) , _output_buffers (new BufferSet()) , _current_gain (1.0) @@ -184,17 +184,88 @@ Delivery::visible () const bool Delivery::can_support_io_configuration (const ChanCount& in, ChanCount& out) const { - out = in; - return true; + if (_role == Main) { + + /* the out buffers will be set to point to the port output buffers + of our output object. + */ + + if (_output) { + if (_output->n_ports() != ChanCount::ZERO) { + out = _output->n_ports(); + return true; + } else { + /* not configured yet - we will passthru */ + out = in; + return true; + } + } else { + fatal << "programming error: this should never be reached" << endmsg; + /*NOTREACHED*/ + } + + + } else if (_role == Insert) { + + /* the output buffers will be filled with data from the *input* ports + of this Insert. + */ + + if (_input) { + if (_input->n_ports() != ChanCount::ZERO) { + out = _input->n_ports(); + return true; + } else { + /* not configured yet - we will passthru */ + out = in; + return true; + } + } else { + fatal << "programming error: this should never be reached" << endmsg; + /*NOTREACHED*/ + } + + } else { + fatal << "programming error: this should never be reached" << endmsg; + } + + return false; } bool Delivery::configure_io (ChanCount in, ChanCount out) { - if (out != in) { // always 1:1 - return false; + /* check configuration by comparison with our I/O port configuration, if appropriate. + see ::can_support_io_configuration() for comments + */ + + if (_role == Main) { + + if (_output) { + if (_output->n_ports() != out) { + if (_output->n_ports() != ChanCount::ZERO) { + fatal << _name << " programming error: configure_io with nports = " << _output->n_ports() << " called with " << in << " and " << out << " with " << _output->n_ports() << " output ports" << endmsg; + /*NOTREACHED*/ + } else { + /* I/O not yet configured */ + } + } + } + + } else if (_role == Insert) { + + if (_input) { + if (_input->n_ports() != in) { + if (_input->n_ports() != ChanCount::ZERO) { + fatal << _name << " programming error: configure_io called with " << in << " and " << out << " with " << _input->n_ports() << " input ports" << endmsg; + /*NOTREACHED*/ + } else { + /* I/O not yet configured */ + } + } + } } - + if (!Processor::configure_io (in, out)) { return false; } @@ -207,6 +278,8 @@ Delivery::configure_io (ChanCount in, ChanCount out) void Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes) { + assert (_output); + if (!_active || _output->n_ports ().get (_output->default_type()) == 0) { return; } @@ -270,7 +343,6 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra } } - XMLNode& Delivery::state (bool full_state) { @@ -448,6 +520,7 @@ Delivery::target_gain () break; case Send: case Insert: + case Aux: /* XXX FIX ME this is wrong, we need per-delivery muting */ mp = MuteMaster::PreFader; break; diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index f6678966e4..43ffefaae1 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -336,9 +336,9 @@ Location::get_state (void) id().print (buf, sizeof (buf)); node->add_property("id", buf); node->add_property ("name", name()); - snprintf (buf, sizeof (buf), "%u", start()); + snprintf (buf, sizeof (buf), "%" PRId64, start()); node->add_property ("start", buf); - snprintf (buf, sizeof (buf), "%u", end()); + snprintf (buf, sizeof (buf), "%" PRId64, end()); node->add_property ("end", buf); node->add_property ("flags", enum_2_string (_flags)); node->add_property ("locked", (_locked ? "yes" : "no")); @@ -385,14 +385,14 @@ Location::set_state (const XMLNode& node) may make the value of _start illegal. */ - sscanf (prop->value().c_str(), "%" PRIu32, &_start); + sscanf (prop->value().c_str(), "%" PRId64, &_start); if ((prop = node.property ("end")) == 0) { error << _("XML node for Location has no end information") << endmsg; return -1; } - sscanf (prop->value().c_str(), "%" PRIu32, &_end); + sscanf (prop->value().c_str(), "%" PRId64, &_end); if ((prop = node.property ("flags")) == 0) { error << _("XML node for Location has no flags information") << endmsg; diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index e0921d8916..aa6d77b000 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -1390,7 +1390,7 @@ MidiDiskstream::get_state () Location* pi; if (_session.config.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) { - snprintf (buf, sizeof (buf), "%" PRIu32, pi->start()); + snprintf (buf, sizeof (buf), "%" PRId64, pi->start()); } else { snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame()); } diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 3d44070e68..a4db60fc68 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -147,22 +147,12 @@ Send::set_state(const XMLNode& node) bool Send::can_support_io_configuration (const ChanCount& in, ChanCount& out) const { - if (_output->n_ports() == ChanCount::ZERO) { - - /* not configured yet, we can support anything */ - - out = in; - return true; /* we can support anything the first time we're asked */ - - } else { - - /* for a send, processor input corresponds to IO output */ - - out = in; - return true; - } - - return false; + /* sends have no impact at all on the channel configuration of the + streams passing through the route. so, out == in. + */ + + out = in; + return true; } /** Set up the XML description of a send so that its name is unique. diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index b1d33e948c..ba6353ae39 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3784,8 +3784,11 @@ Session::ensure_buffers (ChanCount howmany) for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { size_t count = std::max(_scratch_buffers->available().get(*t), howmany.get(*t)); + cerr << "Ensure bufs for scratch at " << _scratch_buffers << " mirror ? " << _scratch_buffers->is_mirror() << endl; _scratch_buffers->ensure_buffers (*t, count, _engine.raw_buffer_size(*t)); + cerr << "Ensure bufs for mix at " << _mix_buffers << " mirror ? " << _mix_buffers->is_mirror() << endl; _mix_buffers->ensure_buffers (*t, count, _engine.raw_buffer_size(*t)); + cerr << "Ensure bufs for silent at " << _silent_buffers << " mirror ? " << _silent_buffers->is_mirror() << endl; _silent_buffers->ensure_buffers (*t, count, _engine.raw_buffer_size(*t)); } diff --git a/libs/ardour/template_utils.cc b/libs/ardour/template_utils.cc index a7a7eee321..daf133fa05 100644 --- a/libs/ardour/template_utils.cc +++ b/libs/ardour/template_utils.cc @@ -141,7 +141,7 @@ find_route_templates (vector& template_names) template_names.push_back (rti); } - free (templates); + delete templates; } } diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 6993412ce5..3ab48abf77 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -2,6 +2,7 @@ import autowaf import os import glob +import Options # Version of this package (even if built as a child) MAJOR = '3' @@ -28,17 +29,11 @@ path_prefix = 'libs/ardour/' def set_options(opt): autowaf.set_options(opt) -def check_header_and_define(conf, header, define): - conf.check(header_name=header, define_name=define) - if conf.env[define]: - conf.env.append_value('CCFLAGS', '-D' + define) - conf.env.append_value('CXXFLAGS', '-D' + define) - 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') + autowaf.check_tool(conf, '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') @@ -54,14 +49,24 @@ def configure(conf): # we don't try to detect this, since its part of our source tree - conf.env.append_value('CXXFLAGS', '-DUSE_RUBBERBAND') - conf.define('HAVE_RUBBERBAND', 1) + conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it + conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it - check_header_and_define(conf, 'sys/vfs.h', 'HAVE_SYS_VFS_H') - check_header_and_define(conf, 'wordexp.h', 'HAVE_WORDEXP') - - conf.env.append_value('CCFLAGS', '-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE') - conf.env.append_value('CXXFLAGS', '-DENABLE_NLS') + 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' ]) conf.write_config_header('libardour-config.h') @@ -188,6 +193,7 @@ def build(bld): reverse.cc route.cc route_group.cc + rb_effect.cc send.cc session.cc session_butler.cc @@ -229,7 +235,7 @@ def build(bld): obj.name = 'libardour' obj.target = 'ardour' obj.uselib = 'GLIBMM AUBIO SIGCPP XML UUID JACK SNDFILE SAMPLERATE LRDF' - obj.uselib_local = 'libpbd libmidipp libevoral libvamphost libvampplugin libtaglib' + 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') obj.cxxflags = ['-DPACKAGE="libardour3"'] @@ -240,14 +246,32 @@ def build(bld): os.path.normpath(bld.env['DATADIR']), 'locale') + '"'] obj.cxxflags += ['-DVAMP_DIR="' + os.path.join( os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'] - obj.source += ' rb_effect.cc ' - obj.uselib_local += ' librubberband ' #obj.source += ' st_stretch.cc st_pitch.cc ' #obj.uselib += ' SOUNDTOUCH ' if bld.env['HAVE_SLV2']: obj.source += ' lv2_plugin.cc lv2_event_buffer.cc uri_map.cc ' obj.uselib += ' SLV2 ' + if bld.env['VST']: + obj.source += ' vst_plugin.cc session_vst.cc ' + + if bld.env['HAVE_COREAUDIO'] and bld.env['COREAUDIO']: + obj.sources += ' coreaudio.cc caimportable.cc ' + + if bld.env['HAVE_AUDIOUNITS'] and bld.env['AUDIOUNITS']: + obj.sources += ' audio_unit.cc ' + + 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['FPU_OPTIMIZATION']: + obj.source += ' sse_functions_xmm.cc' + if bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686': + obj.source += ' sse_functions.S' + elif bld.env['build_target'] == 'x86_64': + obj.source += ' sse_functions_64bit.S' + if bld.env['HAVE_CPPUNIT']: # Unit tests testobj = bld.new_task_gen('cxx', 'program') @@ -261,6 +285,7 @@ def build(bld): testobj.target = 'run-tests' testobj.install_path = '' + def shutdown(): autowaf.shutdown() diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index 7b60d6ba52..bf85333541 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -220,7 +220,10 @@ UI::run (Receiver &old_receiver) listen_to (warning); listen_to (fatal); - old_receiver.hangup (); + /* stop the old receiver (text/console) once we hit the first idle */ + + Glib::signal_idle().connect (bind_return (mem_fun (old_receiver, &Receiver::hangup), false)); + starting (); _active = true; theMain->run (); @@ -529,10 +532,10 @@ UI::display_message (const char *prefix, gint prefix_len, RefPtrpack_start (label, true, true); + hpacker.pack_start (quit, true, false); + win.get_vbox()->pack_start (hpacker, false, false); - packer.pack_start (label, true, true); - packer.pack_start (quit, false, false); quit.signal_clicked().connect(mem_fun(*this,&UI::quit)); win.show_all (); @@ -553,7 +558,7 @@ UI::handle_fatal (const char *message) theMain->run (); - exit (1); + _exit (1); } void diff --git a/libs/pbd/pbd/stacktrace.h b/libs/pbd/pbd/stacktrace.h index 00cb253c70..40275fd536 100644 --- a/libs/pbd/pbd/stacktrace.h +++ b/libs/pbd/pbd/stacktrace.h @@ -20,24 +20,24 @@ #ifndef __libpbd_stacktrace_h__ #define __libpbd_stacktrace_h__ +#ifdef HAVE_WAFBUILD +#include "libpbd-config.h" +#endif + #include #include #include #include +#ifdef HAVE_EXECINFO +#include +#include +#endif + namespace PBD { void stacktrace (std::ostream& out, int levels = 0); void trace_twb(); -#ifdef HAVE_WAFBUILD -#include "libpbd-config.h" -#endif - -#ifdef HAVE_EXECINFO -#include -#include -#endif - template class thing_with_backtrace { diff --git a/libs/pbd/wscript b/libs/pbd/wscript index ed9ef14c5c..cd1197fb17 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -37,9 +37,7 @@ def configure(conf): autowaf.check_pkg(conf, 'uuid', uselib_store='UUID') conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT') - - # This must be defined for libpbd only, it breaks ardour - conf.check(header_name='execinfo.h', define_name='PBD_HAVE_EXECINFO') + conf.check(header_name='execinfo.h', define_name='HAVE_EXECINFO') conf.write_config_header('libpbd-config.h') @@ -92,8 +90,9 @@ def build(bld): obj.vnum = LIBPBD_LIB_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') obj.cxxflags = ['-DPACKAGE="libpbd"'] - if bld.env['PBD_HAVE_EXECINFO']: - obj.cxxflags += ['-DHAVE_EXECINFO'] + + if bld.env['build_target'] == 'x86_64': + obj.cxxflags += [ '-DUSE_X86_64_ASM' ] def shutdown(): autowaf.shutdown() diff --git a/libs/surfaces/control_protocol/wscript b/libs/surfaces/control_protocol/wscript index c084e33696..e8354e58d4 100644 --- a/libs/surfaces/control_protocol/wscript +++ b/libs/surfaces/control_protocol/wscript @@ -6,7 +6,7 @@ import os # major increment <=> incompatible changes # minor increment <=> compatible changes (additions) # micro increment <=> no interface changes -LIBSURFACES_LIB_VERSION = '4.1.0' +LIBARDOUR_CP_LIB_VERSION = '4.1.0' # Mandatory variables srcdir = '.' @@ -25,13 +25,13 @@ def build(bld): control_protocol.cc smpte.cc ''' - obj.export_incdirs = ['.'] + obj.export_incdirs = ['.', './control_protocol' ] obj.cxxflags = '-DPACKAGE="ardour_cp"' - obj.includes = ['.'] - obj.name = 'libsurfaces' - obj.target = 'surfaces' + obj.includes = ['.', './control_protocol'] + obj.name = 'libardour_cp' + obj.target = 'ardourcp' obj.uselib_local = 'libardour' - obj.vnum = LIBSURFACES_LIB_VERSION + obj.vnum = LIBARDOUR_CP_LIB_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') def shutdown(): diff --git a/libs/surfaces/generic_midi/wscript b/libs/surfaces/generic_midi/wscript index 4993d24ef9..c26643e656 100644 --- a/libs/surfaces/generic_midi/wscript +++ b/libs/surfaces/generic_midi/wscript @@ -6,7 +6,7 @@ import os # major increment <=> incompatible changes # minor increment <=> compatible changes (additions) # micro increment <=> no interface changes -LIBSURFACES_LIB_VERSION = '4.1.0' +LIBARDOUR_GENERIC_MIDI_LIB_VERSION = '4.1.0' # Mandatory variables srcdir = '.' @@ -25,13 +25,13 @@ def build(bld): interface.cc midicontrollable.cc ''' - obj.export_incdirs = ['./generic_midi'] + obj.export_incdirs = ['.'] obj.cxxflags = '-DPACKAGE="ardour_genericmidi"' obj.includes = ['.', './generic_midi'] - obj.name = 'libgeneric_midi' - obj.target = 'generic_midi' - obj.uselib_local = 'libardour libsurfaces' - obj.vnum = LIBSURFACES_LIB_VERSION + obj.name = 'libardour_generic_midi' + obj.target = 'ardour_generic_midi' + obj.uselib_local = 'libardour libardour_cp' + obj.vnum = LIBARDOUR_GENERIC_MIDI_LIB_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') def shutdown(): diff --git a/libs/surfaces/osc/wscript b/libs/surfaces/osc/wscript index 748b0f6940..d254d00313 100644 --- a/libs/surfaces/osc/wscript +++ b/libs/surfaces/osc/wscript @@ -2,18 +2,11 @@ import autowaf import os -# Version of this package (even if built as a child) -LIBSURFACES_VERSION = '4.1.0' - # Library version (UNIX style major, minor, micro) # major increment <=> incompatible changes # minor increment <=> compatible changes (additions) # micro increment <=> no interface changes -LIBSURFACES_LIB_VERSION = '4.1.0' - -# Variables for 'waf dist' -APPNAME = 'libsurfaces' -VERSION = LIBSURFACES_VERSION +LIBARDOUR_OSC_LIB_VERSION = '4.1.0' # Mandatory variables srcdir = '.' @@ -24,6 +17,7 @@ def set_options(opt): def configure(conf): autowaf.configure(conf) + autowaf.check_pkg(conf, 'liblo', uselib_store='LO') def build(bld): obj = bld.new_task_gen('cxx', 'shlib') @@ -32,13 +26,14 @@ def build(bld): osc_controllable.cc interface.cc ''' - obj.export_incdirs = ['./osc'] + obj.export_incdirs = ['.'] obj.cxxflags = '-DPACKAGE="ardour_cp"' obj.includes = ['.', './osc'] - obj.name = 'libsurfaces' - obj.target = 'surfaces' - obj.uselib_local = 'libardour' - obj.vnum = LIBSURFACES_LIB_VERSION + obj.name = 'libardour_osc' + obj.target = 'osc' + obj.uselib = ' LO ' + obj.uselib_local = 'libardour libardour_cp' + obj.vnum = LIBARDOUR_OSC_LIB_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') def shutdown(): diff --git a/libs/surfaces/powermate/wscript b/libs/surfaces/powermate/wscript index 3d08b1a40a..f8dd55c515 100644 --- a/libs/surfaces/powermate/wscript +++ b/libs/surfaces/powermate/wscript @@ -6,7 +6,7 @@ import os # major increment <=> incompatible changes # minor increment <=> compatible changes (additions) # micro increment <=> no interface changes -LIBSURFACES_LIB_VERSION = '4.1.0' +LIBARDOUR_POWERMATE_LIB_VERSION = '4.1.0' # Mandatory variables srcdir = '.' @@ -24,13 +24,13 @@ def build(bld): interface.cc powermate.cc ''' - obj.export_incdirs = ['./powermate'] + obj.export_incdirs = ['.'] obj.cxxflags = '-DPACKAGE="ardour_powermate"' - obj.includes = ['.', './powermate'] + obj.includes = ['.' ] obj.name = 'libpowermate' obj.target = 'powermate' - obj.uselib_local = 'libardour libsurfaces' - obj.vnum = LIBSURFACES_LIB_VERSION + obj.uselib_local = 'libardour libardour_cp' + obj.vnum = LIBARDOUR_POWERMATE_LIB_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') def shutdown(): diff --git a/libs/surfaces/tranzport/wscript b/libs/surfaces/tranzport/wscript index dec4b9c1d3..a5181566c2 100644 --- a/libs/surfaces/tranzport/wscript +++ b/libs/surfaces/tranzport/wscript @@ -6,7 +6,7 @@ import os # major increment <=> incompatible changes # minor increment <=> compatible changes (additions) # micro increment <=> no interface changes -LIBSURFACES_LIB_VERSION = '4.1.0' +LIBARDOUR_TRANZPORT_LIB_VERSION = '4.1.0' # Mandatory variables srcdir = '.' @@ -41,10 +41,10 @@ def build(bld): obj.export_incdirs = ['./tranzport'] obj.cxxflags = '-DPACKAGE="ardour_tranzport"' obj.includes = ['.', './tranzport'] - obj.name = 'libtranzport' - obj.target = 'tranzport' - obj.uselib_local = 'libardour libsurfaces' - obj.vnum = LIBSURFACES_LIB_VERSION + obj.name = 'libardour_tranzport' + obj.target = 'ardour_tranzport' + obj.uselib_local = 'libardour libardour_cp' + obj.vnum = LIBARDOUR_TRANZPORT_LIB_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') def shutdown(): diff --git a/libs/surfaces/wscript b/libs/surfaces/wscript index bd37af7426..d629e6ab8e 100644 --- a/libs/surfaces/wscript +++ b/libs/surfaces/wscript @@ -1,5 +1,6 @@ #!/usr/bin/env python import autowaf +import Options # Version of this package (even if built as a child) LIBSURFACES_VERSION = '4.1.0' @@ -24,9 +25,32 @@ def set_options(opt): def configure(conf): autowaf.configure(conf) + conf.check_cc (lib='libusb', header_name='libusb.h', function_name='usb_interrupt_write', define_name='BUILD_TRANZPORT') + conf.check_cc (header_name='linux/input.h', define_name='BUILD_POWERMATE') + conf.check_cc (lib='lo', header_name='lo/lo.h', function_name='lo_server_new', define_name='BUILD_OSC') + + if Options.options.wiimote: + conf.check_cc (header_name='cwiid.h',define_name='HAVE_CWIID_H') + if not conf.env['HAVE_CWIID_H']: + print 'WIIMOTE configured but you are missing libcwiid!' + sys.exit(1) + conf.check_cc (header_name='bluetooth/bluetooth.h',define_name='HAVE_BLUETOOTH_H') + if not conf.env['HAVE_BLUETOOTH_H']: + print 'WIIMOTE configured but you are missing the libbluetooth headers needed to compile wiimote support!' + sys.exit(1) + conf.define ('BUILD_WIIMOTE', 1) + def build(bld): bld.add_subdirs('control_protocol') bld.add_subdirs('generic_midi') + if bld.env['BUILD_OSC']: + bld.add_subdirs('osc') + if bld.env['BUILD_POWERMATE']: + bld.add_subdirs('powermate') + if bld.env['BUILD_WIIMOTE']: + bld.add_subdirs('wiimote') + if bld.env['BUILD_TRANZPORT']: + bld.add_subdirs('tranzport') def shutdown(): autowaf.shutdown() diff --git a/wscript b/wscript index 3ef5f0df2c..210573b7aa 100644 --- a/wscript +++ b/wscript @@ -3,6 +3,8 @@ import autowaf import Options import os import commands +import re +import string # Variables for 'waf dist' VERSION = '3.0pre0' @@ -71,11 +73,232 @@ def create_stored_revision(): sys.exit(-1) +def set_compiler_flags (conf,opt): + # + # Compiler flags and other system-dependent stuff + # + + build_host_supports_sse = 0 + optimization_flags = [] + if opt.gprofile: + debug_flags = [ '-pg' ] + else: + debug_flags = [ ] # waf adds -O0 -g itself. thanks waf! + + # guess at the platform, used to define compiler flags + + config_guess = os.popen("tools/config.guess").read()[:-1] + + config_cpu = 0 + config_arch = 1 + config_kernel = 2 + config_os = 3 + config = config_guess.split ("-") + + print "system triple: " + config_guess + + # Autodetect + if opt.dist_target == 'auto': + if config[config_arch] == 'apple': + # The [.] matches to the dot after the major version, "." would match any character + if re.search ("darwin[0-7][.]", config[config_kernel]) != None: + conf.define ('build_target', 'panther') + if re.search ("darwin8[.]", config[config_kernel]) != None: + conf.define ('build_target', 'tiger') + else: + conf.define ('build_target', 'leopard') + else: + if re.search ("x86_64", config[config_cpu]) != None: + conf.define ('build_target', 'x86_64') + elif re.search("i[0-5]86", config[config_cpu]) != None: + conf.define ('build_target', 'i386') + elif re.search("powerpc", config[config_cpu]) != None: + conf.define ('build_target', 'powerpc') + else: + conf.define ('build_target', 'i686') + print "\n*******************************" + print "detected DIST_TARGET = " + conf.env['build_target'] + print "*******************************\n" + else: + conf.define ('build_target', opt.dist_target) + + if config[config_cpu] == 'powerpc' and conf.env['build_target'] != 'none': + # + # Apple/PowerPC optimization options + # + # -mcpu=7450 does not reliably work with gcc 3.* + # + if opt.dist_target == 'panther' or opt.dist_target == 'tiger': + if config[config_arch] == 'apple': + # optimization_flags.extend ([ "-mcpu=7450", "-faltivec"]) + # to support g3s but still have some optimization for above + optimization_flags.extend ([ "-mcpu=G3", "-mtune=7450"]) + else: + optimization_flags.extend ([ "-mcpu=7400", "-maltivec", "-mabi=altivec"]) + else: + optimization_flags.extend([ "-mcpu=750", "-mmultiple" ]) + optimization_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"]) + optimization_flags.extend (["-Os"]) + + elif ((re.search ("i[0-9]86", config[config_cpu]) != None) or (re.search ("x86_64", config[config_cpu]) != None)) and conf.env['build_target'] != 'none': + + + # + # ARCH_X86 means anything in the x86 family from i386 to x86_64 + # USE_X86_64_ASM is used to distingush 32 and 64 bit assembler + # + + if (re.search ("(i[0-9]86|x86_64)", config[config_cpu]) != None): + debug_flags.append ("-DARCH_X86") + optimization_flags.append ("-DARCH_X86") + + if config[config_kernel] == 'linux' : + + # + # determine processor flags via /proc/cpuinfo + # + + if conf.env['build_target'] != 'i386': + + flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1] + x86_flags = flag_line.split (": ")[1:][0].split () + + if "mmx" in x86_flags: + optimization_flags.append ("-mmmx") + if "sse" in x86_flags: + build_host_supports_sse = 1 + if "3dnow" in x86_flags: + optimization_flags.append ("-m3dnow") + + if config[config_cpu] == "i586": + optimization_flags.append ("-march=i586") + elif config[config_cpu] == "i686": + optimization_flags.append ("-march=i686") + + if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse: + optimization_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"]) + debug_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"]) + + # end of processor-specific section + + # optimization section + if conf.env['FPU_OPTIMIZATION']: + if conf.env['build_target'] == 'tiger' or conf.env['build_target'] == 'leopard': + optimization_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS"); + debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS"); + libraries['core'].Append(LINKFLAGS= '-framework Accelerate') + elif conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64': + optimization_flags.append ("-DBUILD_SSE_OPTIMIZATIONS") + debug_flags.append ("-DBUILD_SSE_OPTIMIZATIONS") + if conf.env['build_target'] == 'x86_64': + optimization_flags.append ("-DUSE_X86_64_ASM") + debug_flags.append ("-DUSE_X86_64_ASM") + if build_host_supports_sse != 1: + print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)" + + # end optimization section + + # + # no VST on x86_64 + # + + if conf.env['build_target'] == 'x86_64' and opt.vst: + print "\n\n==================================================" + print "You cannot use VST plugins with a 64 bit host. Please run scons with VST=0" + print "\nIt is theoretically possible to build a 32 bit host on a 64 bit system." + print "However, this is tricky and not recommended for beginners." + sys.exit (-1) + + # + # a single way to test if we're on OS X + # + + if conf.env['build_target'] in ['panther', 'tiger', 'leopard' ]: + conf.define ('IS_OSX', 1) + # force tiger or later, to avoid issues on PPC which defaults + # back to 10.1 if we don't tell it otherwise. + conf.env.append_value (CCFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040") + + if conf.env['build_target'] == 'leopard': + # need this to force build against the 10.4 SDK when building on later versions of OS X + # ideally this would be configurable, but lets just do that later when we need it + conf.env.append_value(CCFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk") + conf.env.append_value(LINKFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk") + + else: + conf.define ('IS_OSX', 0) + + # + # save off guessed arch element in an env + # + conf.define ('CONFIG_ARCH', config[config_arch]) + + # + # ARCH="..." overrides all + # + + if opt.arch != None: + optimization_flags = opt.arch.split() + + # + # prepend boiler plate optimization flags that work on all architectures + # + + optimization_flags[:0] = [ + "-O3", + "-fomit-frame-pointer", + "-ffast-math", + "-fstrength-reduce", + "-pipe" + ] + + if opt.debug: + conf.env.append_value('CCFLAGS', debug_flags) + conf.env.append_value('CXXFLAGS', debug_flags) + conf.env.append_value('LINKFLAGS', debug_flags) + else: + conf.env.append_value('CCFLAGS', optimization_flags) + conf.env.append_value('LINKFLAGS', optimization_flags) + + if opt.stl_debug: + conf.env.append_value('CXXFLAGS', "-D_GLIBCXX_DEBUG") + + if opt.universal: + conf.env.append_value('CCFLAGS', "-arch i386 -arch ppc") + conf.env.append_value('CXXFLAGS', "-arch i386 -arch ppc") + conf.env.append_value('LINKFLAGS', "-arch i386 -arch ppc") + + # + # warnings flags + # + + conf.env.append_value('CCFLAGS', "-Wall") + conf.env.append_value('CXXFLAGS', [ '-Wall', '-Woverloaded-virtual']) + + if opt.extra_warn: + conf.env.append_value('CCFLAGS', [ '-Wextra', '-pedantic', '-ansi' ]) + conf.env.append_value('CXXFLAGS', [ '-Wextra', '-pedantic', '-ansi' ]) + #conf.env.append_value('CFLAGS', "-iso") + + + # + # more boilerplate + # + + conf.env.append_value('CCFLAGS', [ '-D_LARGEFILE64_SOURCE', '-D_LARGEFILE_SOURCE' ]) + conf.env.append_value('CXXFLAGS', [ '-D_LARGEFILE_SOURCE', '-D_LARGEFILE_SOURCE' ]) + if opt.nls: + conf.env.append_value('CXXFLAGS', '-DENABLE_NLS') + conf.env.append_value('CCFLAGS', '-DENABLE_NLS') + + +#---------------------------------------------------------------- + # Waf stages def set_options(opt): autowaf.set_options(opt) - opt.add_option('--arch', type='string', dest='arch', + opt.add_option('--arch', type='string', action='store', dest='arch', help='Architecture-specific compiler flags') opt.add_option('--aubio', action='store_true', default=True, dest='aubio', help="Use Paul Brossier's aubio library for feature detection (if available)") @@ -83,23 +306,29 @@ def set_options(opt): help='Compile with Apple\'s AudioUnit library (experimental)') opt.add_option('--coreaudio', action='store_true', default=False, dest='coreaudio', help='Compile with Apple\'s CoreAudio library') + opt.add_option('--dist-target', type='string', default='auto', dest='dist_target', + help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,powerpc,tiger,leopard]') + opt.add_option('--extra-warn', action='store_true', default=False, dest='extra_warn', + help='Build with even more compiler warning flags') opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization', help='Build runtime checked assembler code') opt.add_option('--freedesktop', action='store_true', default=False, dest='freedesktop', help='Install MIME type, icons and .desktop file as per freedesktop.org standards') opt.add_option('--freesound', action='store_true', default=False, dest='freesound', help='Include Freesound database lookup') + opt.add_option('--gprofile', action='store_true', default=False, dest='gprofile', + help='Compile for use with gprofile') opt.add_option('--gtkosx', action='store_true', default=False, dest='gtkosx', help='Compile for use with GTK-OSX, not GTK-X11') opt.add_option('--lv2', action='store_true', default=False, dest='lv2', help='Compile with support for LV2 (if slv2 is available)') opt.add_option('--nls', action='store_true', default=True, dest='nls', help='Enable i18n (native language support)') - opt.add_option('--surfaces', action='store_true', default=False, dest='surfaces', - help='Build support for control surfaces') + opt.add_option('--stl-debug', action='store_true', default=False, dest='stl_debug', + help='Build with debugging for the STL') opt.add_option('--syslibs', action='store_true', default=True, dest='syslibs', help='Use existing system versions of various libraries instead of internal ones') - opt.add_option('--tranzport', action='store_true', default=True, dest='tranzport', + opt.add_option('--tranzport', action='store_true', default=False, dest='tranzport', help='Compile with support for Frontier Designs Tranzport (if libusb is available)') opt.add_option('--universal', action='store_true', default=False, dest='universal', help='Compile as universal binary (requires that external libraries are universal)') @@ -129,6 +358,8 @@ def configure(conf): # Fix utterly braindead FLAC include path to not smash assert.h conf.env['CPPPATH_FLAC'] = [] + + set_compiler_flags (conf, Options.options) # Tell everyone that this is a waf build @@ -138,27 +369,43 @@ def configure(conf): autowaf.print_summary(conf) opts = Options.options autowaf.display_header('Ardour Configuration') + autowaf.display_msg(conf, 'Build Target', conf.env['build_target']) autowaf.display_msg(conf, 'Architecture flags', opts.arch) autowaf.display_msg(conf, 'Aubio', bool(conf.env['HAVE_AUBIO'])) autowaf.display_msg(conf, 'AudioUnits', opts.audiounits) - autowaf.display_msg(conf, 'CoreAudio', opts.coreaudio) + if opts.audiounits: + conf.define('AUDIOUNITS',1) autowaf.display_msg(conf, 'FPU Optimization', opts.fpu_optimization) + if opts.fpu_optimization: + conf.define('FPU_OPTIMIZATION', 1) autowaf.display_msg(conf, 'Freedesktop Files', opts.freedesktop) autowaf.display_msg(conf, 'Freesound', opts.freesound) + if opts.freesound: + conf.define('FREESOUND',1) autowaf.display_msg(conf, 'GtkOSX', opts.gtkosx) + if opts.gtkosx: + conf.define ('GTKOSX', 1) autowaf.display_msg(conf, 'LV2 Support', bool(conf.env['HAVE_SLV2'])) autowaf.display_msg(conf, 'Rubberband', bool(conf.env['HAVE_RUBBERBAND'])) autowaf.display_msg(conf, 'Samplerate', bool(conf.env['HAVE_SAMPLERATE'])) autowaf.display_msg(conf, 'Soundtouch', bool(conf.env['HAVE_SOUNDTOUCH'])) autowaf.display_msg(conf, 'Translation', opts.nls) - autowaf.display_msg(conf, 'Surfaces', opts.surfaces) autowaf.display_msg(conf, 'System Libraries', opts.syslibs) autowaf.display_msg(conf, 'Tranzport', opts.tranzport) + if opts.tranzport: + conf.define('TRANZPORT', 1) autowaf.display_msg(conf, 'Universal Binary', opts.universal) - autowaf.display_msg(conf, 'Versioned Binary', opts.versioned) autowaf.display_msg(conf, 'VST Support', opts.vst) + if opts.vst: + conf.define('VST_SUPPORT', 1) autowaf.display_msg(conf, 'Wiimote Support', opts.wiimote) + if opts.wiimote: + conf.define('WIIMOTE',1) autowaf.display_msg(conf, 'Windows Key', opts.windows_key) + if opts.windows_key: + conf.define('WINDOWS_KEY', opts.windows_key) + autowaf.display_msg(conf, 'C Compiler flags', conf.env['CCFLAGS']) + autowaf.display_msg(conf, 'C++ Compiler flags', conf.env['CXXFLAGS']) def build(bld): autowaf.set_recursive()