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 |
# John Pye, Jun 2007. |
8 |
|
9 |
env = Environment(tools=['default','fortran']) |
10 |
|
11 |
env['FORTRAN'] = "gfortran" |
12 |
env['SHFORTRANFLAGS'] = ['-O'] |
13 |
|
14 |
#print "SHFORTRANCOM =",env['SHFORTRANCOM'] |
15 |
|
16 |
tron = "dbreakpt.o dgpstep.o dsetsp.o dtron.o \ |
17 |
dcauchy.o dmid.o dspcg.o dtrpcg.o \ |
18 |
dgpnrm2.o dprsrch.o dsphesd.o dtrqsol.o" |
19 |
|
20 |
icf = "dicf.o dpcg.o dssyax.o ihsort.o srtdat2.o \ |
21 |
dicfs.o dsel2.o dstrsol.o insort.o" |
22 |
|
23 |
coloring = "degr.o ido.o numsrt.o seq.o slo.o srtdat.o \ |
24 |
dssm.o idog.o sdpt.o setr.o slog.o" |
25 |
|
26 |
# no blas routines -- we'll link to another BLAS, see below. |
27 |
|
28 |
tprobs = "deptfg.o dgl1sp.o dljcfg.o dmsabc.o dodchs.o dpjbsp.o \ |
29 |
depths.o dgl2co.o dminfg.o dmsafg.o dodcps.o dsscfg.o \ |
30 |
deptsp.o dgl2fg.o dminhs.o dmsahs.o dodcsp.o dsschs.o \ |
31 |
dgl1fg.o dgl2hs.o dminsp.o dmsasp.o dpjbfg.o dsscsp.o \ |
32 |
dgl1hs.o dgl2sp.o dminxb.o dodcfg.o dpjbhs.o" |
33 |
|
34 |
srcs = {"tron":tron,"icf":icf,"coloring":coloring,"tprobs":tprobs} |
35 |
|
36 |
# note that the 'utils' directory is deal with separately below. |
37 |
|
38 |
import re |
39 |
r1 = re.compile("\.o$") |
40 |
|
41 |
objs = [] |
42 |
|
43 |
for k,v in srcs.iteritems(): |
44 |
for o in v.split(): |
45 |
srcname = r1.sub(".f",o) |
46 |
objs += env.SharedObject("src/%s/%s" % (k,srcname)) |
47 |
|
48 |
|
49 |
objs += [ |
50 |
env.SharedObject("src/utils/wallclock.c") |
51 |
,env.SharedObject("src/utils/cputime.F") |
52 |
,env.SharedObject("src/utils/dpmeps.f") |
53 |
] |
54 |
|
55 |
# build the shared library 'libtron.so' or 'tron.dll' |
56 |
|
57 |
lib = env.SharedLibrary("tron",objs) |
58 |
|
59 |
# build the test program and link to our shared library |
60 |
|
61 |
prog = env.Program("tron",['driver.f'] |
62 |
,LIBS=['tron','blas'] |
63 |
,LIBPATH=['#'] |
64 |
,CC="gfortran" |
65 |
) |