78 |
+" 'c:\msys\1.0\home\john\swigwin-1.3.29\swig.exe'." |
+" 'c:\msys\1.0\home\john\swigwin-1.3.29\swig.exe'." |
79 |
) |
) |
80 |
|
|
81 |
# Where will the 'Makefile.bt' file be installed |
# Build the test suite? |
82 |
|
opts.Add(BoolOption( |
83 |
# TODO: add install options |
'WITH_CUNIT_TESTS' |
84 |
|
,"Whether to build the CUnit tests. Default is off. If set to on," |
85 |
|
+" you must have CUnit installed somewhere that SCons can" |
86 |
|
+" find it." |
87 |
|
,False |
88 |
|
)) |
89 |
|
|
90 |
|
# Where are the CUnit includes? |
91 |
|
opts.Add(PackageOption( |
92 |
|
'CUNIT_CPPPATH' |
93 |
|
,"Where are your CUnit include files?" |
94 |
|
,"off" |
95 |
|
)) |
96 |
|
|
97 |
|
# Where are the CUnit includes? |
98 |
|
opts.Add(PackageOption( |
99 |
|
'CUNIT_LIBPATH' |
100 |
|
,"Where are your CUnit include files?" |
101 |
|
,"off" |
102 |
|
)) |
103 |
|
|
104 |
# TODO: OTHER OPTIONS? |
# TODO: OTHER OPTIONS? |
105 |
|
|
107 |
|
|
108 |
# TODO: turning on/off bintoken functionality |
# TODO: turning on/off bintoken functionality |
109 |
|
|
110 |
|
# TODO: Where will the 'Makefile.bt' file be installed |
111 |
|
# .... |
112 |
|
|
113 |
opts.Update(env) |
opts.Update(env) |
114 |
opts.Save('options.cache',env) |
opts.Save('options.cache',env) |
115 |
|
|
121 |
|
|
122 |
with_python = (env['WITHOUT_PYTHON']==False) |
with_python = (env['WITHOUT_PYTHON']==False) |
123 |
|
|
124 |
|
with_cunit_tests = env['WITH_CUNIT_TESTS'] |
125 |
|
|
126 |
print "SOLVERS:",env['WITH_SOLVERS'] |
print "SOLVERS:",env['WITH_SOLVERS'] |
127 |
|
|
128 |
print "WITH_LOCAL_HELP:",env['WITH_LOCAL_HELP'] |
print "WITH_LOCAL_HELP:",env['WITH_LOCAL_HELP'] |
145 |
#------------------------------------------------------ |
#------------------------------------------------------ |
146 |
# SPECIAL CONFIGURATION TESTS |
# SPECIAL CONFIGURATION TESTS |
147 |
|
|
148 |
|
#---------------- |
149 |
|
# SWIG |
150 |
|
|
151 |
import os,re |
import os,re |
152 |
|
|
153 |
def CheckSwigVersion(context): |
def CheckSwigVersion(context): |
169 |
pat = int(m.group('pat')) |
pat = int(m.group('pat')) |
170 |
|
|
171 |
if maj == 1 and ( |
if maj == 1 and ( |
172 |
min > 1 |
min > 3 |
173 |
or (min == 1 and pat >= 24) |
or (min == 3 and pat >= 24) |
174 |
): |
): |
175 |
context.Result("ok, %d.%d.%d" % (maj,min,pat)) |
context.Result("ok, %d.%d.%d" % (maj,min,pat)) |
176 |
return 1; |
return 1; |
177 |
context.Result("ok, %d.%d.%d" % (maj,min,pat)) |
context.Result("ok, %d.%d.%d" % (maj,min,pat)) |
178 |
return 0; |
return 0; |
179 |
|
|
180 |
|
#---------------- |
181 |
|
# General purpose library-and-header test |
182 |
|
|
183 |
|
|
184 |
|
def CheckExtLib(context,libname,text,ext='.c',varprefix=None): |
185 |
|
"""This method will check for variables LIBNAME_LIBPATH |
186 |
|
and LIBNAME_CPPPATH and try to compile and link the |
187 |
|
file with the provided text, linking with the |
188 |
|
library libname.""" |
189 |
|
|
190 |
|
context.Message( 'Checking for '+libname+'...' ) |
191 |
|
|
192 |
|
if varprefix==None: |
193 |
|
varprefix = libname.upper() |
194 |
|
|
195 |
|
keep = {} |
196 |
|
for k in ['LIBS','LIBPATH','CPPPATH']: |
197 |
|
if context.env.has_key(k): |
198 |
|
keep[k] = context.env[k] |
199 |
|
|
200 |
|
libpath_add = [] |
201 |
|
if context.env.has_key(varprefix+'_LIBPATH'): |
202 |
|
libpath_add = [env[varprefix+'_LIBPATH']] |
203 |
|
|
204 |
|
cpppath_add = [] |
205 |
|
if context.env.has_key(varprefix+'_CPPPATH'): |
206 |
|
cpppath_add = [env[varprefix+'_CPPPATH']] |
207 |
|
|
208 |
|
context.env.Append( |
209 |
|
LIBS = libname |
210 |
|
, LIBPATH = libpath_add |
211 |
|
, CPPPATH = cpppath_add |
212 |
|
) |
213 |
|
ret = context.TryLink(cunit_test_text,ext) |
214 |
|
|
215 |
|
for k in keep: |
216 |
|
context.env[k]=keep[k]; |
217 |
|
|
218 |
|
context.Result( ret ) |
219 |
|
return ret |
220 |
|
|
221 |
|
cunit_test_text = """ |
222 |
|
#include <CUnit/Cunit.h> |
223 |
|
int maxi(int i1, int i2){ |
224 |
|
return (i1 > i2) ? i1 : i2; |
225 |
|
} |
226 |
|
|
227 |
|
void test_maxi(void){ |
228 |
|
CU_ASSERT(maxi(0,2) == 2); |
229 |
|
CU_ASSERT(maxi(0,-2) == 0); |
230 |
|
CU_ASSERT(maxi(2,2) == 2); |
231 |
|
|
232 |
|
} |
233 |
|
int main(void){ |
234 |
|
/* CU_initialize_registry() */ |
235 |
|
} |
236 |
|
""" |
237 |
|
|
238 |
|
def CheckCUnit(context): |
239 |
|
return CheckExtLib(context |
240 |
|
,'cunit' |
241 |
|
,cunit_test_text |
242 |
|
) |
243 |
|
|
244 |
|
|
245 |
#------------------------------------------------------ |
#------------------------------------------------------ |
246 |
# CONFIGURATION |
# CONFIGURATION |
247 |
|
|
248 |
conf = Configure(env |
conf = Configure(env |
249 |
, custom_tests = { |
, custom_tests = { |
|
# 'CheckIsNan' : CheckIsNan |
|
|
# ,'CheckCppUnitConfig' : CheckCppUnitConfig |
|
250 |
'CheckSwigVersion' : CheckSwigVersion |
'CheckSwigVersion' : CheckSwigVersion |
251 |
|
, 'CheckCUnit' : CheckCUnit |
252 |
|
# , 'CheckIsNan' : CheckIsNan |
253 |
|
# , 'CheckCppUnitConfig' : CheckCppUnitConfig |
254 |
} |
} |
255 |
, config_h = "config.h" |
, config_h = "config.h" |
256 |
) |
) |
283 |
if not conf.CheckLib('tk'): |
if not conf.CheckLib('tk'): |
284 |
with_tcktk_gui = False |
with_tcktk_gui = False |
285 |
|
|
|
|
|
286 |
# Python... obviously we're already running python, so we just need to |
# Python... obviously we're already running python, so we just need to |
287 |
# check that we can link to the python library OK: |
# check that we can link to the python library OK: |
288 |
|
|
307 |
# with_python = False |
# with_python = False |
308 |
#else: |
#else: |
309 |
|
|
|
|
|
310 |
# SWIG version |
# SWIG version |
311 |
|
|
312 |
if platform.system()=="Windows": |
if platform.system()=="Windows": |
315 |
else: |
else: |
316 |
env['ENV']['SWIGFEATURES']='-O' |
env['ENV']['SWIGFEATURES']='-O' |
317 |
|
|
318 |
|
# CUnit |
319 |
|
|
320 |
|
if with_cunit_tests: |
321 |
|
conf.CheckCUnit() |
322 |
|
|
323 |
# TODO: -D_HPUX_SOURCE is needed |
# TODO: -D_HPUX_SOURCE is needed |
324 |
|
|
325 |
# TODO: check size of void* |
# TODO: check size of void* |
438 |
env.SConscript(['pygtk/interface/SConscript'],'env') |
env.SConscript(['pygtk/interface/SConscript'],'env') |
439 |
else: |
else: |
440 |
print "Skipping... Python GUI isn't being built" |
print "Skipping... Python GUI isn't being built" |
441 |
|
|
442 |
|
if with_cunit_tests: |
443 |
|
testdirs = ['general','solver','utilities'] |
444 |
|
for testdir in testdirs: |
445 |
|
path = 'base/generic/'+testdir+'/test/' |
446 |
|
env.SConscript([path+'SConscript'],'env') |
447 |
|
env.SConscript(['test/SConscript'],'env') |
448 |
|
env.SConscript(['base/generic/test/SConscript'],'env') |
449 |
|
|
450 |
|
|
451 |
|
else: |
452 |
|
print "Skipping... CUnit tests aren't being built" |
453 |
|
|
454 |
|
#------------------------------------------------------ |
455 |
|
# INSTALLATION |
456 |
|
|
457 |
|
# TODO: add install options |