ext/aubio-types.h: use -DLOCAL_AUBIO to build against local aubio
[aubio.git] / python / setup.py
1 #! /usr/bin/python
2
3 from distutils.core import setup, Extension
4 import sys
5 import os.path
6 import numpy
7
8 # read from VERSION
9 for l in open('VERSION').readlines(): exec (l.strip())
10 __version__ = '.'.join \
11         ([str(x) for x in [AUBIO_MAJOR_VERSION, AUBIO_MINOR_VERSION, AUBIO_PATCH_VERSION]]) \
12         + AUBIO_VERSION_STATUS
13
14 include_dirs = []
15 library_dirs = []
16 define_macros = []
17
18 include_dirs += ['ext']
19 include_dirs += [ numpy.get_include() ]
20
21 output_path = 'gen'
22 generated_object_files = []
23
24 if not os.path.isdir(output_path):
25     from generator import generate_object_files
26     generated_object_files = generate_object_files(output_path)
27     # define include dirs
28 else:
29     import glob
30     generated_object_files = glob.glob(os.path.join(output_path, '*.c'))
31 include_dirs += [output_path]
32
33 if os.path.isfile('../src/aubio.h'):
34     define_macros += [('USE_LOCAL_AUBIO', 1)]
35     include_dirs += ['../src'] # aubio.h
36     include_dirs += ['../build/src'] # config.h
37     library_dirs += ['../build/src']
38
39 aubio_extension = Extension("aubio._aubio", [
40             "ext/aubiomodule.c",
41             "ext/aubioproxy.c",
42             "ext/ufuncs.c",
43             "ext/py-cvec.c",
44             # example without macro
45             "ext/py-filter.c",
46             # macroised
47             "ext/py-filterbank.c",
48             "ext/py-fft.c",
49             "ext/py-phasevoc.c",
50             # generated files
51             ] + generated_object_files,
52         include_dirs = include_dirs,
53         library_dirs = library_dirs,
54         define_macros = define_macros,
55         libraries=['aubio'])
56
57 if sys.platform.startswith('darwin'):
58         aubio_extension.extra_link_args = ['-framework','CoreFoundation', '-framework','AudioToolbox']
59
60 classifiers = [
61         'Development Status :: 4 - Beta',
62         'Environment :: Console',
63         'Intended Audience :: Science/Research',
64         'Topic :: Software Development :: Libraries',
65         'Topic :: Multimedia :: Sound/Audio :: Analysis',
66         'Topic :: Multimedia :: Sound/Audio :: Sound Synthesis',
67         'Operating System :: POSIX',
68         'Operating System :: MacOS :: MacOS X',
69         'Operating System :: Microsoft :: Windows',
70         'Programming Language :: C',
71         'Programming Language :: Python',
72         'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
73         ]
74
75 distrib = setup(name='aubio',
76         version = __version__,
77         packages = ['aubio'],
78         ext_modules = [aubio_extension],
79         description = 'interface to the aubio library',
80         long_description = 'interface to the aubio library',
81         license = 'GNU/GPL version 3',
82         author = 'Paul Brossier',
83         author_email = 'piem@aubio.org',
84         maintainer = 'Paul Brossier',
85         maintainer_email = 'piem@aubio.org',
86         url = 'http://aubio.org/',
87         platforms = 'any',
88         classifiers = classifiers,
89         )
90