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
|
# Last Change: Sat May 03 02:00 PM 2008 J
# vim:syntax=python
from os.path import join as pjoin, splitext
from numscons import GetNumpyEnvironment
from numscons import CheckF77LAPACK
from numscons import write_info, IsAccelerate, IsVeclib
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()])
#=======================
# Starting Configuration
#=======================
config = env.NumpyConfigure(custom_tests = {'CheckLAPACK' : CheckF77LAPACK})
#-----------------
# Checking Lapack
#-----------------
st = config.CheckLAPACK()
if not st:
raise RuntimeError("no lapack found, necessary for isolve module")
config.Finish()
write_info(env)
#--------------------
# iterative methods
#--------------------
methods = ['BiCGREVCOM.f.src',
'BiCGSTABREVCOM.f.src',
'CGREVCOM.f.src',
'CGSREVCOM.f.src',
# 'ChebyREVCOM.f.src',
'GMRESREVCOM.f.src',
# 'JacobiREVCOM.f.src',
'QMRREVCOM.f.src',
# 'SORREVCOM.f.src'
]
Util = ['STOPTEST2.f.src','getbreak.f.src']
raw_sources = methods + Util + ['_iterative.pyf.src']
sources = []
for method in raw_sources:
target = splitext(method)[0]
res = env.FromFTemplate(target, pjoin('iterative', method))
sources.append(res[0])
#--------------------------------------------------
# BLAS wrapper to fix ABI incompatibilities on OS X
# -------------------------------------------------
use_c_calling = IsAccelerate(env, "lapack") or IsVeclib(env, "lapack")
if use_c_calling:
blas_wrapper = ['veclib_cabi_c.c', 'veclib_cabi_f.f']
else:
blas_wrapper = ['dummy.f']
blas_wrapper = [pjoin('iterative', 'FWRAPPERS', wrapper) \
for wrapper in blas_wrapper]
env.AppendUnique(LIBPATH = ['.'])
veclibwrap_lib = env.DistutilsStaticExtLibrary('_veclibwrap', source=blas_wrapper)
env.Prepend(LIBS='_veclibwrap')
env.NumpyPythonExtension('_iterative', source=sources)
|