1 |
import sys, os, commands, platform, distutils.sysconfig, os.path, re |
2 |
|
3 |
version = "0.9.5.112" |
4 |
|
5 |
pyversion = "%d.%d" % (sys.version_info[0],sys.version_info[1]) |
6 |
|
7 |
#------------------------------------------------------ |
8 |
# OPTIONS |
9 |
# |
10 |
# Note that if you set the options via the command line, they will be |
11 |
# remembered in the file 'options.cache'. It's a feature ;-) |
12 |
|
13 |
opts = Options(['options.cache', 'config.py']) |
14 |
#print "PLATFORM = ",platform.system() |
15 |
|
16 |
default_tcl_cpppath = "$TCL/include" |
17 |
default_tron_envvar="TRON_PATH" |
18 |
default_conopt_envvar="CONOPT_PATH" |
19 |
|
20 |
if platform.system()=="Windows": |
21 |
default_tcl_lib = "tcl84" |
22 |
default_tk_lib = "tk84" |
23 |
default_tktable_lib = "Tktable28" |
24 |
default_install_assets = "glade/" |
25 |
icon_extension = '.png' |
26 |
default_tcl = "c:\\Tcl" |
27 |
if os.environ.get('MSYSTEM')=="MINGW32": |
28 |
default_tcl_libpath="$TCL\\bin" |
29 |
else: |
30 |
default_tcl_libpath="$TCL\\lib" |
31 |
default_rel_distdir = '.' |
32 |
default_absolute_paths = False |
33 |
|
34 |
default_ida_prefix = "c:\\MinGW" |
35 |
if not os.path.exists(default_ida_prefix): |
36 |
default_ida_prefix = None |
37 |
|
38 |
default_conopt_prefix = "c:\\Program Files\\CONOPT" |
39 |
default_conopt_libpath="$CONOPT_PREFIX" |
40 |
default_conopt_cpppath="$CONOPT_PREFIX" |
41 |
default_conopt_dlpath="$CONOPT_PREFIX" |
42 |
default_conopt_lib="conopt3" |
43 |
|
44 |
default_tron_prefix="c:\\Program Files\\TRON" |
45 |
default_tron_dlpath="$TRON_PREFIX" |
46 |
default_tron_lib="tron1" |
47 |
|
48 |
default_prefix="c:\\MinGW" |
49 |
default_libpath="$DEFAULT_PREFIX\\lib" |
50 |
default_cpppath="$DEFAULT_PREFIX\\include" |
51 |
|
52 |
if not os.path.exists(default_conopt_prefix): |
53 |
default_conopt_prefix = None |
54 |
|
55 |
need_libm = False |
56 |
python_exe = "c:\\Python24\\python.exe" |
57 |
default_with_scrollkeeper=False |
58 |
pathsep = ";" |
59 |
else: |
60 |
default_tcl_lib = "tcl8.4" |
61 |
default_tk_lib = "tk8.4" |
62 |
default_tktable_lib = "Tktable2.8" |
63 |
default_install_assets = "$INSTALL_ASCDATA/glade/" |
64 |
icon_extension = '.svg' |
65 |
default_tcl = '/usr' |
66 |
default_tcl_libpath = "$TCL/lib" |
67 |
|
68 |
if os.path.exists("/etc/debian_version"): |
69 |
default_tcl_cpppath = "/usr/include/tcl8.4" |
70 |
|
71 |
default_rel_distdir = '../share/ascend' |
72 |
default_absolute_paths = True |
73 |
default_ida_prefix="/usr" |
74 |
default_conopt_prefix="/usr" |
75 |
default_conopt_libpath="$CONOPT_PREFIX/lib" |
76 |
default_conopt_cpppath="$CONOPT_PREFIX/include" |
77 |
default_conopt_dlpath= default_conopt_libpath + ":/usr/local/lib" |
78 |
default_conopt_lib="consub3" |
79 |
|
80 |
default_tron_prefix="/usr" |
81 |
default_tron_dlpath="$TRON_PREFIX/lib" |
82 |
default_tron_lib="tron1" |
83 |
|
84 |
default_prefix="/usr" |
85 |
default_libpath="$DEFAULT_PREFIX/lib" |
86 |
default_cpppath="$DEFAULT_PREFIX/include" |
87 |
|
88 |
need_libm = True |
89 |
if not os.path.isdir(default_tcl): |
90 |
default_tcl = '/usr' |
91 |
python_exe = distutils.sysconfig.EXEC_PREFIX+"/bin/python" |
92 |
default_with_scrollkeeper=False |
93 |
pathsep = ":" |
94 |
|
95 |
opts.Add( |
96 |
'CC' |
97 |
,'C Compiler command' |
98 |
,None |
99 |
) |
100 |
|
101 |
opts.Add( |
102 |
'CXX' |
103 |
,'C++ Compiler command' |
104 |
,None |
105 |
) |
106 |
|
107 |
opts.Add(BoolOption( |
108 |
'GCOV' |
109 |
, 'Whether to enable coverage testing in object code' |
110 |
, False |
111 |
)) |
112 |
|
113 |
opts.Add(BoolOption( |
114 |
'WITH_GCCVISIBILITY' |
115 |
,"Whether to use GCC Visibility features (only applicable if available)" |
116 |
,True |
117 |
)) |
118 |
|
119 |
opts.Add(BoolOption( |
120 |
'WITH_SIGNALS' |
121 |
,"Whether to permit use of signals for flow control in the C-level code" |
122 |
,True |
123 |
)) |
124 |
|
125 |
# You can turn off building of Tcl/Tk interface |
126 |
opts.Add(BoolOption( |
127 |
'WITH_TCLTK' |
128 |
,"Set to False if you don't want to build the original Tcl/Tk GUI." |
129 |
, True |
130 |
)) |
131 |
|
132 |
# You can turn off the building of the Python interface |
133 |
opts.Add(BoolOption( |
134 |
'WITH_PYTHON' |
135 |
,"Set to False if you don't want to build Python wrappers." |
136 |
, True |
137 |
)) |
138 |
|
139 |
# Which solvers will we allow? |
140 |
opts.Add(ListOption( |
141 |
'WITH_SOLVERS' |
142 |
,"List of the solvers you want to build. The default is the minimum that" |
143 |
+" works. The option 'LSOD' is provided for backwards compatibility" |
144 |
+"; the value 'LSODE' is preferred." |
145 |
,["QRSLV","CMSLV","LSODE","IDA","CONOPT","LRSLV","TRON","IPOPT"] |
146 |
,['QRSLV','MPS','SLV','OPTSQP' |
147 |
,'NGSLV','CMSLV','LRSLV','MINOS','CONOPT' |
148 |
,'LSODE','LSOD','OPTSQP',"IDA","TRON","IPOPT" |
149 |
] |
150 |
)) |
151 |
|
152 |
# Where will the local copy of the help files be kept? |
153 |
opts.Add(BoolOption( |
154 |
'WITH_DOC' |
155 |
, "Should we try to build and install help files? If not, ASCEND will access online help files" |
156 |
, True |
157 |
)) |
158 |
|
159 |
opts.Add(BoolOption( |
160 |
'WITH_DOC_BUILD' |
161 |
, "If true, we'll attempt to build docs. Set false, we'll assume we already have then (eg from the tarball)" |
162 |
, "$WITH_DOC" |
163 |
)) |
164 |
|
165 |
opts.Add(BoolOption( |
166 |
'WITH_DOC_INSTALL' |
167 |
, "If true, SCons will install the documentation file(s). If false, assume rpm or dpkg is going to do it." |
168 |
, "$WITH_DOC" |
169 |
)) |
170 |
|
171 |
opts.Add( |
172 |
'HELP_ROOT' |
173 |
, "Location of the main help file" |
174 |
, "$INSTALL_DOC/book.pdf" |
175 |
) |
176 |
|
177 |
# Will bintoken support be enabled? |
178 |
opts.Add(BoolOption( |
179 |
'WITH_BINTOKEN' |
180 |
,"Enable bintoken support? This means compiling models as C-code before" |
181 |
+" running them, to increase solving speed for large models." |
182 |
,False |
183 |
)) |
184 |
|
185 |
# What should the default ASCENDLIBRARY path be? |
186 |
# Note: users can change it by editing their ~/.ascend.ini |
187 |
opts.Add( |
188 |
'DEFAULT_ASCENDLIBRARY' |
189 |
,"Set the default value of the ASCENDLIBRARY -- the location where" |
190 |
+" ASCEND will look for models when running ASCEND" |
191 |
,"$INSTALL_MODELS" |
192 |
) |
193 |
|
194 |
# What should the default ASCENDLIBRARY path be? |
195 |
# Note: users can change it by editing their ~/.ascend.ini |
196 |
opts.Add( |
197 |
'DEFAULT_ASCENDSOLVERS' |
198 |
,"Set the default value of ASCENDSOLVERS -- the location where" |
199 |
+" ASCEND will look for solver shared-library files" |
200 |
,"$INSTALL_SOLVERS" |
201 |
) |
202 |
|
203 |
# Where is SWIG? |
204 |
opts.Add( |
205 |
'SWIG' |
206 |
,"SWIG location, probably only required for MinGW and MSVC users." |
207 |
+" Enter the location as a Windows-style path, for example" |
208 |
+" 'c:\\msys\\1.0\\home\\john\\swigwin-1.3.29\\swig.exe'." |
209 |
) |
210 |
|
211 |
# Build the test suite? |
212 |
opts.Add(BoolOption( |
213 |
'WITH_CUNIT' |
214 |
,"You can disable CUnit tests with this option. This will basically stop" |
215 |
+" SCons from parsing the SConscript files relating to the 'test'" |
216 |
+" target, which just might make things marginally faster. Probably" |
217 |
+" you can just ignore this option though. SCons will sniff for Cunit" |
218 |
+" but build the tests only if you specify the 'test' target." |
219 |
,True |
220 |
)) |
221 |
|
222 |
# Build with MMIO matrix export support? |
223 |
opts.Add(BoolOption( |
224 |
'WITH_MMIO' |
225 |
,"Include support for exporting matrices in Matrix Market format" |
226 |
,True |
227 |
)) |
228 |
|
229 |
#----- default paths ----- |
230 |
opts.Add(PackageOption( |
231 |
'DEFAULT_PREFIX' |
232 |
,"Where are most of the shared libraries located on your system?" |
233 |
,default_prefix |
234 |
)) |
235 |
|
236 |
#------ install location for python extensions ------ |
237 |
|
238 |
# (removed for the moment) |
239 |
|
240 |
#------ cunit -------- |
241 |
# Where was CUNIT installed? |
242 |
opts.Add(PackageOption( |
243 |
'CUNIT_PREFIX' |
244 |
,"Where are your CUnit files?" |
245 |
,"$DEFAULT_PREFIX" |
246 |
)) |
247 |
|
248 |
# Where are the CUnit includes? |
249 |
opts.Add(PackageOption( |
250 |
'CUNIT_CPPPATH' |
251 |
,"Where are your CUnit include files?" |
252 |
,"$CUNIT_PREFIX/include" |
253 |
)) |
254 |
|
255 |
# Where are the CUnit libraries? |
256 |
opts.Add(PackageOption( |
257 |
'CUNIT_LIBPATH' |
258 |
,"Where are your CUnit libraries?" |
259 |
,"$CUNIT_PREFIX/lib" |
260 |
)) |
261 |
|
262 |
#-------- ida ------- |
263 |
|
264 |
opts.Add(PackageOption( |
265 |
"SUNDIALS_PREFIX" |
266 |
,"Prefix for your IDA install (IDA ./configure --prefix)" |
267 |
,default_ida_prefix |
268 |
)) |
269 |
|
270 |
opts.Add( |
271 |
'SUNDIALS_CPPPATH' |
272 |
,"Where is your ida.h?" |
273 |
,"$SUNDIALS_PREFIX/include" |
274 |
) |
275 |
|
276 |
# |
277 |
opts.Add( |
278 |
'SUNDIALS_LIBPATH' |
279 |
,"Where are your SUNDIALS libraries installed?" |
280 |
,"$SUNDIALS_PREFIX/lib" |
281 |
) |
282 |
|
283 |
opts.Add( |
284 |
'SUNDIALS_LIBS' |
285 |
,"Where are your SUNDIALS libraries installed?" |
286 |
,['sundials_nvecserial','sundials_ida','m'] |
287 |
) |
288 |
|
289 |
# ----- conopt----- |
290 |
|
291 |
opts.Add(PackageOption( |
292 |
"CONOPT_PREFIX" |
293 |
,"Prefix for your CONOPT install (CONOPT ./configure --prefix)" |
294 |
,default_conopt_prefix |
295 |
)) |
296 |
|
297 |
opts.Add( |
298 |
"CONOPT_LIB" |
299 |
,"Library linked to for CONOPT" |
300 |
,default_conopt_lib |
301 |
) |
302 |
|
303 |
opts.Add(BoolOption( |
304 |
"CONOPT_LINKED" |
305 |
,"Do you want to dynamically link to CONOPT (only possible if CONOPT is available at buildtime)" |
306 |
,False |
307 |
)) |
308 |
|
309 |
opts.Add( |
310 |
'CONOPT_CPPPATH' |
311 |
,"Where is your conopt.h?" |
312 |
,default_conopt_cpppath |
313 |
) |
314 |
|
315 |
opts.Add( |
316 |
'CONOPT_LIBPATH' |
317 |
,"Where is your CONOPT library installed?" |
318 |
,default_conopt_libpath |
319 |
) |
320 |
|
321 |
opts.Add( |
322 |
'CONOPT_DLPATH' |
323 |
,"What is the default search path that ASCEND should use when dlopening the CONOPT library at runtime?" |
324 |
,default_conopt_dlpath |
325 |
) |
326 |
|
327 |
opts.Add( |
328 |
'CONOPT_ENVVAR' |
329 |
,"What environment variable should be used at runtime to override the default search location for CONOPT DLL/SO?" |
330 |
,default_conopt_envvar |
331 |
) |
332 |
|
333 |
#------- TRON ------- |
334 |
|
335 |
opts.Add( |
336 |
'TRON_ENVVAR' |
337 |
,"What environment variable should be used at runtime to override the default search location for TRON DLL/SO?" |
338 |
,default_tron_envvar |
339 |
) |
340 |
|
341 |
opts.Add( |
342 |
"TRON_LIB" |
343 |
,"Library linked to for TRON" |
344 |
,"tron" |
345 |
) |
346 |
|
347 |
opts.Add( |
348 |
"TRON_PREFIX" |
349 |
,"Prefix for your TRON install" |
350 |
,default_tron_prefix |
351 |
) |
352 |
|
353 |
opts.Add( |
354 |
'TRON_DLPATH' |
355 |
,"What is the default search path that ASCEND should use when dlopening the TRON library at runtime?" |
356 |
,default_tron_dlpath |
357 |
) |
358 |
|
359 |
#-------- f2c ------ |
360 |
|
361 |
opts.Add( |
362 |
"F2C_LIB" |
363 |
,"F2C library (eg. g2c, gfortran, f2c)" |
364 |
,"gfortran" # the default is gfortran now |
365 |
) |
366 |
|
367 |
opts.Add(PackageOption( |
368 |
"F2C_LIBPATH" |
369 |
,"Directory containing F2C library (i.e. g2c, gfortran, f2c, etc.), if not already accessible" |
370 |
,"off" |
371 |
)) |
372 |
|
373 |
opts.Add( |
374 |
"FORTRAN" |
375 |
,"Fortran compiler (eg g77, gfortran)" |
376 |
,"gfortran" |
377 |
) |
378 |
|
379 |
#------- tcl/tk -------- |
380 |
|
381 |
opts.Add( |
382 |
'TCL' |
383 |
,'Base of Tcl distribution' |
384 |
,default_tcl |
385 |
) |
386 |
|
387 |
# Where are the Tcl includes? |
388 |
opts.Add( |
389 |
'TCL_CPPPATH' |
390 |
,"Where are your Tcl include files?" |
391 |
,default_tcl_cpppath |
392 |
) |
393 |
|
394 |
# Where are the Tcl libs? |
395 |
opts.Add( |
396 |
'TCL_LIBPATH' |
397 |
,"Where are your Tcl libraries?" |
398 |
,default_tcl_libpath |
399 |
) |
400 |
|
401 |
# What is the name of the Tcl lib? |
402 |
opts.Add( |
403 |
'TCL_LIB' |
404 |
,"Name of Tcl lib (eg 'tcl' or 'tcl83'), for full path to static library (if STATIC_TCLTK is set)" |
405 |
,default_tcl_lib |
406 |
) |
407 |
|
408 |
# Where are the Tk includes? |
409 |
opts.Add( |
410 |
'TK_CPPPATH' |
411 |
,"Where are your Tk include files?" |
412 |
,'$TCL_CPPPATH' |
413 |
) |
414 |
|
415 |
# Where are the Tk libs? |
416 |
opts.Add( |
417 |
'TK_LIBPATH' |
418 |
,"Where are your Tk libraries?" |
419 |
,'$TCL_LIBPATH' |
420 |
) |
421 |
|
422 |
# What is the name of the Tk lib? |
423 |
opts.Add( |
424 |
'TK_LIB' |
425 |
,"Name of Tk lib (eg 'tk' or 'tk83'), or full path to static library" |
426 |
,default_tk_lib |
427 |
) |
428 |
|
429 |
# Static linking to TkTable |
430 |
|
431 |
opts.Add(BoolOption( |
432 |
'STATIC_TCLTK' |
433 |
,'Set true for static linking for Tcl/Tk and TkTable. EXPERIMENTAL' |
434 |
,False |
435 |
)) |
436 |
|
437 |
opts.Add( |
438 |
'TKTABLE_LIBPATH' |
439 |
,'Location of TkTable static library' |
440 |
,'$TCL_LIBPATH/Tktable2.8' |
441 |
) |
442 |
|
443 |
opts.Add( |
444 |
'TKTABLE_LIB' |
445 |
,'Stem name of TkTable (eg tktable2.8, no ".so" or "lib") shared library, or full path of static tktable (/usr/lib/...)' |
446 |
,default_tktable_lib |
447 |
) |
448 |
|
449 |
opts.Add( |
450 |
'TKTABLE_CPPPATH' |
451 |
,'Location of TkTable header file' |
452 |
,'$TCL_CPPPATH' |
453 |
) |
454 |
|
455 |
opts.Add( |
456 |
'X11' |
457 |
,'Base X11 directory. Only used when STATIC_TCLTK is turned on. EXPERIMENTAL' |
458 |
,'/usr/X11R6' |
459 |
) |
460 |
|
461 |
opts.Add( |
462 |
'X11_LIBPATH' |
463 |
,'Location of X11 lib. EXPERIMENTAL' |
464 |
,'$X11/lib' |
465 |
) |
466 |
|
467 |
opts.Add( |
468 |
'X11_CPPPATH' |
469 |
,'Location of X11 includes. EXPERIMENTAL' |
470 |
,'$X11/include' |
471 |
) |
472 |
|
473 |
opts.Add( |
474 |
'X11_LIB' |
475 |
,'Name of X11 lib. EXPERIMENTAL' |
476 |
,'X11' |
477 |
) |
478 |
|
479 |
#----- installed file locations (for 'scons install') ----- |
480 |
|
481 |
opts.Add( |
482 |
'INSTALL_PREFIX' |
483 |
,'Root location for installed files' |
484 |
,'/usr/local' |
485 |
) |
486 |
|
487 |
opts.Add( |
488 |
'INSTALL_BIN' |
489 |
,'Location to put binaries during installation' |
490 |
,"$INSTALL_PREFIX/bin" |
491 |
) |
492 |
|
493 |
opts.Add( |
494 |
'INSTALL_LIB' |
495 |
,'Location to put libraries during installation' |
496 |
,"$INSTALL_PREFIX/lib" |
497 |
) |
498 |
|
499 |
opts.Add( |
500 |
'INSTALL_SHARE' |
501 |
,'Common shared-file location on this system' |
502 |
,"$INSTALL_PREFIX/share" |
503 |
) |
504 |
|
505 |
opts.Add( |
506 |
'INSTALL_ASCDATA' |
507 |
,"Location of ASCEND shared data (TK, python, models etc)" |
508 |
,"$INSTALL_SHARE/ascend" |
509 |
) |
510 |
|
511 |
opts.Add( |
512 |
'INSTALL_MODELS' |
513 |
,"Location of ASCEND model files (.a4c,.a4l,.a4s)" |
514 |
,"$INSTALL_ASCDATA/models" |
515 |
) |
516 |
|
517 |
opts.Add( |
518 |
'INSTALL_SOLVERS' |
519 |
,"Location of ASCEND solvers" |
520 |
,"$INSTALL_ASCDATA/solvers" |
521 |
) |
522 |
|
523 |
opts.Add( |
524 |
'INSTALL_DOC' |
525 |
,"Location of ASCEND documentation files" |
526 |
,"$INSTALL_SHARE/doc/ascend-"+version |
527 |
) |
528 |
|
529 |
opts.Add( |
530 |
'INSTALL_INCLUDE' |
531 |
,'Location to put header files during installation' |
532 |
,"$INSTALL_PREFIX/include" |
533 |
) |
534 |
|
535 |
|
536 |
opts.Add( |
537 |
'INSTALL_ROOT' |
538 |
,'For use by RPM only: location of %{buildroot} during rpmbuild' |
539 |
,"" |
540 |
) |
541 |
|
542 |
#---------------------- |
543 |
|
544 |
opts.Add( |
545 |
'PYGTK_ASSETS' |
546 |
,'Default location for Glade assets (placed in pygtk/config.py)' |
547 |
,default_install_assets |
548 |
) |
549 |
|
550 |
opts.Add(BoolOption( |
551 |
'DEBUG' |
552 |
,"Compile source with debugger symbols, eg for use with 'gdb'" |
553 |
,False |
554 |
)) |
555 |
|
556 |
opts.Add(BoolOption( |
557 |
'MALLOC_DEBUG' |
558 |
,"Compile with debugging version of MALLOC. Required for full CUnit testing" |
559 |
,False |
560 |
)) |
561 |
|
562 |
#------ dmalloc -------- |
563 |
opts.Add(PackageOption( |
564 |
'DMALLOC_PREFIX' |
565 |
,"Where are your dmalloc files?" |
566 |
,default_prefix |
567 |
)) |
568 |
|
569 |
opts.Add(PackageOption( |
570 |
'DMALLOC_CPPPATH' |
571 |
,"Where are your dmalloc include files?" |
572 |
,default_cpppath |
573 |
)) |
574 |
|
575 |
opts.Add(PackageOption( |
576 |
'DMALLOC_LIBPATH' |
577 |
,"Where are your dmalloc libraries?" |
578 |
,default_libpath |
579 |
)) |
580 |
|
581 |
opts.Add(BoolOption( |
582 |
'WITH_DMALLOC' |
583 |
,"Link to the DMALLOC library (if available) for debugging of memory usage." |
584 |
,False |
585 |
)) |
586 |
|
587 |
#------ f -------- |
588 |
opts.Add(PackageOption( |
589 |
'MFGRAPH_PREFIX' |
590 |
,"Where are your MFGRAPH files?" |
591 |
,default_prefix |
592 |
)) |
593 |
|
594 |
opts.Add(PackageOption( |
595 |
'MFGRAPH_CPPPATH' |
596 |
,"Where are your MFGRAPH include files?" |
597 |
,default_cpppath |
598 |
)) |
599 |
|
600 |
opts.Add(PackageOption( |
601 |
'MFGRAPH_LIBPATH' |
602 |
,"Where are your MFGRAPH libraries?" |
603 |
,default_libpath |
604 |
)) |
605 |
|
606 |
opts.Add(BoolOption( |
607 |
'WITH_MFGRAPH' |
608 |
,"Link to the MFGRAPH library (if available, for generating incidence graphs)" |
609 |
,True |
610 |
)) |
611 |
|
612 |
|
613 |
#------ ufsparse -------- |
614 |
opts.Add(PackageOption( |
615 |
'UFSPARSE_PREFIX' |
616 |
,"Where are your UFSPARSE files?" |
617 |
,default_prefix |
618 |
)) |
619 |
|
620 |
opts.Add(PackageOption( |
621 |
'UFSPARSE_CPPPATH' |
622 |
,"Where are your UFSPARSE include files?" |
623 |
,default_cpppath |
624 |
)) |
625 |
|
626 |
opts.Add(PackageOption( |
627 |
'UFSPARSE_LIBPATH' |
628 |
,"Where are your UFSPARSE libraries?" |
629 |
,default_libpath |
630 |
)) |
631 |
|
632 |
opts.Add(BoolOption( |
633 |
'WITH_UFSPARSE' |
634 |
,"Link to the UFSPARSE library (if available, for additional sparse matrix routines)" |
635 |
,True |
636 |
)) |
637 |
|
638 |
#----------------------- |
639 |
|
640 |
opts.Add( |
641 |
'DISTTAR_NAME' |
642 |
,"Stem name of the tarball created by 'scons dist'. So for 'ascend-aaa.tar.bz2', set this to 'ascend-aaa'." |
643 |
,"ascend-"+version |
644 |
) |
645 |
|
646 |
opts.Add( |
647 |
'RELEASE' |
648 |
,"Release number for use in RPM spec file. This should always start with a zero for releases made by the ASCEND group, in order that third parties can make 'patch' releases of higher version numbers." |
649 |
,"0" |
650 |
) |
651 |
|
652 |
opts.Add(BoolOption( |
653 |
'ABSOLUTE_PATHS' |
654 |
,"Whether to use absolute or relative paths in the installed Tcl/Tk interface. If you want to build an RPM, set this to false." |
655 |
,default_absolute_paths |
656 |
)) |
657 |
|
658 |
opts.Add( |
659 |
'WIN_INSTALLER_NAME' |
660 |
,"Name of the installer .exe to create under Windows (minus the '.exe')" |
661 |
,"ascend-"+version+"-py"+pyversion+".exe" |
662 |
) |
663 |
|
664 |
opts.Add(BoolOption( |
665 |
'WITH_XTERM_COLORS' |
666 |
,"Set to 0 if you don't want xterm colour codes in the console output" |
667 |
,True |
668 |
)) |
669 |
|
670 |
opts.Add(BoolOption( |
671 |
'WITH_EXTFNS' |
672 |
,"Set to 0 if you don't want to attempt to build the external modules bundled with ASCEND" |
673 |
,True |
674 |
)) |
675 |
|
676 |
opts.Add(BoolOption( |
677 |
'WITH_SCROLLKEEPER' |
678 |
,"Set to to 1 if you want to install an OMF file that can be read by scrollkeeper (eg Yelp on GNOME)" |
679 |
,default_with_scrollkeeper |
680 |
)) |
681 |
|
682 |
if platform.system()!="Windows": |
683 |
opts.Add(BoolOption( |
684 |
'WITH_GCCVISIBILITY' |
685 |
, 'Whether to use GCC Visibility extensions when building with GCC 4.0' |
686 |
, True |
687 |
)) |
688 |
|
689 |
|
690 |
|
691 |
# TODO: OTHER OPTIONS? |
692 |
# TODO: flags for optimisation |
693 |
# TODO: turning on/off bintoken functionality |
694 |
# TODO: Where will the 'Makefile.bt' file be installed? |
695 |
|
696 |
# Import the outside environment |
697 |
|
698 |
def c_escape(str): |
699 |
return re.sub("\\\\","/",str) |
700 |
|
701 |
envadditional={} |
702 |
|
703 |
tools = ['lex','yacc','fortran','swig','nsis','substinfile','disttar'] |
704 |
if platform.system()=="Windows": |
705 |
if os.environ.get('OSTYPE')=='msys' or os.environ.get('MSYSTEM'): |
706 |
envenv = os.environ; |
707 |
tools += ['mingw'] |
708 |
#TODO removed 'doxygen' for SCons 0.96.93 |
709 |
envadditional['IS_MINGW']=True |
710 |
else: |
711 |
print "Assuming VC++ build environment (Note: MinGW is preferred)" |
712 |
envenv = { |
713 |
'PATH':os.environ['PATH'] |
714 |
,'INCLUDE':os.environ['INCLUDE'] |
715 |
,'LIB':os.environ['LIB'] |
716 |
,'MSVS_IGNORE_IDE_PATHS':1 |
717 |
} |
718 |
tools += ['default'] |
719 |
#TODO removed 'doxygen' for SCons 0.96.93 |
720 |
envadditional['CPPDEFINES']=['_CRT_SECURE_NO_DEPRECATE'] |
721 |
else: |
722 |
if os.environ.get('TARGET')=='mingw': |
723 |
envenv = os.environ |
724 |
tools += ['crossmingw'] |
725 |
envadditional['CPPPATH']=['/usr/lib/gcc/i586-mingw32msvc/3.4.5/include','/usr/include'] |
726 |
envadditional['LIBS']=['gcc'] |
727 |
else: |
728 |
envenv = os.environ |
729 |
tools += ['default'] |
730 |
#TODO removed 'doxygen' for SCons 0.96.93 |
731 |
|
732 |
|
733 |
env = Environment( |
734 |
ENV=envenv |
735 |
, toolpath=['scons'] |
736 |
, tools=tools |
737 |
, **envadditional |
738 |
) |
739 |
|
740 |
#print "PATH =",os.environ['PATH'] |
741 |
#print "PROGSUFFIX =",env['PROGSUFFIX'] |
742 |
#print "CPPPATH =",env['CPPPATH'] |
743 |
|
744 |
opts.Update(env) |
745 |
|
746 |
if 'LSOD' in env['WITH_SOLVERS']: |
747 |
if 'LSODE' not in env['WITH_SOLVERS']: |
748 |
env['WITH_SOLVERS'].append('LSODE') |
749 |
env['WITH_SOLVERS'].remove('LSOD') |
750 |
|
751 |
opts.Save('options.cache',env) |
752 |
|
753 |
Help(opts.GenerateHelpText(env)) |
754 |
|
755 |
with_tcltk = env.get('WITH_TCLTK') |
756 |
without_tcltk_reason = "disabled by options/config.py" |
757 |
|
758 |
with_python = env.get('WITH_PYTHON') |
759 |
without_python_reason = "disabled by options/config.py" |
760 |
|
761 |
with_cunit = env.get('WITH_CUNIT') |
762 |
without_cunit_reason = "not requested" |
763 |
|
764 |
with_extfns = env.get('WITH_EXTFNS') |
765 |
without_extfn_reason = "disabled by options/config.py" |
766 |
|
767 |
with_scrollkeeper = env.get('WITH_SCROLLKEEPER') |
768 |
without_scrollkeeper_reason = "disabled by options/config.py" |
769 |
|
770 |
with_dmalloc = env.get('WITH_DMALLOC') |
771 |
without_dmalloc_reason = "disabled by options/config.py" |
772 |
|
773 |
with_mfgraph = env.get('WITH_MFGRAPH') |
774 |
without_mfgraph_reason = "disabled by options/config.py" |
775 |
|
776 |
with_ufsparse = env.get('WITH_UFSPARSE') |
777 |
without_ufsparse_reason = "disabled by options/config.py" |
778 |
|
779 |
with_mmio = env.get('WITH_MMIO') |
780 |
without_mmio_reason = "disabled by options/config.py" |
781 |
|
782 |
with_signals = env.get('WITH_SIGNALS') |
783 |
without_signals_reason = "disabled by options/config.py" |
784 |
|
785 |
with_doc = env.get('WITH_DOC') |
786 |
|
787 |
with_doc_build = env.get('WITH_DOC_BUILD'); |
788 |
without_doc_build_reason = "disabled by options/config.py" |
789 |
if not with_doc: |
790 |
with_doc_build = False |
791 |
without_doc_build_reason = "disabled by with_doc" |
792 |
|
793 |
with_latex2html = False |
794 |
|
795 |
if platform.system()=="Windows": |
796 |
with_installer=1 |
797 |
else: |
798 |
with_installer=0 |
799 |
without_installer_reason = "only possible under Windows" |
800 |
|
801 |
if 'LSODE' in env['WITH_SOLVERS']: |
802 |
with_lsode=True |
803 |
else: |
804 |
with_lsode=False |
805 |
without_lsode_reason = "not requested (WITH_SOLVERS)" |
806 |
|
807 |
if 'IDA' in env['WITH_SOLVERS']: |
808 |
with_ida=True |
809 |
else: |
810 |
with_ida=False |
811 |
without_ida_reason = "not requested (WITH_SOLVERS)" |
812 |
|
813 |
|
814 |
if 'CONOPT' in env['WITH_SOLVERS']: |
815 |
with_conopt=True |
816 |
else: |
817 |
with_conopt=False |
818 |
without_conopt_reason = "not requested (WITH_SOLVERS)" |
819 |
|
820 |
if 'IPOPT' in env['WITH_SOLVERS']: |
821 |
with_ipopt=True |
822 |
else: |
823 |
with_ipopt=False |
824 |
without_ipopt_reason = "not requested (WITH_SOLVERS)" |
825 |
|
826 |
|
827 |
#print "SOLVERS:",env['WITH_SOLVERS'] |
828 |
#print "WITH_BINTOKEN:",env['WITH_BINTOKEN'] |
829 |
#print "DEFAULT_ASCENDLIBRARY:",env['DEFAULT_ASCENDLIBRARY'] |
830 |
|
831 |
can_install = True |
832 |
if platform.system()=='Windows': |
833 |
can_install = False |
834 |
|
835 |
env['CAN_INSTALL']=can_install |
836 |
|
837 |
print "TCL=",env['TCL'] |
838 |
print "TCL_CPPPATH =",env['TCL_CPPPATH'] |
839 |
print "TCL_LIBPATH =",env['TCL_LIBPATH'] |
840 |
print "TCL_LIB =",env['TCL_LIB'] |
841 |
print "CC =",env['CC'] |
842 |
print "CXX =",env['CXX'] |
843 |
print "FORTRAN=",env.get('FORTRAN') |
844 |
|
845 |
print "ABSOLUTE PATHS =",env['ABSOLUTE_PATHS'] |
846 |
print "INSTALL_ASCDATA =",env['INSTALL_ASCDATA'] |
847 |
print "INSTALL_PREFIX =",env['INSTALL_PREFIX'] |
848 |
print "INSTALL_MODELS =",env['INSTALL_MODELS'] |
849 |
print "INSTALL_SOLVERS =",env['INSTALL_SOLVERS'] |
850 |
print "DEFAULT_ASCENDLIBRARY =",env['DEFAULT_ASCENDLIBRARY'] |
851 |
print "DEFAULT_ASCENDSOLVERS =",env['DEFAULT_ASCENDSOLVERS'] |
852 |
|
853 |
|
854 |
#------------------------------------------------------ |
855 |
# SPECIAL CONFIGURATION TESTS |
856 |
|
857 |
need_fortran = False |
858 |
|
859 |
#---------------- |
860 |
# CC |
861 |
|
862 |
cc_test_text = """ |
863 |
int main(void){ |
864 |
return 0; |
865 |
} |
866 |
"""; |
867 |
|
868 |
def CheckCC(context): |
869 |
context.Message("Checking C compiler ('%s')... " % context.env.get('CC')) |
870 |
is_ok = context.TryCompile(cc_test_text,".c") |
871 |
context.Result(is_ok) |
872 |
return is_ok |
873 |
|
874 |
#---------------- |
875 |
# CXX |
876 |
|
877 |
cxx_test_text = """ |
878 |
template<class X> |
879 |
class pair{ |
880 |
public: |
881 |
X a; |
882 |
X b; |
883 |
}; |
884 |
|
885 |
int main(void){ |
886 |
pair<double> P; |
887 |
P.a = 0; |
888 |
return 0; |
889 |
} |
890 |
"""; |
891 |
|
892 |
def CheckCXX(context): |
893 |
context.Message("Checking C++ compiler ('%s')... " % context.env.get('CXX')) |
894 |
is_ok = context.TryCompile(cc_test_text,".cpp") |
895 |
context.Result(is_ok) |
896 |
return is_ok |
897 |
|
898 |
|
899 |
|
900 |
#---------------- |
901 |
# SWIG |
902 |
|
903 |
import os,re |
904 |
|
905 |
def get_swig_version(env): |
906 |
cmd = env['SWIG']+' -version' |
907 |
(cin,coutcerr) = os.popen4(cmd) |
908 |
output = coutcerr.read() |
909 |
|
910 |
restr = "SWIG\\s+Version\\s+(?P<maj>[0-9]+)\\.(?P<min>[0-9]+)\\.(?P<pat>[0-9]+)\\s*$" |
911 |
expr = re.compile(restr,re.M); |
912 |
m = expr.search(output); |
913 |
if not m: |
914 |
return None |
915 |
maj = int(m.group('maj')) |
916 |
min = int(m.group('min')) |
917 |
pat = int(m.group('pat')) |
918 |
|
919 |
return (maj,min,pat) |
920 |
|
921 |
|
922 |
def CheckSwigVersion(context): |
923 |
|
924 |
try: |
925 |
context.Message("Checking version of SWIG... ") |
926 |
maj,min,pat = get_swig_version(context.env) |
927 |
except: |
928 |
context.Result("Failed to detect version, or failed to run SWIG") |
929 |
return 0; |
930 |
|
931 |
context.env['SWIGVERSION']=tuple([maj,min,pat]) |
932 |
|
933 |
if maj == 1 and ( |
934 |
min > 3 |
935 |
or (min == 3 and pat >= 24) |
936 |
): |
937 |
context.Result("ok, %d.%d.%d" % (maj,min,pat)) |
938 |
return 1; |
939 |
else: |
940 |
context.Result("too old, %d.%d.%d" % (maj,min,pat)) |
941 |
return 0; |
942 |
|
943 |
#---------------- |
944 |
# Scrollkeeper (Linux documentation system) |
945 |
|
946 |
def get_scrollkeeper_omfdir(env): |
947 |
cmd = 'scrollkeeper-config --omfdir' |
948 |
(cin,coutcerr) = os.popen4(cmd) |
949 |
output = coutcerr.read() |
950 |
return output.strip() |
951 |
|
952 |
def CheckScrollkeeperConfig(context): |
953 |
try: |
954 |
context.Message("Checking for scrollkeeper...") |
955 |
dir=get_scrollkeeper_omfdir(context.env) |
956 |
except: |
957 |
context.Result("Failed to run 'scrollkeeper-config'") |
958 |
return 0 |
959 |
context.env['OMFDIR']=dir |
960 |
context.Result("OK, %s" % dir) |
961 |
return 1 |
962 |
|
963 |
#---------------- |
964 |
# General purpose library-and-header test |
965 |
|
966 |
class KeepContext: |
967 |
def __init__(self,context,varprefix,static=False): |
968 |
self.keep = {} |
969 |
for k in ['LIBS','LIBPATH','CPPPATH','LINKFLAGS']: |
970 |
#print "Keeping env %s = %s" % (k,context.env.get(k)) |
971 |
self.keep[k]=context.env.get(k) |
972 |
|
973 |
if context.env.has_key(varprefix+'_CPPPATH'): |
974 |
context.env.AppendUnique(CPPPATH=[env[varprefix+'_CPPPATH']]) |
975 |
#print "Adding '"+str(env[varprefix+'_CPPPATH'])+"' to cpp path" |
976 |
|
977 |
if static: |
978 |
staticlib=env[varprefix+'_LIB'] |
979 |
#print "STATIC LIB = ",staticlib |
980 |
context.env.Append( |
981 |
LINKFLAGS=[staticlib] |
982 |
) |
983 |
else: |
984 |
if context.env.has_key(varprefix+'_LIBPATH'): |
985 |
context.env.Append(LIBPATH=[env[varprefix+'_LIBPATH']]) |
986 |
#print "Adding '"+str(env[varprefix+'_LIBPATH'])+"' to lib path" |
987 |
|
988 |
if context.env.has_key(varprefix+'_LIB'): |
989 |
context.env.Append(LIBS=[env[varprefix+'_LIB']]) |
990 |
#print "Adding '"+str(env[varprefix+'_LIB'])+"' to libs" |
991 |
|
992 |
def restore(self,context): |
993 |
#print "RESTORING CONTEXT" |
994 |
#print self.keep |
995 |
#print "..." |
996 |
for k in self.keep: |
997 |
if self.keep[k]==None: |
998 |
if context.env.has_key(k): |
999 |
#print "Clearing "+str(k) |
1000 |
del context.env[k]; |
1001 |
else: |
1002 |
#print "Restoring %s to '%s'" %(k,self.keep.get(k)) |
1003 |
context.env[k]=self.keep[k]; |
1004 |
|
1005 |
def CheckExtLib(context,libname,text,ext='.c',varprefix=None,static=False): |
1006 |
"""This method will check for variables LIBNAME_LIBPATH |
1007 |
and LIBNAME_CPPPATH and try to compile and link the |
1008 |
file with the provided text, linking with the |
1009 |
library libname.""" |
1010 |
|
1011 |
if static: |
1012 |
context.Message( 'Checking for static '+libname+'... ' ) |
1013 |
else: |
1014 |
context.Message( 'Checking for '+libname+'... ' ) |
1015 |
|
1016 |
if varprefix==None: |
1017 |
varprefix = libname.upper() |
1018 |
|
1019 |
#print "LIBS is currently:",context.env.get('LIBS') |
1020 |
keep = KeepContext(context,varprefix,static) |
1021 |
|
1022 |
if not context.env.has_key(varprefix+'_LIB'): |
1023 |
# if varprefix_LIB were in env, KeepContext would |
1024 |
# have appended it already |
1025 |
context.env.Append(LIBS=[libname]) |
1026 |
|
1027 |
is_ok = context.TryLink(text,ext) |
1028 |
|
1029 |
#print "Link success? ",(is_ok != 0) |
1030 |
|
1031 |
keep.restore(context) |
1032 |
|
1033 |
# print "Restored CPPPATH="+str(context.env['CPPPATH']) |
1034 |
# print "Restored LIBS="+str(context.env['LIBS']) |
1035 |
# print "Restored LIBPATH="+str(context.env['LIBPATH']) |
1036 |
|
1037 |
context.Result(is_ok) |
1038 |
return is_ok |
1039 |
|
1040 |
#---------------- |
1041 |
# GCC |
1042 |
|
1043 |
gcc_test_text = """ |
1044 |
#ifndef __GNUC__ |
1045 |
# error "Not using GCC" |
1046 |
#endif |
1047 |
|
1048 |
int main(void){ |
1049 |
return __GNUC__; |
1050 |
} |
1051 |
""" |
1052 |
|
1053 |
def CheckGcc(context): |
1054 |
context.Message("Checking for GCC... ") |
1055 |
is_ok = context.TryCompile(gcc_test_text,".c") |
1056 |
context.Result(is_ok) |
1057 |
return is_ok |
1058 |
|
1059 |
#---------------- |
1060 |
# GCC VISIBILITY feature |
1061 |
|
1062 |
gccvisibility_test_text = """ |
1063 |
#if __GNUC__ < 4 |
1064 |
# error "Require GCC version 4 or newer" |
1065 |
#endif |
1066 |
|
1067 |
__attribute__ ((visibility("default"))) int x; |
1068 |
|
1069 |
int main(void){ |
1070 |
extern int x; |
1071 |
x = 4; |
1072 |
} |
1073 |
""" |
1074 |
|
1075 |
def CheckGccVisibility(context): |
1076 |
context.Message("Checking for GCC 'visibility' capability... ") |
1077 |
if not context.env.has_key('WITH_GCCVISIBILITY') or not env['WITH_GCCVISIBILITY']: |
1078 |
context.Result("disabled") |
1079 |
return 0 |
1080 |
is_ok = context.TryCompile(gccvisibility_test_text,".c") |
1081 |
context.Result(is_ok) |
1082 |
return is_ok |
1083 |
|
1084 |
#---------------- |
1085 |
# YACC |
1086 |
|
1087 |
yacc_test_text = """ |
1088 |
%{ |
1089 |
#include <stdio.h> |
1090 |
|
1091 |
/* MSVC++ needs this before it can swallow Bison output */ |
1092 |
#ifdef _MSC_VER |
1093 |
# define __STDC__ |
1094 |
#endif |
1095 |
%} |
1096 |
%token MSG |
1097 |
%start ROOT |
1098 |
%% |
1099 |
ROOT: |
1100 |
MSG { printf("HELLO"); } |
1101 |
; |
1102 |
%% |
1103 |
""" |
1104 |
|
1105 |
def CheckYacc(context): |
1106 |
context.Message("Checking for Yacc ('%s')... " % context.env.get('YACC')) |
1107 |
is_ok = context.TryCompile(yacc_test_text,".y") |
1108 |
context.Result(is_ok) |
1109 |
return is_ok |
1110 |
|
1111 |
#---------------- |
1112 |
# LEX |
1113 |
|
1114 |
lex_test_text = """ |
1115 |
%{ |
1116 |
#include <stdio.h> |
1117 |
%} |
1118 |
DIGIT [0-9] |
1119 |
ID [a-z][a-z0-9]* |
1120 |
%% |
1121 |
{DIGIT}+ { |
1122 |
printf("A digit: %s\\n",yytext); |
1123 |
} |
1124 |
|
1125 |
[ \\t\\n]+ /* ignore */ |
1126 |
|
1127 |
. { |
1128 |
printf("Unrecognized guff"); |
1129 |
} |
1130 |
%% |
1131 |
main(){ |
1132 |
yylex(); |
1133 |
} |
1134 |
""" |
1135 |
|
1136 |
def CheckLex(context): |
1137 |
context.Message("Checking for Lex ('%s')... " % context.env.get('LEX')) |
1138 |
is_ok = context.TryCompile(lex_test_text,".l") |
1139 |
context.Result(is_ok) |
1140 |
return is_ok |
1141 |
|
1142 |
#---------------- |
1143 |
# CUnit test |
1144 |
|
1145 |
cunit_test_text = """ |
1146 |
#include <CUnit/CUnit.h> |
1147 |
int maxi(int i1, int i2){ |
1148 |
return (i1 > i2) ? i1 : i2; |
1149 |
} |
1150 |
|
1151 |
void test_maxi(void){ |
1152 |
CU_ASSERT(maxi(0,2) == 2); |
1153 |
CU_ASSERT(maxi(0,-2) == 0); |
1154 |
CU_ASSERT(maxi(2,2) == 2); |
1155 |
|
1156 |
} |
1157 |
int main(void){ |
1158 |
/* CU_initialize_registry() */ |
1159 |
return 0; |
1160 |
} |
1161 |
""" |
1162 |
|
1163 |
def CheckCUnit(context): |
1164 |
return CheckExtLib(context,'cunit',cunit_test_text) |
1165 |
|
1166 |
#---------------- |
1167 |
# dmalloc test |
1168 |
|
1169 |
dmalloc_test_text = """ |
1170 |
#include <stdlib.h> |
1171 |
#include <dmalloc.h> |
1172 |
|
1173 |
int main(void){ |
1174 |
char *c; |
1175 |
c = malloc(100*sizeof(char)); |
1176 |
free(c); |
1177 |
return 0; |
1178 |
} |
1179 |
""" |
1180 |
|
1181 |
def CheckDMalloc(context): |
1182 |
return CheckExtLib(context,'dmalloc',dmalloc_test_text) |
1183 |
|
1184 |
#---------------- |
1185 |
# mfgraph test |
1186 |
|
1187 |
mfgraph_test_text = """ |
1188 |
#include <mfgraph/mfg_draw_graph.h> |
1189 |
int main(void){ |
1190 |
using namespace mfg; |
1191 |
DrawGraph g; |
1192 |
return 0; |
1193 |
} |
1194 |
""" |
1195 |
|
1196 |
def CheckMFGraph(context): |
1197 |
return CheckExtLib(context,'mfgraph',mfgraph_test_text,ext=".cpp") |
1198 |
|
1199 |
#---------------- |
1200 |
# ufsparse test |
1201 |
|
1202 |
ufsparse_test_text = """ |
1203 |
#include <ufsparse/cs.h> |
1204 |
int main(void){ |
1205 |
cs *A,*B,*C; |
1206 |
C = cs_multiply(A,B); |
1207 |
return 0; |
1208 |
} |
1209 |
""" |
1210 |
|
1211 |
def CheckUFSparse(context): |
1212 |
return CheckExtLib(context |
1213 |
,libname='cxsparse' |
1214 |
,varprefix='ufsparse' |
1215 |
,text=ufsparse_test_text |
1216 |
,ext=".c" |
1217 |
) |
1218 |
|
1219 |
#---------------- |
1220 |
# MATH test |
1221 |
|
1222 |
math_test_text = """ |
1223 |
#ifndef _ALL_SOURCE |
1224 |
# define _ALL_SOURCE |
1225 |
#endif |
1226 |
#ifndef _XOPEN_SOURCE |
1227 |
# define _XOPEN_SOURCE |
1228 |
#endif |
1229 |
#ifndef _XOPEN_SOURCE_EXTENDED |
1230 |
# define _XOPEN_SOURCE_EXTENDED 1 |
1231 |
#endif |
1232 |
#include <math.h> |
1233 |
int main(void){ |
1234 |
double x = 1.0; double y = 1.0; int i = 1; |
1235 |
acosh(x); asinh(x); atanh(x); cbrt(x); expm1(x); erf(x); erfc(x); isnan(x); |
1236 |
j0(x); j1(x); jn(i,x); ilogb(x); logb(x); log1p(x); rint(x); |
1237 |
y0(x); y1(x); yn(i,x); |
1238 |
/* this part causes problems with crossmingw... */ |
1239 |
#ifdef _THREAD_SAFE |
1240 |
gamma_r(x,&i); |
1241 |
lgamma_r(x,&i); |
1242 |
#else |
1243 |
gamma(x); |
1244 |
lgamma(x); |
1245 |
#endif |
1246 |
hypot(x,y); nextafter(x,y); remainder(x,y); scalb(x,y); |
1247 |
return 0; |
1248 |
} |
1249 |
""" |
1250 |
|
1251 |
def CheckMath(context): |
1252 |
context.Message('Checking for IEEE math library... ') |
1253 |
libsave=context.env.get('LIBS'); |
1254 |
context.env.AppendUnique(LIBS=['m']) |
1255 |
is_ok=context.TryLink(math_test_text,".c") |
1256 |
context.Result(is_ok) |
1257 |
if not is_ok: |
1258 |
context.env['LIBS']=libsave |
1259 |
return is_ok |
1260 |
|
1261 |
#---------------- |
1262 |
# libpython test |
1263 |
|
1264 |
libpython_test_text = """ |
1265 |
#include <Python.h> |
1266 |
int main(void){ |
1267 |
PyObject *p; |
1268 |
p = Py_None; |
1269 |
return 0; |
1270 |
} |
1271 |
""" |
1272 |
|
1273 |
def CheckPythonLib(context): |
1274 |
context.Message('Checking for libpython... ') |
1275 |
|
1276 |
if platform.system()=="Windows": |
1277 |
python_lib='python%d%d' |
1278 |
else: |
1279 |
python_lib='python%d.%d' |
1280 |
python_libs = [python_lib % (sys.version_info[0],sys.version_info[1])] |
1281 |
|
1282 |
python_cpppath = [distutils.sysconfig.get_python_inc()] |
1283 |
cfig = distutils.sysconfig.get_config_vars() |
1284 |
|
1285 |
lastLIBS = context.env.get('LIBS') |
1286 |
lastLIBPATH = context.env.get('LIBPATH') |
1287 |
lastCPPPATH = context.env.get('CPPPATH') |
1288 |
lastLINKFLAGS = context.env.get('LINKFLAGS') |
1289 |
|
1290 |
python_libpath = [] |
1291 |
python_linkflags = [] |
1292 |
if platform.system()=="Windows": |
1293 |
python_libpath+=[cfig['prefix']] |
1294 |
else: |
1295 |
# checked on Linux and SunOS |
1296 |
if cfig['LDLIBRARY']==cfig['LIBRARY']: |
1297 |
sys.stdout.write("(static)") |
1298 |
python_libpath += [cfig['LIBPL']] |
1299 |
python_linkflags += cfig['LIBS'].split(' ') |
1300 |
|
1301 |
context.env.AppendUnique(LIBS=python_libs) |
1302 |
context.env.AppendUnique(LIBPATH=python_libpath) |
1303 |
context.env.AppendUnique(CPPPATH=python_cpppath) |
1304 |
context.env.AppendUnique(LINKFLAGS=python_linkflags) |
1305 |
result = context.TryLink(libpython_test_text,".c"); |
1306 |
|
1307 |
context.Result(result) |
1308 |
|
1309 |
if(result): |
1310 |
context.env['PYTHON_LIBPATH']=python_libpath |
1311 |
context.env['PYTHON_LIB']=python_libs |
1312 |
context.env['PYTHON_CPPPATH']=python_cpppath |
1313 |
context.env['PYTHON_LINKFLAGS']=python_linkflags |
1314 |
|
1315 |
context.env['LIBS'] = lastLIBS |
1316 |
context.env['LIBPATH'] = lastLIBPATH |
1317 |
context.env['CPPPATH'] = lastCPPPATH |
1318 |
context.env['LINKFLAGS'] = lastLINKFLAGS |
1319 |
|
1320 |
return result |
1321 |
|
1322 |
#---------------- |
1323 |
# IDA test |
1324 |
|
1325 |
sundials_version_major_required = 2 |
1326 |
sundials_version_minor_min = 2 |
1327 |
sundials_version_minor_max = 3 |
1328 |
|
1329 |
sundials_version_text = """ |
1330 |
#include <sundials/sundials_config.h> |
1331 |
#include <stdio.h> |
1332 |
int main(){ |
1333 |
printf("%s",SUNDIALS_PACKAGE_VERSION); |
1334 |
return 0; |
1335 |
} |
1336 |
""" |
1337 |
|
1338 |
ida_test_text = """ |
1339 |
#if SUNDIALS_VERSION_MAJOR==2 && SUNDIALS_VERSION_MINOR==2 |
1340 |
# include <sundials/sundials_config.h> |
1341 |
# include <sundials/sundials_nvector.h> |
1342 |
# include <nvector_serial.h> |
1343 |
# include <ida.h> |
1344 |
# include <ida/ida_spgmr.h> |
1345 |
#else |
1346 |
# include <sundials/sundials_config.h> |
1347 |
# include <nvector/nvector_serial.h> |
1348 |
# include <ida/ida.h> |
1349 |
#endif |
1350 |
int main(){ |
1351 |
void *ida_mem; |
1352 |
ida_mem = IDACreate(); |
1353 |
return 0; |
1354 |
} |
1355 |
""" |
1356 |
|
1357 |
# slightly changed calling convention (IDACalcID) in newer versions of SUNDIALS, |
1358 |
# so detect the version and act accordingly. |
1359 |
def CheckSUNDIALS(context): |
1360 |
keep = KeepContext(context,'SUNDIALS') |
1361 |
context.Message("Checking for SUNDIALS... ") |
1362 |
(is_ok,output) = context.TryRun(sundials_version_text,'.c') |
1363 |
keep.restore(context) |
1364 |
if not is_ok: |
1365 |
context.Result(0) |
1366 |
return 0 |
1367 |
|
1368 |
major,minor,patch = tuple([int(i) for i in output.split(".")]) |
1369 |
context.env['SUNDIALS_VERSION_MAJOR'] = major |
1370 |
context.env['SUNDIALS_VERSION_MINOR'] = minor |
1371 |
if major != sundials_version_major_required \ |
1372 |
or minor < sundials_version_minor_min \ |
1373 |
or minor > sundials_version_minor_max: |
1374 |
context.Result(output+" (bad version)") |
1375 |
# bad version |
1376 |
return 0 |
1377 |
|
1378 |
# good version |
1379 |
context.Result("%d.%d.%d, good" % (major,minor,patch)) |
1380 |
|
1381 |
return 1 |
1382 |
|
1383 |
|
1384 |
def CheckIDA(context): |
1385 |
context.Message( 'Checking for IDA... ' ) |
1386 |
|
1387 |
keep = KeepContext(context,"SUNDIALS") |
1388 |
|
1389 |
major = context.env['SUNDIALS_VERSION_MAJOR'] |
1390 |
minor = context.env['SUNDIALS_VERSION_MINOR'] |
1391 |
|
1392 |
cppdef = context.env.get('CPPDEFINES') |
1393 |
|
1394 |
context.env.Append(CPPDEFINES=[ |
1395 |
('SUNDIALS_VERSION_MAJOR',"$SUNDIALS_VERSION_MAJOR") |
1396 |
,('SUNDIALS_VERSION_MINOR',"$SUNDIALS_VERSION_MINOR") |
1397 |
]) |
1398 |
|
1399 |
context.env['SUNDIALS_CPPPATH_EXTRA']=[] |
1400 |
if major==2 and minor==2: |
1401 |
context.env.Append(SUNDIALS_CPPPATH_EXTRA = ["$SUNDIALS_CPPPATH/sundials"]) |
1402 |
|
1403 |
context.env.Append(CPPDEFINES=[('SUNDIALS_VERSION_MAJOR',"$SUNDIALS_VERSION_MAJOR"),('SUNDIALS_VERSION_MINOR',"$SUNDIALS_VERSION_MINOR")]) |
1404 |
context.env.AppendUnique(LIBS=context.env['SUNDIALS_LIBS']) |
1405 |
context.env.AppendUnique(CPPPATH=context.env['SUNDIALS_CPPPATH_EXTRA']) |
1406 |
|
1407 |
is_ok = context.TryLink(ida_test_text,".c") |
1408 |
context.Result(is_ok) |
1409 |
|
1410 |
if cppdef: |
1411 |
context.env['CPPDEFINES']=cppdef |
1412 |
keep.restore(context) |
1413 |
|
1414 |
return is_ok |
1415 |
|
1416 |
|
1417 |
#---------------- |
1418 |
# CONOPT test |
1419 |
|
1420 |
conopt_test_text = """ |
1421 |
#if !defined(_WIN32) |
1422 |
# define FNAME_LCASE_DECOR |
1423 |
#endif |
1424 |
|
1425 |
#include <conopt.h> |
1426 |
#include <stdlib.h> |
1427 |
int main(){ |
1428 |
int s, *v, e; |
1429 |
s = COIDEF_Size(); |
1430 |
v = (int *)malloc(s*sizeof(int)); |
1431 |
e = COIDEF_Ini(v); |
1432 |
return e; |
1433 |
} |
1434 |
""" |
1435 |
|
1436 |
def CheckCONOPT(context): |
1437 |
context.Message( 'Checking for CONOPT... ' ) |
1438 |
|
1439 |
keep = KeepContext(context,"CONOPT") |
1440 |
|
1441 |
is_ok = context.TryLink(conopt_test_text,".c") |
1442 |
context.Result(is_ok) |
1443 |
|
1444 |
keep.restore(context) |
1445 |
|
1446 |
return is_ok |
1447 |
|
1448 |
#---------------- |
1449 |
# IPOPT test |
1450 |
|
1451 |
ipopt_test_text = """ |
1452 |
#if !defined(_WIN32) |
1453 |
# define FNAME_LCASE_DECOR |
1454 |
#endif |
1455 |
|
1456 |
#include <ipopt/IpStdCInterface.h> |
1457 |
int main(){ |
1458 |
Number n; |
1459 |
IpoptProblem nlp = NULL; |
1460 |
FreeIpoptProblem(nlp); // probably a crash if you run this |
1461 |
return 0; |
1462 |
} |
1463 |
""" |
1464 |
|
1465 |
def CheckIPOPT(context): |
1466 |
context.Message( 'Checking for IPOPT... ' ) |
1467 |
|
1468 |
keep = KeepContext(context,"IPOPT") |
1469 |
|
1470 |
is_ok = context.TryLink(ipopt_test_text,".c") |
1471 |
context.Result(is_ok) |
1472 |
|
1473 |
keep.restore(context) |
1474 |
|
1475 |
return is_ok |
1476 |
|
1477 |
#---------------- |
1478 |
# Tcl test |
1479 |
|
1480 |
# TCL and TK required version 8.1, 8.2, 8.3, or 8.4: |
1481 |
tcltk_minor_newest_acceptable = 4 |
1482 |
tcltk_major_required = 8 |
1483 |
|
1484 |
tcl_check_text = r""" |
1485 |
#include <tcl.h> |
1486 |
#include <stdio.h> |
1487 |
int main(void){ |
1488 |
printf("%s",TCL_PATCH_LEVEL); |
1489 |
return 0; |
1490 |
} |
1491 |
""" |
1492 |
|
1493 |
def CheckTcl(context): |
1494 |
return CheckExtLib(context,'tcl',tcl_check_text,static=env['STATIC_TCLTK']) |
1495 |
|
1496 |
def CheckTclVersion(context): |
1497 |
keep = KeepContext(context,'TCL',static=env['STATIC_TCLTK']) |
1498 |
context.Message("Checking Tcl version... ") |
1499 |
(is_ok,output) = context.TryRun(tcl_check_text,'.c') |
1500 |
keep.restore(context) |
1501 |
if not is_ok: |
1502 |
context.Result("failed to run check") |
1503 |
return 0 |
1504 |
|
1505 |
major,minor,patch = tuple([int(i) for i in output.split(".")]) |
1506 |
if major != tcltk_major_required or minor > tcltk_minor_newest_acceptable: |
1507 |
context.Result(output+" (bad version)") |
1508 |
# bad version |
1509 |
return 0 |
1510 |
|
1511 |
# good version |
1512 |
context.Result(output+", good") |
1513 |
return 1 |
1514 |
|
1515 |
#---------------- |
1516 |
# Tk test |
1517 |
|
1518 |
tk_check_text = r""" |
1519 |
#include <tk.h> |
1520 |
#include <stdio.h> |
1521 |
int main(void){ |
1522 |
printf("%s",TK_PATCH_LEVEL); |
1523 |
return 0; |
1524 |
} |
1525 |
""" |
1526 |
def CheckTk(context): |
1527 |
return CheckExtLib(context,'tk',tk_check_text,static=env['STATIC_TCLTK']) |
1528 |
|
1529 |
|
1530 |
def CheckTkVersion(context): |
1531 |
keep = KeepContext(context,'TK',static=context.env['STATIC_TCLTK']) |
1532 |
context.Message("Checking Tk version... ") |
1533 |
#print "LINKFLAGS =",context.env['LINKFLAGS'] |
1534 |
(is_ok,output) = context.TryRun(tk_check_text,'.c') |
1535 |
keep.restore(context) |
1536 |
if not is_ok: |
1537 |
context.Result("failed to run check") |
1538 |
return 0 |
1539 |
|
1540 |
major,minor,patch = tuple([int(i) for i in output.split(".")]) |
1541 |
if major != tcltk_major_required or minor > tcltk_minor_newest_acceptable: |
1542 |
# bad version |
1543 |
context.Result(output+" (bad version)") |
1544 |
return 0 |
1545 |
|
1546 |
# good version |
1547 |
context.Result(output+" (good)") |
1548 |
return 1 |
1549 |
|
1550 |
#---------------- |
1551 |
# Tktable test |
1552 |
|
1553 |
tktable_check_text = r""" |
1554 |
#include <tkTable.h> |
1555 |
#include <stdio.h> |
1556 |
int main(void){ |
1557 |
Table mytable; |
1558 |
return 0; |
1559 |
} |
1560 |
""" |
1561 |
|
1562 |
def CheckTkTable(context): |
1563 |
return CheckExtLib(context,'tktable',tktable_check_text,static=env['STATIC_TCLTK']) |
1564 |
|
1565 |
#--------------- |
1566 |
# X11 test |
1567 |
|
1568 |
x11_check_text = r""" |
1569 |
#include <X11/Xlib.h> |
1570 |
#include <X11/IntrinsicP.h> |
1571 |
#include <X11/Intrinsic.h> |
1572 |
#include <X11/ObjectP.h> |
1573 |
#include <X11/Object.h> |
1574 |
int main(void){ |
1575 |
Object mything; |
1576 |
return 0; |
1577 |
} |
1578 |
""" |
1579 |
|
1580 |
def CheckX11(context): |
1581 |
return CheckExtLib(context,'X11',x11_check_text) |
1582 |
|
1583 |
#---------------- |
1584 |
# Check that we can raise and catch sigint |
1585 |
|
1586 |
sigint_test_text = r""" |
1587 |
#include <signal.h> |
1588 |
#include <setjmp.h> |
1589 |
#include <stdlib.h> |
1590 |
static jmp_buf g_jmpenv; |
1591 |
void sighandler(int sig){ |
1592 |
longjmp(g_jmpenv,sig); |
1593 |
} |
1594 |
void testsigint(){ |
1595 |
raise(SIGINT); |
1596 |
} |
1597 |
int main(void){ |
1598 |
signal(SIGINT,&sighandler); |
1599 |
switch(setjmp(g_jmpenv)){ |
1600 |
case 0: |
1601 |
testsigint(); |
1602 |
exit(1); |
1603 |
case SIGINT: |
1604 |
exit(0); |
1605 |
default: |
1606 |
exit(2); |
1607 |
} |
1608 |
} |
1609 |
""" |
1610 |
|
1611 |
def CheckSIGINT(context): |
1612 |
context.Message("Checking SIGINT is catchable... ") |
1613 |
(is_ok,output)=context.TryRun(sigint_test_text,".c") |
1614 |
context.Result(is_ok) |
1615 |
return is_ok |
1616 |
|
1617 |
#---------------- |
1618 |
# Check that we're able to catch floating point errors |
1619 |
|
1620 |
sigfpe_test_text = r""" |
1621 |
#include <signal.h> |
1622 |
#include <setjmp.h> |
1623 |
#include <stdlib.h> |
1624 |
#include <fenv.h> |
1625 |
static jmp_buf g_jmpenv; |
1626 |
void fpehandler(int sig){ |
1627 |
longjmp(g_jmpenv,sig); |
1628 |
} |
1629 |
int main(void){ |
1630 |
fenv_t myfenv; |
1631 |
fegetenv(&myfenv); |
1632 |
fesetenv(&myfenv); |
1633 |
feenableexcept(FE_ALL_EXCEPT); |
1634 |
signal(SIGFPE,&fpehandler); |
1635 |
double x; |
1636 |
switch(setjmp(g_jmpenv)){ |
1637 |
case 0: |
1638 |
x = 1.0 / 0.0; |
1639 |
/* failed to catch */ |
1640 |
exit(1); |
1641 |
case SIGFPE: |
1642 |
exit(0); |
1643 |
} |
1644 |
} |
1645 |
""" |
1646 |
|
1647 |
def CheckFPE(context): |
1648 |
context.Message("Checking C99 FPE behaviour... ") |
1649 |
(is_ok,output) = context.TryRun(sigfpe_test_text,'.c') |
1650 |
context.Result(is_ok) |
1651 |
return is_ok |
1652 |
|
1653 |
#---------------- |
1654 |
# signal reset needed? |
1655 |
|
1656 |
sigreset_test_text = r""" |
1657 |
#include <signal.h> |
1658 |
#include <setjmp.h> |
1659 |
#include <stdlib.h> |
1660 |
#include <stdio.h> |
1661 |
typedef void SigHandlerFn(int); |
1662 |
static jmp_buf g_jmpenv; |
1663 |
void sighandler(int sig){ |
1664 |
longjmp(g_jmpenv,sig); |
1665 |
} |
1666 |
void testsigint(){ |
1667 |
/* fprintf(stderr,"Raising SIGINT\n"); */ |
1668 |
raise(SIGINT); |
1669 |
} |
1670 |
int main(void){ |
1671 |
SigHandlerFn *last,*saved; |
1672 |
saved = signal(SIGINT,&sighandler); |
1673 |
if(saved!=SIG_DFL){ |
1674 |
fprintf(stderr,"Default handler (%p) was not correctly set\n",SIG_DFL); |
1675 |
exit(3); |
1676 |
} |
1677 |
switch(setjmp(g_jmpenv)){ |
1678 |
case 0: |
1679 |
testsigint(); |
1680 |
fprintf(stderr,"Back from SIGINT\n"); |
1681 |
exit(1); |
1682 |
case SIGINT: |
1683 |
break; |
1684 |
default: |
1685 |
exit(2); |
1686 |
}; |
1687 |
last = signal(SIGINT,SIG_DFL); |
1688 |
if(last!=&sighandler){ |
1689 |
printf("1"); |
1690 |
exit(0); |
1691 |
} |
1692 |
printf("0"); |
1693 |
exit(0); |
1694 |
} |
1695 |
""" |
1696 |
|
1697 |
def CheckSigReset(context): |
1698 |
context.Message("Checking signal handler reset... ") |
1699 |
(is_ok,output) = context.TryRun(sigreset_test_text,'.c') |
1700 |
if not is_ok: |
1701 |
context.Result("ERROR") |
1702 |
return False |
1703 |
if int(output)==1: |
1704 |
context.Result("required"); |
1705 |
context.env['ASC_RESETNEEDED'] = True |
1706 |
else: |
1707 |
context.Result("not required"); |
1708 |
context.env['ASC_RESETNEEDED'] = False |
1709 |
return is_ok |
1710 |
|
1711 |
#---------------- |
1712 |
# LyX on this system? |
1713 |
|
1714 |
def CheckLyx(context): |
1715 |
context.Message("Checking for LyX... ") |
1716 |
r = context.env.WhereIs("lyx") |
1717 |
if r: |
1718 |
context.Result(r) |
1719 |
else: |
1720 |
context.Result(0) |
1721 |
return r |
1722 |
|
1723 |
#---------------- |
1724 |
# Latex2HTML on this system? |
1725 |
|
1726 |
def CheckLatex2HTML(context): |
1727 |
context.Message("Checking for latex2html...") |
1728 |
if context.env.WhereIs("latex2html"): |
1729 |
r = True |
1730 |
else: |
1731 |
r = False |
1732 |
context.Result(r) |
1733 |
return r |
1734 |
|
1735 |
#---------------- |
1736 |
# GCC Version sniffing |
1737 |
|
1738 |
# TODO FIXME |
1739 |
|
1740 |
gcc_version4 = False |
1741 |
|
1742 |
#------------------------------------------------------ |
1743 |
# CONFIGURATION |
1744 |
|
1745 |
conf = Configure(env |
1746 |
, custom_tests = { |
1747 |
'CheckCC' : CheckCC |
1748 |
, 'CheckCXX' : CheckCXX |
1749 |
, 'CheckMath' : CheckMath |
1750 |
, 'CheckSwigVersion' : CheckSwigVersion |
1751 |
, 'CheckPythonLib' : CheckPythonLib |
1752 |
, 'CheckCUnit' : CheckCUnit |
1753 |
, 'CheckDMalloc' : CheckDMalloc |
1754 |
, 'CheckLyx' : CheckLyx |
1755 |
, 'CheckLatex2HTML' : CheckLatex2HTML |
1756 |
, 'CheckMFGraph' : CheckMFGraph |
1757 |
, 'CheckUFSparse' : CheckUFSparse |
1758 |
, 'CheckTcl' : CheckTcl |
1759 |
, 'CheckTclVersion' : CheckTclVersion |
1760 |
, 'CheckTk' : CheckTk |
1761 |
, 'CheckTkVersion' : CheckTkVersion |
1762 |
, 'CheckGcc' : CheckGcc |
1763 |
, 'CheckGccVisibility' : CheckGccVisibility |
1764 |
, 'CheckYacc' : CheckYacc |
1765 |
, 'CheckLex' : CheckLex |
1766 |
, 'CheckTkTable' : CheckTkTable |
1767 |
, 'CheckX11' : CheckX11 |
1768 |
, 'CheckIDA' : CheckIDA |
1769 |
, 'CheckSUNDIALS' : CheckSUNDIALS |
1770 |
, 'CheckCONOPT' : CheckCONOPT |
1771 |
, 'CheckIPOPT' : CheckIPOPT |
1772 |
, 'CheckScrollkeeperConfig' : CheckScrollkeeperConfig |
1773 |
, 'CheckFPE' : CheckFPE |
1774 |
, 'CheckSIGINT' : CheckSIGINT |
1775 |
, 'CheckSigReset' : CheckSigReset |
1776 |
# , 'CheckIsNan' : CheckIsNan |
1777 |
# , 'CheckCppUnitConfig' : CheckCppUnitConfig |
1778 |
} |
1779 |
# , config_h = "config.h" |
1780 |
) |
1781 |
|
1782 |
def sconsversioncheck(): |
1783 |
|
1784 |
# uncomment the following line to skip the version check: |
1785 |
# return 1 |
1786 |
|
1787 |
import SCons |
1788 |
v = SCons.__version__.split(".") |
1789 |
if v[0] != '0': |
1790 |
return 0 |
1791 |
if int(v[1]) >= 97: |
1792 |
return 1 |
1793 |
if v[1] != '96': |
1794 |
return 0 |
1795 |
micro = int(v[2]) |
1796 |
if micro == 92 or micro == 93 or micro == 96: |
1797 |
return 1; |
1798 |
return 0 |
1799 |
|
1800 |
if not sconsversioncheck(): |
1801 |
print "Scons version is not OK. Please try version 0.96.92 or 0.96.93," |
1802 |
print "or consult the developers in the case of newer versions. Modify" |
1803 |
print "the function 'sconsversioncheck' in the file SConstruct if you" |
1804 |
print "want to *force* SCons to continue." |
1805 |
Exit(1) |
1806 |
|
1807 |
# check C compiler |
1808 |
|
1809 |
if not conf.CheckCC(): |
1810 |
print "Failed to build simple test file with your C compiler." |
1811 |
print "Check your compiler is installed and running correctly." |
1812 |
Exit(1) |
1813 |
|
1814 |
if not conf.CheckCXX(): |
1815 |
print "Failed to build simple test file with your C++ compiler." |
1816 |
print "Check your compiler is installed and running correctly." |
1817 |
Exit(1) |
1818 |
|
1819 |
# stdio -- just to check that compiler is behaving |
1820 |
|
1821 |
if not conf.CheckHeader('stdio.h'): |
1822 |
print "CPPPATH =",env.get('CPPPATH') |
1823 |
print "Did not find 'stdio.h'! Check your compiler configuration." |
1824 |
print "" |
1825 |
print "You environment is printed here:" |
1826 |
for k,v in os.environ.iteritems(): |
1827 |
print "%-30s%s" % ("%s :" % k, v) |
1828 |
Exit(1) |
1829 |
|
1830 |
if not conf.CheckFunc('snprintf'): |
1831 |
print "Didn't find snprintf"; |
1832 |
exit(1) |
1833 |
|
1834 |
# Math library |
1835 |
|
1836 |
conf.env['HAVE_IEEE']=True |
1837 |
|
1838 |
if need_libm and not conf.CheckMath(): |
1839 |
conf.env['HAVE_IEEE']=False |
1840 |
print 'Did not find math library, exiting!' |
1841 |
Exit(1) |
1842 |
|
1843 |
# Where is 'isnan'? |
1844 |
|
1845 |
if not conf.CheckFunc('isnan') and not conf.CheckFunc('_isnan'): |
1846 |
print "Didn't find isnan" |
1847 |
# Exit(1) |
1848 |
|
1849 |
# GCC visibility |
1850 |
|
1851 |
if conf.CheckGcc(): |
1852 |
conf.env['HAVE_GCC']=True; |
1853 |
if env['WITH_GCCVISIBILITY'] and conf.CheckGccVisibility(): |
1854 |
conf.env['HAVE_GCCVISIBILITY']=True; |
1855 |
conf.env.Append(CCFLAGS=['-fvisibility=hidden']) |
1856 |
conf.env.Append(CPPDEFINES=['HAVE_GCCVISIBILITY']) |
1857 |
conf.env.Append(CCFLAGS=['-Wall']) |
1858 |
|
1859 |
# Catching SIGINT |
1860 |
|
1861 |
if env['WITH_SIGNALS']: |
1862 |
if not conf.CheckSIGINT(): |
1863 |
with_signals = False |
1864 |
without_signals_reason = "SIGINT uncatchable" |
1865 |
|
1866 |
# Catching SIGFPE |
1867 |
|
1868 |
if conf.CheckFPE(): |
1869 |
conf.env['HAVE_C99FPE']=True |
1870 |
else: |
1871 |
conf.env['HAVE_C99FPE']=False |
1872 |
|
1873 |
# Checking for signal reset requirement |
1874 |
|
1875 |
if not conf.CheckSigReset(): |
1876 |
print "Unable to determine if signal reset is required" |
1877 |
Exit(1) |
1878 |
|
1879 |
# YACC |
1880 |
|
1881 |
if not conf.CheckYacc(): |
1882 |
print "YACC NOT FOUND OR NOT WORKING" |
1883 |
else: |
1884 |
conf.env['HAVE_YACC']=True |
1885 |
|
1886 |
if not conf.CheckLex(): |
1887 |
print "YACC NOT FOUND OR NOT WORKING" |
1888 |
else: |
1889 |
conf.env['HAVE_LEX']=True |
1890 |
|
1891 |
# Tcl/Tk |
1892 |
|
1893 |
if with_tcltk: |
1894 |
if conf.CheckTcl(): |
1895 |
if conf.CheckTclVersion(): |
1896 |
if conf.CheckTk(): |
1897 |
if with_tcltk and conf.CheckTkVersion(): |
1898 |
if env['STATIC_TCLTK']: |
1899 |
if conf.CheckTkTable(): |
1900 |
pass |
1901 |
else: |
1902 |
without_tcltk_reason = "TkTable not found" |
1903 |
with_tcltk = False |
1904 |
else: |
1905 |
without_tcltk_reason = "Require Tk version <= 8.4. See 'scons -h'" |
1906 |
with_tcltk = False |
1907 |
else: |
1908 |
without_tcltk_reason = "Tk not found." |
1909 |
with_tcltk = False |
1910 |
else: |
1911 |
without_tcltk_reason = "Require Tcl <= 8.4 Tcl." |
1912 |
with_tcltk = False |
1913 |
|
1914 |
else: |
1915 |
without_tcltk_reason = "Tcl not found." |
1916 |
with_tcltk = False |
1917 |
|
1918 |
if env['STATIC_TCLTK']: |
1919 |
conf.CheckX11() |
1920 |
|
1921 |
# Python... obviously we're already running python, so we just need to |
1922 |
# check that we can link to the python library OK: |
1923 |
|
1924 |
if not conf.CheckPythonLib(): |
1925 |
without_python_reason = 'libpython2.x not found or not linkable' |
1926 |
with_python = False |
1927 |
env['WITH_PYTHON']=False |
1928 |
|
1929 |
# SWIG version |
1930 |
|
1931 |
if with_python and not conf.CheckSwigVersion(): |
1932 |
without_python_reason = 'SWIG >= 1.3.24 is required' |
1933 |
with_python = False |
1934 |
env['WITH_PYTHON']=False |
1935 |
|
1936 |
# CUnit |
1937 |
|
1938 |
if with_cunit: |
1939 |
if not conf.CheckCUnit(): |
1940 |
without_cunit_reason = 'CUnit not found' |
1941 |
with_cunit = False |
1942 |
#print "CUNIT NOT FOUND, LIBS=",conf.env.get('LIBS') |
1943 |
|
1944 |
# DMALLOC |
1945 |
|
1946 |
if with_dmalloc: |
1947 |
if not conf.CheckDMalloc(): |
1948 |
without_dmalloc_reason = 'dmalloc not found' |
1949 |
with_dmalloc = False |
1950 |
|
1951 |
# MFGRAPH |
1952 |
|
1953 |
if with_mfgraph: |
1954 |
if not conf.CheckMFGraph(): |
1955 |
without_mfgraph_reason = 'mfgraph not found' |
1956 |
with_mfgraph = False |
1957 |
env['WITH_MFGRAPH'] = False |
1958 |
|
1959 |
# UFSPARSE |
1960 |
|
1961 |
if with_ufsparse: |
1962 |
if not conf.CheckUFSparse(): |
1963 |
without_ufsparse_reason = 'mfgraph not found' |
1964 |
with_ufsparse = False |
1965 |
env['WITH_UFSPARSE'] = False |
1966 |
|
1967 |
# IDA |
1968 |
|
1969 |
if not with_ida: |
1970 |
without_ida_reason = "Not selected (see config option WITH_SOLVERS)" |
1971 |
elif not conf.CheckSUNDIALS(): |
1972 |
with_ida = False |
1973 |
without_ida_reason = "SUNDIALS not found, or bad version" |
1974 |
elif not conf.CheckIDA(): |
1975 |
with_ida = False |
1976 |
without_ida_reason = "Unable to compile/link against SUNDIALS/IDA" |
1977 |
|
1978 |
# CONOPT |
1979 |
|
1980 |
if not with_conopt: |
1981 |
without_conopt_reason = "Not selected (see config option WITH_SOLVERS)" |
1982 |
elif not conf.CheckCONOPT(): |
1983 |
if conf.env.get('CONOPT_LINKED'): |
1984 |
conf.env['CONOPT_LINKED'] = False |
1985 |
# we no longer require CONOPT at buildtime in order to build support for it |
1986 |
#with_conopt = False |
1987 |
#without_conpt_reason = "CONOPT not found" |
1988 |
|
1989 |
# IPOPT |
1990 |
|
1991 |
if not with_ipopt: |
1992 |
without_ipopt_reason = "Not selected (see config option WITH_SOLVERS)" |
1993 |
elif not conf.CheckIPOPT(): |
1994 |
with_ipopt = False |
1995 |
without_ipopt_reason = "IPOPT not found" |
1996 |
|
1997 |
# BLAS |
1998 |
|
1999 |
need_blas=False |
2000 |
|
2001 |
if with_lsode: |
2002 |
need_fortran = True |
2003 |
need_blas=True |
2004 |
|
2005 |
if need_blas: |
2006 |
if conf.CheckLib('blas'): |
2007 |
with_local_blas = False |
2008 |
without_local_blas_reason = "Found BLAS installed on system" |
2009 |
else: |
2010 |
with_local_blas = True |
2011 |
need_fortran = True |
2012 |
else: |
2013 |
with_local_blas= False; |
2014 |
without_local_blas_reason = "BLAS not required" |
2015 |
|
2016 |
# FORTRAN |
2017 |
|
2018 |
if need_fortran: |
2019 |
conf.env.Tool('fortran') |
2020 |
detect_fortran = conf.env.Detect(['gfortran','g77']) |
2021 |
if detect_fortran: |
2022 |
# For some reason, g77 doesn't get detected properly on MinGW |
2023 |
if not env.has_key('F77') and not env.has_key('FORTRAN'): |
2024 |
print "Fixing detection of F77 on MinGW...(?)" |
2025 |
conf.env.Replace(F77=detect_fortran) |
2026 |
conf.env.Replace(F77COM='$F77 $F77FLAGS -c -o $TARGET $SOURCE') |
2027 |
conf.env.Replace(F77FLAGS='') |
2028 |
#print "F77:",conf.env['F77'] |
2029 |
#print "F77COM:",conf.env['F77COM'] |
2030 |
#print "F77FLAGS:",conf.env['F77FLAGS'] |
2031 |
fortran_builder = Builder( |
2032 |
action='$F77COM' |
2033 |
, suffix='.o' |
2034 |
, src_suffix='.f' |
2035 |
) |
2036 |
conf.env.Append(BUILDERS={'Fortran':fortran_builder}) |
2037 |
if platform.system()=="Linux": |
2038 |
conf.env.Append(SHFORTRANFLAGS=['-fPIC']) |
2039 |
else: |
2040 |
with_lsode=False; |
2041 |
without_lsode_reason="FORTRAN-77 required but not found" |
2042 |
|
2043 |
#else: |
2044 |
# print "FORTRAN not required" |
2045 |
|
2046 |
# F2C |
2047 |
|
2048 |
if need_fortran: |
2049 |
if platform.system()=="Windows": |
2050 |
pass |
2051 |
#conf.env.Append(LIBPATH='c:\mingw\lib') |
2052 |
|
2053 |
# scrollkeeper |
2054 |
|
2055 |
if with_scrollkeeper: |
2056 |
if not conf.CheckScrollkeeperConfig(): |
2057 |
with_scrollkeeper=False |
2058 |
without_scrollkeeper_reason="unable to detect scrollkeeper-config" |
2059 |
|
2060 |
# lyx |
2061 |
|
2062 |
if with_doc_build: |
2063 |
if not conf.CheckLyx(): |
2064 |
with_doc_build = False |
2065 |
without_doc_build_reason="unable to locate lyx" |
2066 |
|
2067 |
with_latext2html = conf.CheckLatex2HTML() |
2068 |
|
2069 |
# TODO: -D_HPUX_SOURCE is needed |
2070 |
|
2071 |
# TODO: check size of void* |
2072 |
|
2073 |
# TODO: detect if dynamic libraries are possible or not |
2074 |
|
2075 |
if platform.system()=="Windows" and env.has_key('MSVS'): |
2076 |
_found_windows_h = conf.CheckHeader('Windows.h') |
2077 |
|
2078 |
if not _found_windows_h: |
2079 |
print "Could not locate 'Windows.h' in CPPPATH. Check your configuration." |
2080 |
Exit(1) |
2081 |
|
2082 |
if with_python and not conf.CheckHeader(['basetsd.h','BaseTsd.h']): |
2083 |
with_python = 0; |
2084 |
without_python_reason = "Header file 'basetsd.h' not found. Install the MS Platform SDK." |
2085 |
|
2086 |
conf.Finish() |
2087 |
|
2088 |
#--------------------------------------- |
2089 |
# SUBSTITUTION DICTIONARY for .in files |
2090 |
|
2091 |
release = env.get('RELEASE') |
2092 |
if release=="0.": |
2093 |
release="0" |
2094 |
|
2095 |
#print "SUBSTITUTED CONOPT_LIBPATH:",c_escape(env.subst("$CONOPT_LIBPATH")) |
2096 |
|
2097 |
subst_dict = { |
2098 |
'@DEFAULT_ASCENDLIBRARY@':env['DEFAULT_ASCENDLIBRARY'] |
2099 |
,'@DEFAULT_ASCENDSOLVERS@':env['DEFAULT_ASCENDSOLVERS'] |
2100 |
, '@GLADE_FILE@':'ascend.glade' |
2101 |
, '@HELP_ROOT@':'' |
2102 |
, '@ICON_EXTENSION@':icon_extension |
2103 |
, '@INSTALL_ASCDATA@':env['INSTALL_ASCDATA'] |
2104 |
, '@INSTALL_BIN@':env['INSTALL_BIN'] |
2105 |
, '@INSTALL_INCLUDE@':env['INSTALL_INCLUDE'] |
2106 |
, '@INSTALL_LIB@':env['INSTALL_LIB'] |
2107 |
, '@INSTALL_MODELS@':env['INSTALL_MODELS'] |
2108 |
, '@INSTALL_SOLVERS@':env['INSTALL_SOLVERS'] |
2109 |
, '@PYGTK_ASSETS@':env['PYGTK_ASSETS'] |
2110 |
, '@VERSION@':version |
2111 |
, '@RELEASE@':release |
2112 |
, '@DISTTAR_NAME@':env['DISTTAR_NAME'] |
2113 |
, '@WEBHELPROOT@':'http://pye.dyndns.org/ascend/manual/' |
2114 |
, '@SHLIBSUFFIX@':env['SHLIBSUFFIX'] |
2115 |
, '@SHLIBPREFIX@':env['SHLIBPREFIX'] |
2116 |
, '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk' |
2117 |
, '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir |
2118 |
, '@PYTHON@' : python_exe |
2119 |
, '@PYVERSION@' : pyversion |
2120 |
, '@ASC_CONOPT_LIB@':env.get('CONOPT_LIB') |
2121 |
, '@ASC_CONOPT_ENVVAR@':env.get('CONOPT_ENVVAR') |
2122 |
, '@ASC_CONOPT_DLPATH@':c_escape(env.subst("$CONOPT_DLPATH")) |
2123 |
, '@SOURCE_ROOT@':c_escape(os.path.abspath(str(env.Dir("#")))) |
2124 |
, '@WITH_SOLVERS@':",".join(env.get('WITH_SOLVERS')) |
2125 |
} |
2126 |
|
2127 |
if env.get('WITH_DOC'): |
2128 |
print "WITH_DOC:",env['WITH_DOC'] |
2129 |
subst_dict['@HELP_ROOT@']=env['HELP_ROOT'] |
2130 |
|
2131 |
# bool options... |
2132 |
for k,v in { |
2133 |
'ASC_WITH_IDA':with_ida |
2134 |
,'ASC_WITH_DMALLOC':with_dmalloc |
2135 |
,'ASC_WITH_MFGRAPH':with_mfgraph |
2136 |
,'ASC_WITH_UFSPARSE':with_ufsparse |
2137 |
,'ASC_WITH_CONOPT':with_conopt |
2138 |
,'ASC_LINKED_CONOPT':env.get('CONOPT_LINKED') |
2139 |
,'ASC_WITH_IPOPT':with_ipopt |
2140 |
,'ASC_WITH_LSODE':with_lsode |
2141 |
,'ASC_WITH_MMIO':with_mmio |
2142 |
,'ASC_SIGNAL_TRAPS':with_signals |
2143 |
,'ASC_RESETNEEDED':env.get('ASC_RESETNEEDED') |
2144 |
,'HAVE_C99FPE':env.get('HAVE_C99FPE') |
2145 |
,'HAVE_IEEE':env.get('HAVE_IEEE') |
2146 |
,'ASC_ABSOLUTE_PATHS':env.get('ABSOLUTE_PATHS') |
2147 |
,'ASC_XTERM_COLORS':env.get('WITH_XTERM_COLORS') |
2148 |
,'MALLOC_DEBUG':env.get('MALLOC_DEBUG') |
2149 |
}.iteritems(): |
2150 |
|
2151 |
if v: subst_dict["/\\* #define %s @%s@ \\*/" % (k,k)]='# define %s 1 ' % k |
2152 |
|
2153 |
if with_python: |
2154 |
subst_dict['@ASCXX_USE_PYTHON@']="1" |
2155 |
env['WITH_PYTHON']=1; |
2156 |
|
2157 |
if with_latex2html: |
2158 |
env['WITH_LATEX2HTML']=1 |
2159 |
|
2160 |
if env.has_key('HAVE_GCCVISIBILITY'): |
2161 |
subst_dict['@HAVE_GCCVISIBILITY@'] = "1" |
2162 |
|
2163 |
env.Append(SUBST_DICT=subst_dict) |
2164 |
|
2165 |
#for k,v in subst_dict.iteritems(): |
2166 |
# print "%-50s%s" % ("'%s'"%k,v) |
2167 |
|
2168 |
# REMOVED: long command-line support on Win2k |
2169 |
|
2170 |
#------------------------------------------------------ |
2171 |
# RECIPE: SWIG scanner |
2172 |
|
2173 |
import SCons.Script |
2174 |
|
2175 |
SWIGScanner = SCons.Scanner.ClassicCPP( |
2176 |
"SWIGScan" |
2177 |
, ".i" |
2178 |
, "CPPPATH" |
2179 |
, '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")' |
2180 |
) |
2181 |
|
2182 |
env.Append(SCANNERS=[SWIGScanner]) |
2183 |
|
2184 |
#------------------------------------------------------ |
2185 |
# Recipe for 'CHMOD' ACTION |
2186 |
|
2187 |
import SCons |
2188 |
from SCons.Script.SConscript import SConsEnvironment |
2189 |
SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod, |
2190 |
lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode)) |
2191 |
|
2192 |
def InstallPerm(env, dest, files, perm): |
2193 |
obj = env.Install(dest, files) |
2194 |
for i in obj: |
2195 |
env.AddPostAction(i, env.Chmod(str(i), perm)) |
2196 |
|
2197 |
SConsEnvironment.InstallPerm = InstallPerm |
2198 |
|
2199 |
# define wrappers |
2200 |
SConsEnvironment.InstallProgram = lambda env, dest, files: InstallPerm(env, dest, files, 0755) |
2201 |
SConsEnvironment.InstallHeader = lambda env, dest, files: InstallPerm(env, dest, files, 0644) |
2202 |
SConsEnvironment.InstallShared = lambda env, dest, files: InstallPerm(env, dest, files, 0644) |
2203 |
|
2204 |
#------------------------------------------------------ |
2205 |
# BUILD... |
2206 |
|
2207 |
# so that #include <modulename/headername.h> works across all modules... |
2208 |
env.AppendUnique(CPPPATH=['#base/generic']) |
2209 |
|
2210 |
if env['DEBUG']: |
2211 |
env.Append(CCFLAGS=['-g']) |
2212 |
|
2213 |
if env['GCOV']: |
2214 |
env.Append( |
2215 |
CPPFLAGS=['-g','-fprofile-arcs','-ftest-coverage'] |
2216 |
, LIBS=['gcov'] |
2217 |
, LINKFLAGS=['-fprofile-arcs','-ftest-coverage'] |
2218 |
) |
2219 |
|
2220 |
if with_ida: |
2221 |
env.Append(WITH_IDA=1) |
2222 |
|
2223 |
if with_conopt: |
2224 |
env.Append(WITH_CONOPT=1) |
2225 |
|
2226 |
if with_ipopt: |
2227 |
env.Append(WITH_IPOPT=1) |
2228 |
|
2229 |
#------------- |
2230 |
# TCL/TK GUI |
2231 |
|
2232 |
if with_tcltk: |
2233 |
env.SConscript(['tcltk/generic/interface/SConscript'],'env') |
2234 |
else: |
2235 |
print "Skipping... Tcl/Tk bindings aren't being built:",without_tcltk_reason |
2236 |
|
2237 |
#------------- |
2238 |
# PYTHON INTERFACE |
2239 |
|
2240 |
if with_python: |
2241 |
env.SConscript(['pygtk/SConscript'],'env') |
2242 |
else: |
2243 |
print "Skipping... Python bindings aren't being built:",without_python_reason |
2244 |
|
2245 |
#------------ |
2246 |
# BASE/GENERIC SUBDIRECTORIES |
2247 |
|
2248 |
libascend_env = env.Copy() |
2249 |
|
2250 |
dirs = ['general','utilities','compiler','system','solver','integrator','packages','linear'] |
2251 |
|
2252 |
srcs = [] |
2253 |
for d in dirs: |
2254 |
heresrcs = libascend_env.SConscript('base/generic/'+d+'/SConscript','libascend_env') |
2255 |
srcs += heresrcs |
2256 |
|
2257 |
#------------- |
2258 |
# IMPORTED CODE: LSODE, BLAS, etc |
2259 |
|
2260 |
#if with_lsode: |
2261 |
# srcs += env.SConscript(['lsod/SConscript'],'env') |
2262 |
# srcs += env.SConscript(['linpack/SConscript'],'env') |
2263 |
#else: |
2264 |
# print "Skipping... LSODE won't be built:", without_lsode_reason |
2265 |
|
2266 |
if with_local_blas: |
2267 |
env['blasobjs'] = env.SConscript(['blas/SConscript'],'env') |
2268 |
else: |
2269 |
env['blasobjs'] = [] |
2270 |
print "Skipping... BLAS won't be built:", without_local_blas_reason |
2271 |
|
2272 |
if not with_ida: |
2273 |
print "Skipping... IDA won't be built:", without_ida_reason |
2274 |
|
2275 |
if with_mmio: |
2276 |
srcs += env.SConscript(['mmio/SConscript'],'env') |
2277 |
else: |
2278 |
print "Skipping... MMIO export won't be built:", without_mmio_reason |
2279 |
#------------- |
2280 |
# LIBASCEND -- all base/generic functionality |
2281 |
|
2282 |
if with_dmalloc: |
2283 |
libascend_env.Append(LIBS=['dmalloc']) |
2284 |
|
2285 |
if with_ufsparse: |
2286 |
libascend_env.Append(LIBS=['cxsparse']) |
2287 |
|
2288 |
libascend = libascend_env.SharedLibrary('ascend',srcs) |
2289 |
|
2290 |
# for use in declaring dependent shared libraries in SConscript files (eg solvers/*/SConscript) |
2291 |
env['libascend'] = libascend |
2292 |
|
2293 |
env.Alias('libascend',libascend) |
2294 |
|
2295 |
#------------- |
2296 |
# UNIT TESTS (C CODE) |
2297 |
|
2298 |
if with_cunit: |
2299 |
testdirs = ['general','solver','utilities','linear'] |
2300 |
testsrcs = [] |
2301 |
for testdir in testdirs: |
2302 |
path = 'base/generic/'+testdir+'/test/' |
2303 |
env.SConscript([path+'SConscript'],'env') |
2304 |
testsrcs += [i.path for i in env['TESTSRCS_'+testdir.upper()]] |
2305 |
|
2306 |
#print "TESTSRCS =",testsrcs |
2307 |
|
2308 |
env.SConscript(['test/SConscript'],'env') |
2309 |
env.SConscript(['base/generic/test/SConscript'],'env') |
2310 |
|
2311 |
env.Alias('test',[env.Dir('test'),env.Dir('base/generic/test')]) |
2312 |
|
2313 |
else: |
2314 |
print "Skipping... CUnit tests aren't being built:",without_cunit_reason |
2315 |
|
2316 |
#------------- |
2317 |
# EXTERNAL SOLVERS |
2318 |
|
2319 |
env['extfns']=[] |
2320 |
|
2321 |
env.SConscript(['solvers/SConscript'],'env') |
2322 |
|
2323 |
#------------- |
2324 |
# EXTERNAL FUNCTIONS |
2325 |
|
2326 |
modeldirs = env.SConscript(['models/SConscript'],'env') |
2327 |
|
2328 |
if not with_extfns: |
2329 |
print "Skipping... External modules aren't being built:",without_extfns_reason |
2330 |
|
2331 |
env.Alias('extfns',env['extfns']) |
2332 |
|
2333 |
#------------------------------------------------------ |
2334 |
# CREATE ASCEND-CONFIG scriptlet |
2335 |
|
2336 |
ascendconfig = env.SubstInFile('ascend-config.in') |
2337 |
|
2338 |
#------------------------------------------------------ |
2339 |
# INSTALLATION |
2340 |
|
2341 |
if env.get('CAN_INSTALL'): |
2342 |
|
2343 |
dirs = ['INSTALL_BIN','INSTALL_ASCDATA','INSTALL_LIB', 'INSTALL_INCLUDE','INSTALL_DOC'] |
2344 |
install_dirs = [Dir(env.subst("$INSTALL_ROOT$"+d)) for d in dirs] |
2345 |
install_dirs += modeldirs + [Dir(env.subst("$INSTALL_ROOT$INSTALL_SOLVERS"))] |
2346 |
|
2347 |
# TODO: add install options |
2348 |
env.Alias('install',install_dirs) |
2349 |
|
2350 |
env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_LIB")),libascend) |
2351 |
|
2352 |
env.InstallProgram(Dir(env.subst("$INSTALL_ROOT$INSTALL_BIN")),ascendconfig) |
2353 |
|
2354 |
#------------------------------------------------------ |
2355 |
# WINDOWS INSTALLER |
2356 |
# For the windows installer, please see pygtk/SConscript |
2357 |
|
2358 |
if with_installer: |
2359 |
env.Append(NSISDEFINES={ |
2360 |
'OUTFILE':"#dist/"+env['WIN_INSTALLER_NAME'] |
2361 |
,"VERSION":version |
2362 |
,'PYVERSION':pyversion |
2363 |
}) |
2364 |
installer = env.Installer('installer.nsi') |
2365 |
Depends(installer,["pygtk","tcltk","ascend.dll","models","ascend-config"]) |
2366 |
env.Alias('installer',installer) |
2367 |
else: |
2368 |
print "Skipping... Windows installer isn't being built:",without_installer_reason |
2369 |
|
2370 |
|
2371 |
#------------------------------------------------------ |
2372 |
# PROJECT FILE for MSVC |
2373 |
|
2374 |
env.SConscript(['base/msvc/SConscript'],['env','libascend']); |
2375 |
|
2376 |
#------------------------------------------------------ |
2377 |
# CREATE the SPEC file for generation of RPM packages |
2378 |
|
2379 |
if platform.system()=="Linux": |
2380 |
env.SubstInFile('ascend.spec.in') |
2381 |
|
2382 |
#------------------------------------------------------ |
2383 |
# CREATE OMF FILE FOR USE WITH SCROLLKEEPER |
2384 |
|
2385 |
#if with_scrollkeeper: |
2386 |
# #env.SubstInFile('#/pygtk/gnome/ascend.omf.in') |
2387 |
# #env.InstallShared(env['INSTALL_ROOT']+env['OMFDIR'],"#/pygtk/gnome/ascend.omf") |
2388 |
|
2389 |
#------------------------------------------------------ |
2390 |
# DISTRIBUTION TAR FILE |
2391 |
|
2392 |
env['DISTTAR_FORMAT']='bz2' |
2393 |
env.Append( |
2394 |
DISTTAR_EXCLUDEEXTS=['.o','.os','.so','.a','.dll','.lib','.cc','.cache','.pyc','.cvsignore','.dblite','.log','.pl','.out','.exe','.aux','.idx','.toc','.lof','.lot','.mm','.warnings','.tm2','.swp',',tmp','.gz','.bz2','.7z'] |
2395 |
, DISTTAR_EXCLUDEDIRS=['CVS','.svn','.sconf_temp', 'dist','debian'] |
2396 |
) |
2397 |
|
2398 |
tar = env.DistTar("dist/"+env['DISTTAR_NAME'] |
2399 |
, [env.Dir('#')] |
2400 |
) |
2401 |
|
2402 |
env.Depends(tar,'ascend.spec') |
2403 |
env.Depends(tar,'#doc/book.pdf') |
2404 |
|
2405 |
Alias('dist',tar) |
2406 |
|
2407 |
#------------------------------------------------------ |
2408 |
# USER'S MANUAL |
2409 |
|
2410 |
env.SConscript('doc/SConscript',['env']) |
2411 |
|
2412 |
|
2413 |
#------------------------------------------------------ |
2414 |
# LIBASCEND DOXYGEN DOCUMENTATION |
2415 |
|
2416 |
if not with_doc_build: |
2417 |
print "Skipping... Windows installer isn't being built:",without_doc_build_reason |
2418 |
|
2419 |
env.SConscript('base/doc/SConscript',['env']) |
2420 |
|
2421 |
#------------------------------------------------------ |
2422 |
# RPM BUILD |
2423 |
|
2424 |
# for RPM builds, 'scons dist' then 'rpmbuild -ta dist/ascend-*.tar.bz2' |
2425 |
# (check * for the version number used to create the tarball) |
2426 |
|
2427 |
#------------------------------------------------------ |
2428 |
# DEFAULT TARGETS |
2429 |
|
2430 |
default_targets =['libascend','solvers'] |
2431 |
if with_tcltk: |
2432 |
default_targets.append('tcltk') |
2433 |
if with_python: |
2434 |
default_targets.append('pygtk') |
2435 |
if with_installer: |
2436 |
default_targets.append('installer') |
2437 |
if with_extfns: |
2438 |
default_targets.append('extfns') |
2439 |
if with_doc_build: |
2440 |
default_targets.append('doc') |
2441 |
|
2442 |
env.Default(default_targets) |
2443 |
|
2444 |
print "Building targets:"," ".join([str(i) for i in BUILD_TARGETS]) |
2445 |
|
2446 |
# vim: set syntax=python: |