1 |
# This SCons build file allows a shared-library version of the |
2 |
# optimisation package TRON to be built. |
3 |
# |
4 |
# Sources for TRON are available from |
5 |
# http://www-unix.mcs.anl.gov/~more/tron/index.html |
6 |
# |
7 |
# Extract the tarball, put this file in the extracted 'tron' |
8 |
# directory, then type 'scons'. This will build 'libtron.so' |
9 |
# which you must then manually put somewhere nice. |
10 |
# |
11 |
# John Pye, Jun 2007. |
12 |
|
13 |
env = Environment(tools=['default','fortran']) |
14 |
|
15 |
env['FORTRAN'] = "gfortran" |
16 |
env['SHFORTRANFLAGS'] = ['-O'] |
17 |
|
18 |
#print "SHFORTRANCOM =",env['SHFORTRANCOM'] |
19 |
|
20 |
tron = "dbreakpt.o dgpstep.o dsetsp.o dtron.o \ |
21 |
dcauchy.o dmid.o dspcg.o dtrpcg.o \ |
22 |
dgpnrm2.o dprsrch.o dsphesd.o dtrqsol.o" |
23 |
|
24 |
icf = "dicf.o dpcg.o dssyax.o ihsort.o srtdat2.o \ |
25 |
dicfs.o dsel2.o dstrsol.o insort.o" |
26 |
|
27 |
coloring = "degr.o ido.o numsrt.o seq.o slo.o srtdat.o \ |
28 |
dssm.o idog.o sdpt.o setr.o slog.o" |
29 |
|
30 |
# no blas routines -- we'll link to another BLAS, see below. |
31 |
|
32 |
tprobs = "deptfg.o dgl1sp.o dljcfg.o dmsabc.o dodchs.o dpjbsp.o \ |
33 |
depths.o dgl2co.o dminfg.o dmsafg.o dodcps.o dsscfg.o \ |
34 |
deptsp.o dgl2fg.o dminhs.o dmsahs.o dodcsp.o dsschs.o \ |
35 |
dgl1fg.o dgl2hs.o dminsp.o dmsasp.o dpjbfg.o dsscsp.o \ |
36 |
dgl1hs.o dgl2sp.o dminxb.o dodcfg.o dpjbhs.o" |
37 |
|
38 |
srcs = {"tron":tron,"icf":icf,"coloring":coloring,"tprobs":tprobs} |
39 |
|
40 |
# note that the 'utils' directory is deal with separately below. |
41 |
|
42 |
import re |
43 |
r1 = re.compile("\.o$") |
44 |
|
45 |
objs = [] |
46 |
|
47 |
for k,v in srcs.iteritems(): |
48 |
for o in v.split(): |
49 |
srcname = r1.sub(".f",o) |
50 |
objs += env.SharedObject("src/%s/%s" % (k,srcname)) |
51 |
|
52 |
|
53 |
objs += [ |
54 |
env.SharedObject("src/utils/wallclock.c") |
55 |
,env.SharedObject("src/utils/cputime.F") |
56 |
,env.SharedObject("src/utils/dpmeps.f") |
57 |
] |
58 |
|
59 |
# build the shared library 'libtron.so' or 'tron.dll' |
60 |
|
61 |
lib = env.SharedLibrary("tron",objs) |
62 |
|
63 |
# build the test program and link to our shared library |
64 |
|
65 |
prog = env.Program("tron",['driver.f'] |
66 |
,LIBS=['tron','blas'] |
67 |
,LIBPATH=['#'] |
68 |
,CC="gfortran" |
69 |
) |