From 41399bd47e9f1240000220de37df57b39a90174e Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 5 Mar 2013 14:10:57 -0500 Subject: [PATCH] ext/aubio-types.h: use -DLOCAL_AUBIO to build against local aubio --- python/ext/aubio-types.h | 4 ++++ python/setup.py | 27 ++++++++++++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/python/ext/aubio-types.h b/python/ext/aubio-types.h index 0cdac2c4..1ed7b0a6 100644 --- a/python/ext/aubio-types.h +++ b/python/ext/aubio-types.h @@ -22,7 +22,11 @@ //#include #define AUBIO_UNSTABLE 1 +#ifdef LOCAL_AUBIO #include "aubio.h" +#else +#include "aubio/aubio.h" +#endif #define Py_default_vector_length 1024 diff --git a/python/setup.py b/python/setup.py index a4e1ccc4..376c5cb1 100755 --- a/python/setup.py +++ b/python/setup.py @@ -11,26 +11,30 @@ __version__ = '.'.join \ ([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 += ['ext'] -include_dirs += ['gen'] -#include_dirs += ['../build/src', '../src', '.' ] - -library_dirs = filter (lambda x: os.path.isdir(x), library_dirs) -include_dirs = filter (lambda x: os.path.isdir(x), include_dirs) +include_dirs = [] +library_dirs = [] +define_macros = [] -generated_object_files = [] +include_dirs += ['ext'] +include_dirs += [ numpy.get_include() ] output_path = 'gen' +generated_object_files = [] 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", @@ -45,8 +49,9 @@ aubio_extension = Extension("aubio._aubio", [ "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'): -- 2.26.2