/[ascend]/trunk/scons/sundials.py
ViewVC logotype

Contents of /trunk/scons/sundials.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2150 - (show annotations) (download) (as text)
Tue Feb 16 06:08:57 2010 UTC (10 years ago) by mahesh
File MIME type: text/x-python
File size: 2001 byte(s)
Bump trunk to 0.9.8.
Some work on detection of SUNDIALS on Linux (will need to be reviewed on Windows).
Update DistTar for smoother building of tarball, less stray deps.
1 import os, os.path, platform, subprocess
2 from SCons.Script import *
3
4 munge = lambda s: s
5
6 try:
7 # if we have access to GetShortPathName, we'll use it...
8 import win32api
9 def munge1(s):
10 s1 = s
11 try:
12 # we can only munge the path if it actually exists
13 s1 = win32api.GetShortPathName(s)
14 except:
15 # if it doesn't exist, we just return the un-munged path
16 pass
17 return s1
18 munge = munge1
19 except:
20 pass
21
22 def generate(env):
23 """
24 Detect SUNDIALS (IDA) settings and add them to the environment.
25 """
26 try:
27 if platform.system()=="Windows":
28 import _winreg
29 x=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
30 y= _winreg.OpenKey(x,r"SOFTWARE\SUNDIALS")
31 PATH,t = _winreg.QueryValueEx(y,"InstallPath")
32 LIB = os.path.join(PATH,"lib")
33 BIN = os.path.join(PATH,"bin")
34 INCLUDE = os.path.join(PATH,"include")
35
36 env['SUNDIALS_CPPPATH'] = [munge(INCLUDE)]
37 env['SUNDIALS_LIBPATH'] = [munge(BIN)]
38 env['SUNDIALS_LIBS'] = ['sundials_ida','sundials_nvecserial','m']
39 env['HAVE_SUNDIALS'] = True
40
41 else:
42 cmd = ['sundials-config','-mida','-ts','-lc']
43 env1 = env.Clone()
44 env1['CPPPATH'] = None
45 env1['LIBPATH'] = None
46 env1['LIBS'] = None
47 env1.ParseConfig(cmd)
48 env['SUNDIALS_CPPPATH'] = env1.get('CPPPATH')
49 env['SUNDIALS_LIBPATH'] = env1.get('LIBPATH')
50 env['SUNDIALS_LIBS'] = env1.get('LIBS')
51 env['HAVE_SUNDIALS'] = True
52
53 print "SUNDIALS_LIBS =",env.get('SUNDIALS_LIBS')
54 print "SUNDIALS_LIBPATH =",env.get('SUNDIALS_LIBPATH')
55 print "SUNDIALS_CPPPATH =",env.get('SUNDIALS_CPPPATH')
56
57 except:
58 env['HAVE_SUNDIALS'] = False
59
60 def exists(env):
61 """
62 Make sure this tool exists.
63 """
64 if platform.system()=="Windows":
65 try:
66 import _winreg
67 x=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
68 y= _winreg.OpenKey(x,r"SOFTWARE\SUNDIALS")
69 INCLUDE,t = _winreg.QueryValueEx(y,'INSTALL_INCLUDE')
70 return True
71 except:
72 return False
73 else:
74 if not subprocess.call('sundials-config -h'):
75 return True
76 return False
77

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22