1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#!/usr/bin/env python
from distutils.sysconfig import *
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
from numpy.distutils.system_info import get_info
from os.path import join, realpath
config = Configuration(None, parent_package, top_path)
config.set_options(assume_default_configuration=True,
delegate_options_to_subpackages=True)
"""
Set include paths for the compiler
"""
config.add_include_dirs(realpath('core'))
config.add_include_dirs(realpath(join('core','lapack_lite')))
config.add_include_dirs(realpath(join('python', 'wrapper')))
config.add_include_dirs(get_numpy_include_dirs())
"""
Source files to build
"""
sources = [join('core', '*.c')]
sources.append(join('python', 'wrapper', 'fffpy.c'))
"""
Determine libraries to link against
Default cblas implementation is gslcblas, which can be overriden in
the [blas] section of the .cfg file
"""
lapack_info = get_info('lapack_opt', 0)
## Uncomment the next line to force building and linking with lapack lite
##lapack_info = {}
if not lapack_info:
sources.append(join('core', 'lapack_lite', '*.c'))
library_dirs = []
libraries = []
else:
library_dirs = lapack_info['library_dirs']
libraries = lapack_info['libraries']
if lapack_info.has_key('include_dirs'):
config.add_include_dirs(lapack_info['include_dirs'])
print "Linking against libraries: %s" % libraries
"""
Build fffpy library (core + numpy wrapper)
"""
config.add_library('fffpy',
sources=sources,
library_dirs=library_dirs,
libraries=libraries)
"""
Add fff as a subpackage
"""
config.add_subpackage('fff2', subpackage_path='python')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(
description='Fast and Furious fMRI',
configuration=configuration,
)
|