Mercurial > hg > vamp-plugin-sdk
changeset 10:83d3eb580731
* Use a single Makefile
author | cannam |
---|---|
date | Thu, 06 Apr 2006 12:01:07 +0000 |
parents | 44113b1e296b |
children | 6616075ec7b6 |
files | Makefile examples/Makefile examples/plugins.cpp host/Makefile host/simplehost.cpp host/system.h vamp-sdk/PluginAdapter.h vamp-sdk/PluginHostAdapter.h vamp-sdk/RealTime.cpp vamp-sdk/RealTime.h |
diffstat | 10 files changed, 86 insertions(+), 71 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Wed Apr 05 16:50:07 2006 +0000 +++ b/Makefile Thu Apr 06 12:01:07 2006 +0000 @@ -1,21 +1,75 @@ +# Makefile for the Vamp plugin SDK. This builds the SDK objects, +# example plugins, and the test host. Please adjust to suit your +# operating system requirements. -all: examples_ host_ test +SDKDIR = vamp-sdk +APIDIR = vamp +EXAMPLEDIR = examples +HOSTDIR = host -examples_: - $(MAKE) -C examples all -host_: - $(MAKE) -C host all +### Start of user-serviceable parts -test: - $(MAKE) -C host test +# Compile flags +CXXFLAGS := $(CXXFLAGS) -O2 -Wall -I$(SDKDIR) -I$(APIDIR) -I. -clean: - $(MAKE) -C examples clean +# Libraries required for the host at link time +HOST_LIBS = -ldl -distclean: - $(MAKE) -C examples distclean - $(MAKE) -C host distclean - rm -f *~ *.bak $(TARGET) +# Libraries required for the plugin. Note that we can (and actively +# want to) statically link with libstdc++, because our plugin exposes +# a C API so there are no boundary compatibility problems. +#PLUGIN_LIBS = $(shell g++ -print-file-name=libstdc++.a) +# Flags required to tell the compiler to link to a dynamically loadable object +PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc + +# File extension for a dynamically loadable object +PLUGIN_EXT = .so + +## For OS/X with g++: +#PLUGIN_LDFLAGS = -dynamiclib +#PLUGIN_EXT = .dylib + +### End of user-serviceable parts + + +PLUGIN_OBJECTS = \ + $(SDKDIR)/PluginAdapter.o \ + $(SDKDIR)/PluginHostAdapter.o \ + $(SDKDIR)/RealTime.o \ + $(EXAMPLEDIR)/ZeroCrossing.o \ + $(EXAMPLEDIR)/SpectralCentroid.o \ + $(EXAMPLEDIR)/plugins.o + +PLUGIN_TARGET = \ + $(EXAMPLEDIR)/plugins$(PLUGIN_EXT) + +HOST_OBJECTS = \ + $(SDKDIR)/PluginAdapter.o \ + $(SDKDIR)/PluginHostAdapter.o \ + $(SDKDIR)/RealTime.o \ + $(HOSTDIR)/simplehost.o + +HOST_TARGET = \ + $(HOSTDIR)/simplehost + +all: $(PLUGIN_TARGET) $(HOST_TARGET) test + +$(PLUGIN_TARGET): $(PLUGIN_OBJECTS) + $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $^ $(PLUGIN_LIBS) + +$(HOST_TARGET): $(HOST_OBJECTS) + $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(HOST_LIBS) + +test: $(HOST_TARGET) $(PLUGIN_TARGET) + $(HOST_TARGET) $(PLUGIN_TARGET) + +clean: + rm -f $(PLUGIN_OBJECTS) $(HOST_OBJECTS) + +distclean: clean + rm -f $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~ + +
--- a/examples/Makefile Wed Apr 05 16:50:07 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ - -TARGET := plugins.so -OBJECTS := ZeroCrossing.o SpectralCentroid.o plugins.o - -SDKPATH := ../vamp-sdk -APIPATH := ../vamp - -CXXFLAGS := $(CXXFLAGS) -O2 -Wall -I$(SDKPATH) -I$(APIPATH) - -LDFLAGS := -shared -Wl,-Bsymbolic - -SDKFILES := $(SDKPATH)/PluginAdapter.cpp $(SDKPATH)/RealTime.cpp - -plugins.so: $(OBJECTS) - $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(TARGET) $(SDKFILES) $(OBJECTS) - -all: $(TARGET) - -clean: - rm -f $(OBJECTS) - -distclean: clean - rm -f *~ *.bak $(TARGET) - -ZeroCrossing.o: ZeroCrossing.cpp $(APIPATH)/vamp.h $(SDKPATH)/PluginAdapter.h $(SDKPATH)/PluginAdapter.cpp $(SDKPATH)/RealTime.h $(SDKPATH)/RealTime.cpp $(SDKPATH)/Plugin.h $(SDKPATH)/PluginBase.h -SpectralCentroid.o: SpectralCentroid.cpp $(APIPATH)/vamp.h $(SDKPATH)/PluginAdapter.h $(SDKPATH)/PluginAdapter.cpp $(SDKPATH)/RealTime.h $(SDKPATH)/RealTime.cpp $(SDKPATH)/Plugin.h $(SDKPATH)/PluginBase.h
--- a/examples/plugins.cpp Wed Apr 05 16:50:07 2006 +0000 +++ b/examples/plugins.cpp Thu Apr 06 12:01:07 2006 +0000 @@ -34,7 +34,7 @@ authorization. */ -#include "vamp.h" +#include <vamp/vamp.h> #include "PluginAdapter.h" #include "ZeroCrossing.h"
--- a/host/Makefile Wed Apr 05 16:50:07 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ - -SDKPATH := ../vamp-sdk -APIPATH := ../vamp - -CXXFLAGS := $(CXXFLAGS) -O2 -Wall -I$(SDKPATH) -I$(APIPATH) -LIBS := $(LIBS) -ldl - -SDKFILES := $(SDKPATH)/PluginHostAdapter.cpp $(SDKPATH)/RealTime.cpp - -simplehost: simplehost.o - $(CXX) $(CXXFLAGS) -o simplehost $(SDKFILES) simplehost.o $(LIBS) - -all: simplehost - -test: - simplehost ../examples/plugins.so - -clean: - rm -f simplehost.o - -distclean: clean - rm -f simplehost *~ *.bak - -simplehost.o: simplehost.cpp system.h $(APIPATH)/vamp.h $(SDKPATH)/PluginHostAdapter.h $(SDKPATH)/PluginHostAdapter.cpp $(SDKPATH)/RealTime.h $(SDKPATH)/RealTime.cpp $(SDKPATH)/Plugin.h $(SDKPATH)/PluginBase.h
--- a/host/simplehost.cpp Wed Apr 05 16:50:07 2006 +0000 +++ b/host/simplehost.cpp Thu Apr 06 12:01:07 2006 +0000 @@ -63,7 +63,7 @@ if (!libraryHandle) { std::cerr << argv[0] << ": Failed to open plugin library " - << soname << std::endl; + << soname << ": " << DLERROR() << std::endl; return 1; }
--- a/host/system.h Wed Apr 05 16:50:07 2006 +0000 +++ b/host/system.h Thu Apr 06 12:01:07 2006 +0000 @@ -57,9 +57,17 @@ #define DLCLOSE(a) dlclose((a)) #define DLERROR() dlerror() +#ifdef __APPLE__ + +#define PLUGIN_GLOB "*.dylib" + +#else + #define PLUGIN_GLOB "*.so" +#endif /* __APPLE__ */ + +#endif /* ! _WIN32 */ + #endif -#endif -
--- a/vamp-sdk/PluginAdapter.h Wed Apr 05 16:50:07 2006 +0000 +++ b/vamp-sdk/PluginAdapter.h Thu Apr 06 12:01:07 2006 +0000 @@ -37,7 +37,8 @@ #ifndef _VAMP_PLUGIN_ADAPTER_H_ #define _VAMP_PLUGIN_ADAPTER_H_ -#include "vamp.h" +#include <vamp/vamp.h> + #include "Plugin.h" #include <map>
--- a/vamp-sdk/PluginHostAdapter.h Wed Apr 05 16:50:07 2006 +0000 +++ b/vamp-sdk/PluginHostAdapter.h Thu Apr 06 12:01:07 2006 +0000 @@ -37,7 +37,7 @@ #ifndef _VAMP_PLUGIN_HOST_ADAPTER_H_ #define _VAMP_PLUGIN_HOST_ADAPTER_H_ -#include "vamp.h" +#include <vamp/vamp.h> #include "Plugin.h"
--- a/vamp-sdk/RealTime.cpp Wed Apr 05 16:50:07 2006 +0000 +++ b/vamp-sdk/RealTime.cpp Thu Apr 06 12:01:07 2006 +0000 @@ -37,7 +37,8 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2006 Chris Cannam; relicensed as detailed above + This file copyright 2000-2006 Chris Cannam. + Relicensed by the author as detailed above. */ #include <iostream>
--- a/vamp-sdk/RealTime.h Wed Apr 05 16:50:07 2006 +0000 +++ b/vamp-sdk/RealTime.h Thu Apr 06 12:01:07 2006 +0000 @@ -37,7 +37,8 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2006 Chris Cannam; relicensed as detailed above + This file copyright 2000-2006 Chris Cannam. + Relicensed by the author as detailed above. */ #ifndef _VAMP_REAL_TIME_H_