File: SConscript

package info (click to toggle)
python-scipy 0.10.1%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 42,232 kB
  • sloc: cpp: 224,773; ansic: 103,496; python: 85,210; fortran: 79,130; makefile: 272; sh: 43
file content (81 lines) | stat: -rw-r--r-- 2,361 bytes parent folder | download | duplicates (3)
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
71
72
73
74
75
76
77
78
79
80
81
# Last Change: Sat May 03 02:00 PM 2008 J
# vim:syntax=python

import os
from os.path import join as pjoin, splitext

from numscons import GetNumpyEnvironment
from numscons import CheckCBLAS, CheckF77BLAS,\
                     IsVeclib, IsAccelerate, \
                     IsATLAS, GetATLASVersion
from numscons import write_info

from scons_support import do_generate_fake_interface, generate_interface_emitter

env = GetNumpyEnvironment(ARGUMENTS)
env.Tool('f2py')

#if os.name == 'nt':
#    # NT needs the pythonlib to run any code importing Python.h, including
#    # simple code using only typedef and so on, so we need it for configuration
#    # checks
#    env.AppendUnique(LIBPATH = [get_pythonlib_dir()])

env['BUILDERS']['GenerateFakePyf'] = Builder(action = do_generate_fake_interface,
                                             emitter = generate_interface_emitter)

#=======================
# Starting Configuration
#=======================
config = env.NumpyConfigure(custom_tests = {'CheckCBLAS' : CheckCBLAS,
                                            'CheckBLAS' : CheckF77BLAS})

#--------------
# Checking Blas
#--------------
st = config.CheckBLAS(check_version = 1)
if not st:
    raise RuntimeError("no blas found, necessary for linalg module")
if IsATLAS(env, 'blas'):
    version = GetATLASVersion(env)
    env.Append(CPPDEFINES = [('ATLAS_INFO', '"\\"%s"\\"' % version)])
else:
    env.Append(CPPDEFINES = [('NO_ATLAS_INFO', 1)])

if config.CheckCBLAS():
    has_cblas = 1
else:
    has_cblas = 0

config.Finish()
write_info(env)

#==========
#  Build
#==========

# XXX: handle cblas wrapper for complex (check in numpy.scons or here ?)
env.AppendUnique(F2PYOPTIONS = '--quiet')

#------------
#   fblas
#------------
env.FromFTemplate('fblas.pyf', 'fblas.pyf.src')
source = ['fblas.pyf']
if IsVeclib(env, 'blas') or IsAccelerate(env, 'blas'):
    env.FromCTemplate('fblaswrap_veclib_c.c', 'fblaswrap_veclib_c.c.src')
    source.append('fblaswrap_veclib_c.c')
else:
    env.FromFTemplate('fblaswrap.f', 'fblaswrap.f.src')
    source.append('fblaswrap.f')
env.NumpyPythonExtension('fblas', source)

#------------
#   cblas
#------------
source = ['cblas.pyf']
if has_cblas:
    env.FromFTemplate('cblas.pyf', 'cblas.pyf.src')
else:
    print env.GenerateFakePyf('cblas', 'cblas.pyf.src')
env.NumpyPythonExtension('cblas', source)