changeset 33:c4da8d559872 vampy2

* build fixes for Linux
author cannam
date Wed, 23 Sep 2009 11:56:46 +0000
parents a8231788216c
children c905122f79e7
files Makefile Makefile.cc-linux PyTypeInterface.cpp PyTypeInterface.h
diffstat 4 files changed, 41 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon Sep 21 13:56:28 2009 +0000
+++ b/Makefile	Wed Sep 23 11:56:46 2009 +0000
@@ -1,7 +1,7 @@
 
-CXXFLAGS	:= -DHAVE_NUMPY -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5 -I/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/core/include/numpy/  #-fvisibility=hidden
+CXXFLAGS	:= -DHAVE_NUMPY -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5 -I/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/core/include/numpy/ 
 #without numpy headers available:
-#CXXFLAGS	:= -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5  #-I../host/pyRealTime.h #-fvisibility=hidden
+#CXXFLAGS	:= -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5  #-I../host/pyRealTime.h 
 LDFLAGS		:= -L../vamp-plugin-sdk/vamp-sdk -lvamp-sdk -dynamiclib -lpython2.5 -lpthread
 
 default: vampy.dylib 
--- a/Makefile.cc-linux	Mon Sep 21 13:56:28 2009 +0000
+++ b/Makefile.cc-linux	Wed Sep 23 11:56:46 2009 +0000
@@ -1,9 +1,38 @@
 
-CXXFLAGS	:= -I../vamp-plugin-sdk -O0 -g -Wall -I/usr/include/python2.6 -fPIC
+CXXFLAGS	:= -DHAVE_NUMPY -O2 -Wall -I/usr/include/python2.6 -I/usr/lib/python2.6/dist-packages/numpy/core/include/numpy -fPIC
+LDFLAGS		:= -shared -Wl,-Bstatic -lvamp-sdk -Wl,-Bdynamic -lpython2.6 -lpthread -Wl,--version-script=vamp-plugin.map
 
-vampy.so:	PyPlugin.o PyPlugScanner.o pyvamp-main.o Mutex.o
-	g++ -shared $^ -o $@ -L../vamp-plugin-sdk/src -Wl,-Bstatic -lvamp-sdk -Wl,-Bdynamic -lpython2.6 -lpthread -Wl,--version-script=vamp-plugin.map
+default: vampy.so 
+all: vampy.so vampymod.so
+
+PyExtensionModule.a: PyExtensionModule.o PyRealTime.o PyFeature.o PyParameterDescriptor.o PyOutputDescriptor.o PyFeatureSet.o 
+	ar cr $@ $^
+
+# The standard python extension is .so (even on the Mac)
+vampymod.so: PyExtensionModule.o PyRealTime.o PyFeature.o PyParameterDescriptor.o PyOutputDescriptor.o PyFeatureSet.o 
+	g++ $^ -o $@ $(LDFLAGS) 
+
+vampy.so: PyPlugin.o PyPlugScanner.o vampy-main.o Mutex.o PyTypeInterface.o PyExtensionModule.a 
+	g++ $^ -o $@ $(LDFLAGS) 
+
+# Install plugin
+#
+LIBRARY_PREFIX		:=/Library
+INSTALL_DIR			:=$(LIBRARY_PREFIX)/Audio/Plug-Ins/Vamp
+PYEXAMPLE_DIR		:='Example VamPy Plugins'
+PLUGIN_NAME			:=vampy
+PLUGIN_EXT			:=.dylib
+
+install:
+	mkdir -p $(INSTALL_DIR)
+	rm -f $(INSTALL_DIR)/$(PLUGIN_NAME)$(PLUGIN_EXT)
+	cp $(PLUGIN_NAME)$(PLUGIN_EXT) $(INSTALL_DIR)/$(PLUGIN_NAME)$(PLUGIN_EXT)
+
+installplug : install
+cleanplug : clean
 
 clean:	
 	rm *.o
+	rm *.a
+	rm *$(PLUGIN_EXT)
 
--- a/PyTypeInterface.cpp	Mon Sep 21 13:56:28 2009 +0000
+++ b/PyTypeInterface.cpp	Wed Sep 23 11:56:46 2009 +0000
@@ -12,7 +12,7 @@
 #include <float.h>
 #include <limits.h>
 #ifndef SIZE_T_MAX
-#define (SIZE_T_MAX (size_t) -1)
+#define SIZE_T_MAX ((size_t) -1)
 #endif
 
 using std::string;
--- a/PyTypeInterface.h	Mon Sep 21 13:56:28 2009 +0000
+++ b/PyTypeInterface.h	Wed Sep 23 11:56:46 2009 +0000
@@ -76,7 +76,7 @@
 	};
 
 /* C++ mapping of PyNone Type*/
-typedef struct NoneType {};
+struct NoneType {};
 
 class PyTypeInterface
 {
@@ -147,7 +147,7 @@
 	
 
 	template<typename RET> 
-	RET PyTypeInterface::PyValue_To_VampDescriptor(PyObject* pyValue) const
+	RET PyValue_To_VampDescriptor(PyObject* pyValue) const
 	//returns e.g. Vamp::Plugin::OutputDescriptor or Vamp::Plugin::Feature
 	{
 		PyObject* pyDict;
@@ -183,7 +183,8 @@
 	/// Convert a sequence (tipically list) of PySomething to 
 	/// OutputList,ParameterList or FeatureList
 	template<typename RET,typename ELEM> //<OutputList> <OutputDescriptor>
-	RET PyTypeInterface::PyValue_To_VampList(PyObject* pyList) const
+
+	RET PyValue_To_VampList(PyObject* pyList) const
 	{
 		// Vamp::Plugin::OutputList list;
 		// Vamp::Plugin::OutputDescriptor od;
@@ -214,7 +215,7 @@
 
 	/// Convert DTYPE type 1D NumpyArray to std::vector<RET>
 	template<typename RET, typename DTYPE>
-	std::vector<RET> PyTypeInterface::PyArray_Convert(char* raw_data_ptr, long length) const
+	std::vector<RET> PyArray_Convert(char* raw_data_ptr, long length) const
 	{
 		std::vector<RET> rValue;
 		DTYPE* data = (DTYPE*) raw_data_ptr;
@@ -388,4 +389,4 @@
                     NPY_USERDEF=256  /* leave room for characters */
 };
 #endif /*NUMPY_REFERENCE*/
-#endif
\ No newline at end of file
+#endif