1 |
johnpye |
392 |
import os, commands, platform, distutils.sysconfig |
2 |
johnpye |
385 |
|
3 |
|
|
#------------------------------------------------------ |
4 |
|
|
# OPTIONS |
5 |
johnpye |
392 |
# |
6 |
|
|
# Note that if you set the options via the command line, they will be |
7 |
|
|
# remembered in the file 'options.cache'. It's a feature ;-) |
8 |
johnpye |
385 |
|
9 |
|
|
opts = Options(['options.cache', 'config.py']) |
10 |
|
|
print "PLATFORM = ",platform.system() |
11 |
|
|
|
12 |
johnpye |
392 |
# Import the outside environment |
13 |
|
|
env = Environment(ENV=os.environ) |
14 |
johnpye |
385 |
|
15 |
|
|
# Package linking option |
16 |
johnpye |
386 |
opts.Add(EnumOption( |
17 |
|
|
'PACKAGE_LINKING' |
18 |
johnpye |
385 |
, 'Style of linking for external libraries' |
19 |
|
|
, 'DYNAMIC_PACKAGES' |
20 |
johnpye |
386 |
, ['DYNAMIC_PACKAGES', 'STATIC_PACKAGES', 'NO_PACKAGES'] |
21 |
|
|
)) |
22 |
johnpye |
385 |
|
23 |
johnpye |
392 |
# You can turn off building of Tcl/Tk interface |
24 |
johnpye |
386 |
opts.Add(BoolOption( |
25 |
|
|
'WITHOUT_TCLTK_GUI' |
26 |
|
|
,"Set to True if you don't want to build the original Tcl/Tk GUI." |
27 |
|
|
, False |
28 |
|
|
)) |
29 |
|
|
|
30 |
johnpye |
392 |
# You can turn off the building of the Python interface |
31 |
johnpye |
387 |
opts.Add(BoolOption( |
32 |
|
|
'WITHOUT_PYTHON' |
33 |
|
|
,"Set to True if you don't want to build Python wrappers." |
34 |
|
|
, False |
35 |
|
|
)) |
36 |
|
|
|
37 |
johnpye |
392 |
# Which solvers will we allow? |
38 |
|
|
opts.Add(ListOption( |
39 |
|
|
'WITH_SOLVERS' |
40 |
|
|
,"List of the solvers you want to build" |
41 |
|
|
,["QRSLV","CMSLV"] |
42 |
|
|
,['QRSLV','MPS','SLV','OPTSQP' |
43 |
|
|
,'NGSLV','CMSLV','LRSLV','MINOS','CONOPT' |
44 |
|
|
,'LSOD','OPTSQP' |
45 |
|
|
] |
46 |
|
|
)) |
47 |
|
|
|
48 |
|
|
# TODO: add install options |
49 |
|
|
|
50 |
|
|
# TODO: OTHER OPTIONS? |
51 |
|
|
|
52 |
|
|
# TODO: flags for optimisation |
53 |
|
|
|
54 |
johnpye |
385 |
opts.Update(env) |
55 |
|
|
opts.Save('options.cache',env) |
56 |
|
|
|
57 |
|
|
Help(opts.GenerateHelpText(env)) |
58 |
|
|
|
59 |
|
|
env.Append(CPPDEFINES=env['PACKAGE_LINKING']) |
60 |
|
|
|
61 |
johnpye |
386 |
with_tcltk_gui = (env['WITHOUT_TCLTK_GUI']==False) |
62 |
|
|
|
63 |
johnpye |
387 |
with_python = (env['WITHOUT_PYTHON']==False) |
64 |
|
|
|
65 |
johnpye |
392 |
print "SOLVERS:",env['WITH_SOLVERS'] |
66 |
|
|
|
67 |
johnpye |
385 |
#------------------------------------------------------ |
68 |
|
|
# CONFIGURATION |
69 |
|
|
|
70 |
|
|
conf = Configure(env |
71 |
|
|
, custom_tests = { |
72 |
|
|
# 'CheckIsNan' : CheckIsNan |
73 |
|
|
# ,'CheckCppUnitConfig' : CheckCppUnitConfig |
74 |
|
|
} |
75 |
|
|
, config_h = "config.h" |
76 |
|
|
) |
77 |
|
|
|
78 |
|
|
# Math library |
79 |
|
|
if not conf.CheckLibWithHeader(['m','c','libc'], 'math.h', 'C'): |
80 |
|
|
print 'Did not find libm.a or m.lib, exiting!' |
81 |
|
|
Exit(1) |
82 |
|
|
|
83 |
|
|
# Where is 'isnan'? |
84 |
|
|
|
85 |
|
|
if not conf.CheckFunc('isnan'): |
86 |
|
|
print "Didn't find isnan" |
87 |
|
|
Exit(1) |
88 |
|
|
|
89 |
johnpye |
387 |
# Tcl/Tk |
90 |
johnpye |
386 |
if not conf.CheckHeader('tcl.h'): |
91 |
|
|
with_tcltk_gui = False |
92 |
|
|
|
93 |
|
|
if not conf.CheckHeader('tk.h'): |
94 |
|
|
with_tcltk_gui = False |
95 |
|
|
|
96 |
|
|
if not conf.CheckLib('tcl'): |
97 |
|
|
with_tcltk_gui = False |
98 |
|
|
|
99 |
|
|
if not conf.CheckLib('tk'): |
100 |
|
|
with_tcktk_gui = False |
101 |
|
|
|
102 |
johnpye |
392 |
|
103 |
johnpye |
391 |
if platform.system()=="Windows": |
104 |
johnpye |
392 |
#conf.env.Append(LIBPATH='c:\Python24\libs') |
105 |
|
|
#conf.env.Append(CPPPATH='c:\Python24\include') |
106 |
johnpye |
391 |
python_header='Python.h' |
107 |
johnpye |
392 |
python_lib=['python24'] |
108 |
|
|
#python_libpath=['c:\\Python24\\libs'] |
109 |
|
|
#python_cpppath=['c:\\Python24\\include'] |
110 |
johnpye |
391 |
else: |
111 |
|
|
python_header='python2.4/Python.h' |
112 |
johnpye |
392 |
python_lib=['python2.4'] |
113 |
|
|
#python_libpath=[] |
114 |
|
|
#python_cpppath=['/usr/include/python2.4'] |
115 |
|
|
|
116 |
johnpye |
391 |
|
117 |
johnpye |
387 |
# Python |
118 |
johnpye |
391 |
if not conf.CheckLibWithHeader(python_lib,python_header,'C'): |
119 |
|
|
print "Didn't find Python 2.4 ("+python_lib+")" |
120 |
johnpye |
387 |
with_python = False |
121 |
|
|
else: |
122 |
johnpye |
392 |
env.Append(PYTHON_LIBPATH=[distutils.sysconfig.PREFIX+"/libs"]) |
123 |
|
|
#env.Append(PYTHON_LIB=python_lib) |
124 |
|
|
env.Append(PYTHON_CPPPATH=[distutils.sysconfig.get_python_inc()]) |
125 |
|
|
print "PYTHON_LIBPATH =",env['PYTHON_LIBPATH'] |
126 |
|
|
print "PYTHON_CPPPATH =",env['PYTHON_CPPPATH'] |
127 |
johnpye |
387 |
|
128 |
johnpye |
385 |
# TODO: -D_HPUX_SOURCE is needed |
129 |
|
|
|
130 |
|
|
# TODO: check size of void* |
131 |
|
|
|
132 |
|
|
#------------------------------------------------------ |
133 |
|
|
# SUBDIRECTORIES.... |
134 |
|
|
|
135 |
|
|
env.Append(CPPPATH=['..']) |
136 |
|
|
|
137 |
|
|
env.SConscript(['base/generic/general/SConscript'],'env') |
138 |
|
|
|
139 |
|
|
env.SConscript(['base/generic/utilities/SConscript'],'env') |
140 |
|
|
|
141 |
|
|
env.SConscript(['base/generic/compiler/SConscript'],'env') |
142 |
|
|
|
143 |
|
|
env.SConscript(['base/generic/solver/SConscript'],'env') |
144 |
|
|
|
145 |
|
|
env.SConscript(['base/generic/packages/SConscript'],'env') |
146 |
johnpye |
386 |
|
147 |
|
|
if with_tcltk_gui: |
148 |
|
|
env.SConscript(['tcltk98/generic/interface/SConscript'],'env') |
149 |
johnpye |
391 |
else: |
150 |
|
|
print "Skipping... Tcl/Tk GUI isn't being built" |
151 |
johnpye |
386 |
|
152 |
johnpye |
387 |
if with_python: |
153 |
|
|
env.SConscript(['pygtk/interface/SConscript'],'env') |
154 |
johnpye |
391 |
else: |
155 |
|
|
print "Skipping... Python GUI isn't being built" |
156 |
|
|
|