From 2d0f699e5ddaab31e936d3c76cbc59cef487987d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Oct 2008 21:33:59 +0000 Subject: Lower glib/glibmm dependency to 2.14. Fix optional parameters all over the palce because waf is retarded and sets failed check variables to ##some#stupid#name#like#this instead of false. Portability fixes (Ingen (except GUI) and all dependencies builds on OSX). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1681 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/wscript | 9 +++++---- src/engine/AudioBuffer.cpp | 32 +++++++++++++++++--------------- src/engine/AudioBuffer.hpp | 1 + src/engine/Buffer.hpp | 2 ++ src/engine/EventBuffer.cpp | 6 ++++++ src/engine/MidiNoteNode.cpp | 2 +- src/engine/types.hpp | 3 ++- src/engine/wscript | 32 +++++++++++++++++--------------- src/module/wscript | 11 ++++++----- src/serialisation/wscript | 9 +++++---- wscript | 34 ++++++++++++++++++++++------------ 11 files changed, 84 insertions(+), 57 deletions(-) diff --git a/src/client/wscript b/src/client/wscript index 65597d0f..614ad7f9 100644 --- a/src/client/wscript +++ b/src/client/wscript @@ -28,9 +28,10 @@ def build(bld): if bld.env()['HAVE_LIBLO'] == 1: obj.source += ' OSCClientReceiver.cpp OSCEngineSender.cpp ' - obj.includes = ['.', '..', '../common'] - obj.name = 'libingen_client' - obj.target = 'ingen_client' - obj.inst_dir = 'lib/ingen' + obj.includes = ['.', '..', '../common'] + obj.name = 'libingen_client' + obj.target = 'ingen_client' + obj.inst_dir = 'lib/ingen' + obj.uselib_local = 'libingen_shared' autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE SLV2 RAUL REDLANDMM SOUP XML2 SIGCPP LIBLO SOUP') diff --git a/src/engine/AudioBuffer.cpp b/src/engine/AudioBuffer.cpp index f13e109f..5eb89855 100644 --- a/src/engine/AudioBuffer.cpp +++ b/src/engine/AudioBuffer.cpp @@ -44,6 +44,21 @@ AudioBuffer::AudioBuffer(size_t size) } +void +AudioBuffer::alloc_local_data(size_t size) +{ +#ifdef POSIX_MEMALIGN + const int ret = posix_memalign((void**)&_local_data, 16, size * sizeof(Sample)); +#else + _local_data = (Sample*)malloc(size * sizeof(Sample)); + int ret = (_local_data != NULL); +#endif + if (ret != 0) { + cerr << "[Buffer] Failed to allocate buffer. Aborting." << endl; + exit(EXIT_FAILURE); + } +} + void AudioBuffer::resize(size_t size) { @@ -54,14 +69,7 @@ AudioBuffer::resize(size_t size) const bool using_local_data = (_data == _local_data); deallocate(); - - const int ret = posix_memalign((void**)&_local_data, 16, _size * sizeof(Sample)); - if (ret != 0) { - cerr << "[Buffer] Failed to allocate buffer. Aborting." << endl; - exit(EXIT_FAILURE); - } - - assert(ret == 0); + alloc_local_data(_size * sizeof(Sample)); assert(_local_data); if (using_local_data) @@ -82,13 +90,7 @@ AudioBuffer::allocate() assert(_local_data == NULL); assert(_size > 0); - const int ret = posix_memalign((void**)&_local_data, 16, _size * sizeof(Sample)); - if (ret != 0) { - cerr << "[Buffer] Failed to allocate buffer. Aborting." << endl; - exit(EXIT_FAILURE); - } - - assert(ret == 0); + alloc_local_data(_size * sizeof(Sample)); assert(_local_data); _data = _local_data; diff --git a/src/engine/AudioBuffer.hpp b/src/engine/AudioBuffer.hpp index b93e2267..de5487c0 100644 --- a/src/engine/AudioBuffer.hpp +++ b/src/engine/AudioBuffer.hpp @@ -66,6 +66,7 @@ public: private: enum State { OK, HALF_SET_CYCLE_1, HALF_SET_CYCLE_2 }; + void alloc_local_data(size_t size); void allocate(); void deallocate(); diff --git a/src/engine/Buffer.hpp b/src/engine/Buffer.hpp index e0dd0ba2..254cf009 100644 --- a/src/engine/Buffer.hpp +++ b/src/engine/Buffer.hpp @@ -36,6 +36,8 @@ public: , _size(size) , _joined_buf(NULL) {} + + virtual ~Buffer() {} static Buffer* create(Shared::DataType type, size_t size); diff --git a/src/engine/EventBuffer.cpp b/src/engine/EventBuffer.cpp index e57312ad..45ef47f0 100644 --- a/src/engine/EventBuffer.cpp +++ b/src/engine/EventBuffer.cpp @@ -40,7 +40,13 @@ EventBuffer::EventBuffer(size_t capacity) throw std::bad_alloc(); } +#ifdef HAVE_POSIX_MEMALIGN int ret = posix_memalign((void**)&_local_buf, 16, sizeof(LV2_Event_Buffer) + capacity); +#else + _local_buf = (LV2_Event_Buffer*)malloc(sizeof(LV2_Event_Buffer) + capacity); + int ret = (_local_buf == NULL); +#endif + if (ret) { cerr << "Failed to allocate event buffer. Aborting." << endl; exit(EXIT_FAILURE); diff --git a/src/engine/MidiNoteNode.cpp b/src/engine/MidiNoteNode.cpp index 5d966e75..5b6da263 100644 --- a/src/engine/MidiNoteNode.cpp +++ b/src/engine/MidiNoteNode.cpp @@ -213,7 +213,7 @@ MidiNoteNode::note_on(ProcessContext& context, uchar note_num, uchar velocity, F if (voice == NULL) { voice_num = 0; voice = &(*_voices)[0]; - jack_nframes_t oldest_time = (*_voices)[0].time; + FrameTime oldest_time = (*_voices)[0].time; for (uint32_t i=1; i < _polyphony; ++i) { if ((*_voices)[i].time < oldest_time) { voice = &(*_voices)[i]; diff --git a/src/engine/types.hpp b/src/engine/types.hpp index 7199e2d6..5fedf4f3 100644 --- a/src/engine/types.hpp +++ b/src/engine/types.hpp @@ -18,7 +18,8 @@ #ifndef TYPES_HPP #define TYPES_HPP -#include // for NULL, size_t, etc +#include +#include typedef unsigned char uchar; typedef unsigned int uint; diff --git a/src/engine/wscript b/src/engine/wscript index a6871717..6d62a976 100644 --- a/src/engine/wscript +++ b/src/engine/wscript @@ -17,9 +17,6 @@ def build(bld): GraphObjectImpl.cpp InputPort.cpp InternalPlugin.cpp - LADSPAPlugin.cpp - LV2Info.cpp - LV2Plugin.cpp MessageContext.cpp MidiControlNode.cpp MidiNoteNode.cpp @@ -42,18 +39,19 @@ def build(bld): obj = bld.create_obj('cpp', 'shlib') obj.source = core_source - if bld.env()['HAVE_LADSPA']: - obj.source += ' LADSPANode.cpp ' - if bld.env()['HAVE_SLV2']: - obj.source += ' LV2Node.cpp ' + if bld.env()['HAVE_LADSPA'] == 1: + obj.source += ' LADSPAPlugin.cpp LADSPANode.cpp ' + if bld.env()['HAVE_SLV2'] == 1: + obj.source += ' LV2Info.cpp LV2Plugin.cpp LV2Node.cpp ' obj.includes = ['.', '..', '../common', './events'] obj.name = 'libingen_engine' obj.target = 'ingen_engine' obj.inst_dir = 'lib/ingen' + obj.uselib_local = 'libingen_shared' core_libs = 'GLIBMM GTHREAD LV2CORE SLV2 RAUL REDLANDMM' autowaf.use_lib(bld, obj, core_libs) - if bld.env()['HAVE_SOUP'] or bld.env()['HAVE_LIBLO']: + if bld.env()['HAVE_SOUP'] == 1 or bld.env()['HAVE_LIBLO'] == 1: obj = bld.create_obj('cpp', 'shlib') obj.source = ''' events/SetPortValueEvent.cpp @@ -92,45 +90,49 @@ def build(bld): obj.inst_dir = 'lib/ingen' autowaf.use_lib(bld, obj, core_libs) - if bld.env()['HAVE_SOUP']: + if bld.env()['HAVE_SOUP'] == 1: obj = bld.create_obj('cpp', 'shlib') obj.source = 'QueuedEventSource.cpp QueuedEngineInterface.cpp HTTPEngineReceiver.cpp' obj.includes = ['.', '..', '../common', './events', '../engine'] obj.name = 'libingen_engine_http' obj.target = 'ingen_engine_http' obj.inst_dir = 'lib/ingen' + obj.uselib_local = 'libingen_engine' autowaf.use_lib(bld, obj, core_libs + ' SOUP') - if bld.env()['HAVE_LIBLO']: + if bld.env()['HAVE_LIBLO'] == 1: obj = bld.create_obj('cpp', 'shlib') obj.source = 'QueuedEventSource.cpp QueuedEngineInterface.cpp OSCClientSender.cpp OSCEngineReceiver.cpp' obj.includes = ['.', '..', '../common', './events', '../engine'] obj.name = 'libingen_engine_osc' obj.target = 'ingen_engine_osc' obj.inst_dir = 'lib/ingen' + obj.uselib_local = 'libingen_engine' autowaf.use_lib(bld, obj, core_libs + ' LIBLO') - if bld.env()['HAVE_JACK']: + if bld.env()['HAVE_JACK'] == 1: obj = bld.create_obj('cpp', 'shlib') obj.source = 'JackAudioDriver.cpp JackMidiDriver.cpp' obj.includes = ['.', '..', '../common', './events', '../engine'] obj.name = 'libingen_engine_jack' obj.target = 'ingen_engine_jack' obj.inst_dir = 'lib/ingen' + obj.uselib_local = 'libingen_engine' autowaf.use_lib(bld, obj, core_libs + ' JACK') # Lightweight ingen/lv2 wrapper obj = bld.create_obj('cpp', 'shlib') obj.source = core_source - if bld.env()['HAVE_LADSPA']: - obj.source += ' LADSPANode.cpp ' - if bld.env()['HAVE_SLV2']: - obj.source += ' LV2Node.cpp ' + if bld.env()['HAVE_LADSPA'] == 1: + obj.source += ' LADSPAPlugin.cpp LADSPANode.cpp ' + if bld.env()['HAVE_SLV2'] == 1: + obj.source += ' LV2Plugin.cpp LV2Node.cpp ' obj.includes = ['.', '..', '../common', './events'] obj.name = 'ingen_lv2' obj.target = 'ingen.lv2/ingen_lv2' #obj.inst_dir = 'lib/lv2/ingen.lv2' obj.inst_var = 0 + obj.uselib_local = 'libingen_engine' core_libs = 'GLIBMM GTHREAD LV2CORE SLV2 RAUL REDLANDMM' autowaf.use_lib(bld, obj, core_libs) diff --git a/src/module/wscript b/src/module/wscript index a3b593d9..b18b39b5 100644 --- a/src/module/wscript +++ b/src/module/wscript @@ -8,10 +8,11 @@ def build(bld): Module.cpp global.cpp ''' - obj.includes = ['.', '..', '../common'] - obj.defines = 'INGEN_MODULE_DIR=\\\"' + bld.env()['PREFIX'] + 'lib/ingen\\\"' - obj.name = 'libingen_module' - obj.target = 'ingen_module' - obj.vnum = '0.0.0' + obj.includes = ['.', '..', '../common'] + obj.defines = 'INGEN_MODULE_DIR=\\\"' + bld.env()['PREFIX'] + 'lib/ingen\\\"' + obj.name = 'libingen_module' + obj.target = 'ingen_module' + obj.vnum = '0.0.0' + obj.uselib_local = 'libingen_shared' autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE SLV2 RAUL REDLANDMM') diff --git a/src/serialisation/wscript b/src/serialisation/wscript index 8fa5aeb9..d1d30a26 100644 --- a/src/serialisation/wscript +++ b/src/serialisation/wscript @@ -9,9 +9,10 @@ def build(bld): Serialiser.cpp serialisation.cpp ''' - obj.includes = ['.', '..', '../common'] - obj.name = 'libingen_serialisation' - obj.target = 'ingen_serialisation' - obj.inst_dir = 'lib/ingen' + obj.includes = ['.', '..', '../common'] + obj.name = 'libingen_serialisation' + obj.target = 'ingen_serialisation' + obj.inst_dir = 'lib/ingen' + obj.uselib_local = 'libingen_shared' autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE SLV2 RAUL REDLANDMM') diff --git a/wscript b/wscript index e222a3b4..e290c51f 100644 --- a/wscript +++ b/wscript @@ -28,13 +28,13 @@ def set_options(opt): def configure(conf): autowaf.configure(conf) autowaf.check_tool(conf, 'compiler_cxx') - autowaf.check_pkg(conf, 'glibmm-2.4', destvar='GLIBMM', vnum='2.16.0', mandatory=True) - autowaf.check_pkg(conf, 'gthread-2.0', destvar='GTHREAD', vnum='2.16.0', mandatory=True) + autowaf.check_pkg(conf, 'glibmm-2.4', destvar='GLIBMM', vnum='2.14.0', mandatory=True) + autowaf.check_pkg(conf, 'gthread-2.0', destvar='GTHREAD', vnum='2.14.0', mandatory=True) autowaf.check_pkg(conf, 'gtkmm-2.4', destvar='GTKMM', vnum='2.11.12', mandatory=False) autowaf.check_pkg(conf, 'jack', destvar='JACK', vnum='0.109.0', mandatory=True) autowaf.check_pkg(conf, 'slv2', destvar='SLV2', vnum='0.6.0', mandatory=True) autowaf.check_pkg(conf, 'raul', destvar='RAUL', vnum='0.5.1', mandatory=True) - autowaf.check_pkg(conf, 'flowcanvas', destvar='FLOWCANVAS', vnum='0.5.1', mandatory=True) + autowaf.check_pkg(conf, 'flowcanvas', destvar='FLOWCANVAS', vnum='0.5.1', mandatory=False) autowaf.check_pkg(conf, 'libxml-2.0', destvar='XML2', vnum='2.6.0', mandatory=False) autowaf.check_pkg(conf, 'libglademm-2.4', destvar='GLADEMM', vnum='2.6.0', mandatory=False) autowaf.check_pkg(conf, 'libsoup-2.4', destvar='SOUP', vnum='2.4.0', mandatory=False) @@ -42,19 +42,27 @@ def configure(conf): if not Params.g_options.no_liblo: autowaf.check_pkg(conf, 'liblo', destvar='LIBLO', vnum='0.25', mandatory=False) autowaf.check_pkg(conf, 'redlandmm', destvar='REDLANDMM', vnum='0.0.0', mandatory=False) - + + # Check for posix_memalign (OSX, amazingly, doesn't have it) + fe = conf.create_function_enumerator() + fe.function = 'posix_memalign' + fe.define = 'HAVE_POSIX_MEMALIGN' + fe.run() + + build_gui = conf.env['GLADEMM'] == 1 and conf.env['FLOWCANVAS'] == 1 + conf.define('INGEN_VERSION', INGEN_VERSION) - conf.define('BUILD_GUI', bool(conf.env['GLADEMM'])) - conf.define('HAVE_JACK_MIDI', conf.env['HAVE_JACK'] or conf.env['HAVE_JACK_DBUS']) + conf.define('BUILD_GUI', build_gui) + conf.define('HAVE_JACK_MIDI', conf.env['HAVE_JACK'] == 1) conf.write_config_header('config.h') autowaf.print_summary(conf) autowaf.display_header('Ingen Configuration') - autowaf.display_msg("Jack", str(bool(conf.env['HAVE_JACK'])), 'YELLOW') - autowaf.display_msg("OSC", str(bool(conf.env['HAVE_LIBLO'])), 'YELLOW') - autowaf.display_msg("HTTP", str(bool(conf.env['HAVE_SOUP'])), 'YELLOW') - autowaf.display_msg("LV2", str(bool(conf.env['HAVE_SLV2'])), 'YELLOW') - autowaf.display_msg("LADSPA", str(bool(conf.env['HAVE_LADSPA'])), 'YELLOW') + autowaf.display_msg("Jack", str(conf.env['HAVE_JACK'] == 1), 'YELLOW') + autowaf.display_msg("OSC", str(conf.env['HAVE_LIBLO'] == 1), 'YELLOW') + autowaf.display_msg("HTTP", str(conf.env['HAVE_SOUP'] == 1), 'YELLOW') + autowaf.display_msg("LV2", str(conf.env['HAVE_SLV2'] == 1), 'YELLOW') + autowaf.display_msg("LADSPA", str(conf.env['HAVE_LADSPA'] == 1), 'YELLOW') print def build(bld): @@ -68,7 +76,9 @@ def build(bld): bld.add_subdirs('src/module') bld.add_subdirs('src/shared') bld.add_subdirs('src/client') - bld.add_subdirs('src/gui') + + if bld.env()['BUILD_GUI']: + bld.add_subdirs('src/gui') # Program bld.add_subdirs('src/ingen') -- cgit v1.2.1