/[ascend]/trunk/SConstruct
ViewVC logotype

Contents of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 392 - (show annotations) (download)
Thu Mar 30 12:36:15 2006 UTC (14 years, 2 months ago) by johnpye
File size: 3754 byte(s)
Some fixes to the SCons build:
- adding flags to enable QRSLV and CMSLV by default.
- adding commands to build SWIG library correctly for Python interface.
1 import os, commands, platform, distutils.sysconfig
2
3 #------------------------------------------------------
4 # OPTIONS
5 #
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
9 opts = Options(['options.cache', 'config.py'])
10 print "PLATFORM = ",platform.system()
11
12 # Import the outside environment
13 env = Environment(ENV=os.environ)
14
15 # Package linking option
16 opts.Add(EnumOption(
17 'PACKAGE_LINKING'
18 , 'Style of linking for external libraries'
19 , 'DYNAMIC_PACKAGES'
20 , ['DYNAMIC_PACKAGES', 'STATIC_PACKAGES', 'NO_PACKAGES']
21 ))
22
23 # You can turn off building of Tcl/Tk interface
24 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 # You can turn off the building of the Python interface
31 opts.Add(BoolOption(
32 'WITHOUT_PYTHON'
33 ,"Set to True if you don't want to build Python wrappers."
34 , False
35 ))
36
37 # 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 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 with_tcltk_gui = (env['WITHOUT_TCLTK_GUI']==False)
62
63 with_python = (env['WITHOUT_PYTHON']==False)
64
65 print "SOLVERS:",env['WITH_SOLVERS']
66
67 #------------------------------------------------------
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 # Tcl/Tk
90 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
103 if platform.system()=="Windows":
104 #conf.env.Append(LIBPATH='c:\Python24\libs')
105 #conf.env.Append(CPPPATH='c:\Python24\include')
106 python_header='Python.h'
107 python_lib=['python24']
108 #python_libpath=['c:\\Python24\\libs']
109 #python_cpppath=['c:\\Python24\\include']
110 else:
111 python_header='python2.4/Python.h'
112 python_lib=['python2.4']
113 #python_libpath=[]
114 #python_cpppath=['/usr/include/python2.4']
115
116
117 # Python
118 if not conf.CheckLibWithHeader(python_lib,python_header,'C'):
119 print "Didn't find Python 2.4 ("+python_lib+")"
120 with_python = False
121 else:
122 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
128 # 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
147 if with_tcltk_gui:
148 env.SConscript(['tcltk98/generic/interface/SConscript'],'env')
149 else:
150 print "Skipping... Tcl/Tk GUI isn't being built"
151
152 if with_python:
153 env.SConscript(['pygtk/interface/SConscript'],'env')
154 else:
155 print "Skipping... Python GUI isn't being built"
156

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