shithub: aubio

Download patch

ref: 41399bd47e9f1240000220de37df57b39a90174e
parent: 63f6c13b3d5823e8126c488e4698dd398b483e05
author: Paul Brossier <piem@piem.org>
date: Tue Mar 5 09:10:57 EST 2013

ext/aubio-types.h: use -DLOCAL_AUBIO to build against local aubio

--- a/python/ext/aubio-types.h
+++ b/python/ext/aubio-types.h
@@ -22,7 +22,11 @@
 //#include <numpy/npy_3kcompat.h>
 
 #define AUBIO_UNSTABLE 1
+#ifdef LOCAL_AUBIO
 #include "aubio.h"
+#else
+#include "aubio/aubio.h"
+#endif
 
 #define Py_default_vector_length 1024
 
--- a/python/setup.py
+++ b/python/setup.py
@@ -11,27 +11,31 @@
         ([str(x) for x in [AUBIO_MAJOR_VERSION, AUBIO_MINOR_VERSION, AUBIO_PATCH_VERSION]]) \
         + AUBIO_VERSION_STATUS
 
-library_dirs = ['../build/src']
-include_dirs = ['../src'] # aubio.h
-include_dirs += ['../build/src'] # config.h
+include_dirs = []
+library_dirs = []
+define_macros = []
+
 include_dirs += ['ext']
-include_dirs += ['gen']
-#include_dirs += ['../build/src', '../src', '.' ]
+include_dirs += [ numpy.get_include() ]
 
-library_dirs = filter (lambda x: os.path.isdir(x), library_dirs)
-include_dirs = filter (lambda x: os.path.isdir(x), include_dirs)
-
+output_path = 'gen'
 generated_object_files = []
 
-output_path = 'gen'
-
 if not os.path.isdir(output_path):
     from generator import generate_object_files
     generated_object_files = generate_object_files(output_path)
+    # define include dirs
 else:
     import glob
     generated_object_files = glob.glob(os.path.join(output_path, '*.c'))
+include_dirs += [output_path]
 
+if os.path.isfile('../src/aubio.h'):
+    define_macros += [('USE_LOCAL_AUBIO', 1)]
+    include_dirs += ['../src'] # aubio.h
+    include_dirs += ['../build/src'] # config.h
+    library_dirs += ['../build/src']
+
 aubio_extension = Extension("aubio._aubio", [
             "ext/aubiomodule.c",
             "ext/aubioproxy.c",
@@ -45,8 +49,9 @@
             "ext/py-phasevoc.c",
             # generated files
             ] + generated_object_files,
-        include_dirs = include_dirs + [ numpy.get_include() ],
+        include_dirs = include_dirs,
         library_dirs = library_dirs,
+        define_macros = define_macros,
         libraries=['aubio'])
 
 if sys.platform.startswith('darwin'):