/[ascend]/trunk/SConstruct
ViewVC logotype

Contents of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 784 - (show annotations) (download)
Wed Jul 26 12:44:00 2006 UTC (18 years, 1 month ago) by johnpye
File size: 36952 byte(s)
Enabled the LRSLV solver, so that CMSLV will be able to function correctly.
1 import os, commands, platform, distutils.sysconfig, os.path
2
3 version = "0.9.5.95"
4
5 #------------------------------------------------------
6 # OPTIONS
7 #
8 # Note that if you set the options via the command line, they will be
9 # remembered in the file 'options.cache'. It's a feature ;-)
10
11 opts = Options(['options.cache', 'config.py'])
12 #print "PLATFORM = ",platform.system()
13
14 if platform.system()=="Windows":
15 default_tcl_lib = "tcl84"
16 default_tk_lib = "tk84"
17 default_tktable_lib = "Tktable28"
18 default_install_assets = "glade/"
19 icon_extension = '.png'
20 default_tcl = "c:\\Tcl"
21 if os.environ.get('MSYSTEM')=="MINGW32":
22 default_tcl_libpath="$TCL\\bin"
23 else:
24 default_tcl_libpath="$TCL\\lib"
25 default_rel_distdir = '.'
26 default_absolute_paths = False
27
28 default_ida_prefix = "c:\\MinGW"
29 if not os.path.exists(default_ida_prefix):
30 default_ida_prefix = None
31
32 default_conopt_prefix = "c:\\MinGW"
33 if not os.path.exists(default_conopt_prefix):
34 default_conopt_prefix = None
35
36 need_libm = False
37 python_exe = "c:\\Python24\\python.exe"
38 else:
39 default_tcl_lib = "tcl8.4"
40 default_tk_lib = "tk8.4"
41 default_tktable_lib = "Tktable2.8"
42 default_install_assets = "$INSTALL_ASCDATA/glade/"
43 icon_extension = '.svg'
44 default_tcl = '/usr'
45 default_tcl_libpath = "$TCL/lib"
46 default_rel_distdir = '../share/ascend'
47 default_absolute_paths = True
48 default_ida_prefix="/usr/local"
49 default_conopt_prefix="/usr"
50 need_libm = True
51 if not os.path.isdir(default_tcl):
52 default_tcl = '/usr'
53 python_exe = distutils.sysconfig.EXEC_PREFIX+"/bin/python"
54
55 opts.Add(
56 'CC'
57 ,'C Compiler command'
58 ,None
59 )
60
61 opts.Add(
62 'CXX'
63 ,'C++ Compiler command'
64 ,None
65 )
66
67 opts.Add(BoolOption(
68 'GCOV'
69 , 'Whether to enable coverage testing in object code'
70 , False
71 ))
72
73 # Package linking option
74 opts.Add(EnumOption(
75 'PACKAGE_LINKING'
76 , 'Style of linking for external libraries'
77 , 'DYNAMIC_PACKAGES'
78 , ['DYNAMIC_PACKAGES', 'STATIC_PACKAGES', 'NO_PACKAGES']
79 ))
80
81 opts.Add(BoolOption(
82 'WITH_GCCVISIBILITY'
83 ,"Whether to use GCC Visibility features (only applicable if available)"
84 ,True
85 ))
86
87 # You can turn off building of Tcl/Tk interface
88 opts.Add(BoolOption(
89 'WITH_TCLTK'
90 ,"Set to False if you don't want to build the original Tcl/Tk GUI."
91 , True
92 ))
93
94 # You can turn off the building of the Python interface
95 opts.Add(BoolOption(
96 'WITH_PYTHON'
97 ,"Set to False if you don't want to build Python wrappers."
98 , True
99 ))
100
101 # Which solvers will we allow?
102 opts.Add(ListOption(
103 'WITH_SOLVERS'
104 ,"List of the solvers you want to build. The default is the minimum that"
105 +" works."
106 ,["QRSLV","CMSLV","LSOD","IDA","CONOPT","LRSLV"]
107 ,['QRSLV','MPS','SLV','OPTSQP'
108 ,'NGSLV','CMSLV','LRSLV','MINOS','CONOPT'
109 ,'LSOD','OPTSQP',"IDA"
110 ]
111 ))
112
113 # Where will the local copy of the help files be kept?
114 opts.Add(PackageOption(
115 'WITH_LOCAL_HELP'
116 , "Directory containing the local copy of the help files (optional)"
117 , "no"
118 ))
119
120 # Will bintoken support be enabled?
121 opts.Add(BoolOption(
122 'WITH_BINTOKEN'
123 ,"Enable bintoken support? This means compiling models as C-code before"
124 +" running them, to increase solving speed for large models."
125 ,False
126 ))
127
128 # What should the default ASCENDLIBRARY path be?
129 # Note: users can change it by editing their ~/.ascend.ini
130 opts.Add(
131 'DEFAULT_ASCENDLIBRARY'
132 ,"Set the default value of the ASCENDLIBRARY -- the location where"
133 +" ASCEND will look for models when running ASCEND"
134 ,"$INSTALL_ASCDATA/models"
135 )
136
137 # Where is SWIG?
138 opts.Add(
139 'SWIG'
140 ,"SWIG location, probably only required for MinGW and MSVC users."
141 +" Enter the location as a Windows-style path, for example"
142 +" 'c:\\msys\\1.0\\home\\john\\swigwin-1.3.29\\swig.exe'."
143 )
144
145 # Build the test suite?
146 opts.Add(BoolOption(
147 'WITH_CUNIT'
148 ,"You can disable CUnit tests with this option. This will basically stop"
149 +" SCons from parsing the SConscript files relating to the 'test'"
150 +" target, which just might make things marginally faster. Probably"
151 +" you can just ignore this option though. SCons will sniff for Cunit"
152 +" but build the tests only if you specify the 'test' target."
153 ,True
154 ))
155
156 # Where are the CUnit includes?
157 opts.Add(PackageOption(
158 'CUNIT_CPPPATH'
159 ,"Where are your CUnit include files?"
160 ,'off'
161 ))
162
163 # Where are the CUnit libraries?
164 opts.Add(PackageOption(
165 'CUNIT_LIBPATH'
166 ,"Where are your CUnit libraries?"
167 ,'off'
168 ))
169
170 opts.Add(PackageOption(
171 "IDA_PREFIX"
172 ,"Prefix for your IDA install (IDA ./configure --prefix)"
173 ,default_ida_prefix
174 ))
175
176 opts.Add(
177 "IDA_LIB"
178 ,"Libraries linked to for IDA"
179 ,['sundials_ida','sundials_nvecserial','m']
180 )
181
182 opts.Add(
183 'IDA_CPPPATH'
184 ,"Where is your ida.h?"
185 ,"$IDA_PREFIX/include"
186 )
187
188 opts.Add(
189 'IDA_LIBPATH'
190 ,"Where are your SUNDIALS libraries installed?"
191 ,"$IDA_PREFIX/lib"
192 )
193
194 # conopt
195
196 opts.Add(PackageOption(
197 "CONOPT_PREFIX"
198 ,"Prefix for your CONOPT install (CONOPT ./configure --prefix)"
199 ,default_ida_prefix
200 ))
201
202 opts.Add(
203 "CONOPT_LIB"
204 ,"Library linked to for CONOPT"
205 ,'consub3'
206 )
207
208 opts.Add(
209 'CONOPT_CPPPATH'
210 ,"Where is your conopt.h?"
211 ,"$CONOPT_PREFIX/include"
212 )
213
214 opts.Add(
215 'CONOPT_LIBPATH'
216 ,"Where is your CONOPT libraries installed?"
217 ,"$CONOPT_PREFIX/lib"
218 )
219
220 opts.Add(
221 "F2C_LIB"
222 ,"F2C library (eg. g2c, gfortran, f2c)"
223 ,"g2c"
224 )
225
226 opts.Add(PackageOption(
227 "F2C_LIBPATH"
228 ,"Directory containing F2C library (i.e. g2c, gfortran, f2c, etc.), if not already accessible"
229 ,"off"
230 ))
231
232 opts.Add(
233 'TCL'
234 ,'Base of Tcl distribution'
235 ,default_tcl
236 )
237
238 # Where are the Tcl includes?
239 opts.Add(
240 'TCL_CPPPATH'
241 ,"Where are your Tcl include files?"
242 ,"$TCL/include"
243 )
244
245 # Where are the Tcl libs?
246 opts.Add(
247 'TCL_LIBPATH'
248 ,"Where are your Tcl libraries?"
249 ,default_tcl_libpath
250 )
251
252 # What is the name of the Tcl lib?
253 opts.Add(
254 'TCL_LIB'
255 ,"Name of Tcl lib (eg 'tcl' or 'tcl83'), for full path to static library (if STATIC_TCLTK is set)"
256 ,default_tcl_lib
257 )
258
259 # Where are the Tk includes?
260 opts.Add(
261 'TK_CPPPATH'
262 ,"Where are your Tk include files?"
263 ,'$TCL_CPPPATH'
264 )
265
266 # Where are the Tk libs?
267 opts.Add(
268 'TK_LIBPATH'
269 ,"Where are your Tk libraries?"
270 ,'$TCL_LIBPATH'
271 )
272
273 # What is the name of the Tk lib?
274 opts.Add(
275 'TK_LIB'
276 ,"Name of Tk lib (eg 'tk' or 'tk83'), or full path to static library"
277 ,default_tk_lib
278 )
279
280 # Static linking to TkTable
281
282 opts.Add(BoolOption(
283 'STATIC_TCLTK'
284 ,'Set true for static linking for Tcl/Tk and TkTable. EXPERIMENTAL'
285 ,False
286 ))
287
288 opts.Add(
289 'TKTABLE_LIBPATH'
290 ,'Location of TkTable static library'
291 ,'$TCL_LIBPATH/Tktable2.8'
292 )
293
294 opts.Add(
295 'TKTABLE_LIB'
296 ,'Stem name of TkTable (eg tktable2.8, no ".so" or "lib") shared library, or full path of static tktable (/usr/lib/...)'
297 ,default_tktable_lib
298 )
299
300 opts.Add(
301 'TKTABLE_CPPPATH'
302 ,'Location of TkTable header file'
303 ,'$TCL_CPPPATH'
304 )
305
306 opts.Add(
307 'X11'
308 ,'Base X11 directory. Only used when STATIC_TCLTK is turned on. EXPERIMENTAL'
309 ,'/usr/X11R6'
310 )
311
312 opts.Add(
313 'X11_LIBPATH'
314 ,'Location of X11 lib. EXPERIMENTAL'
315 ,'$X11/lib'
316 )
317
318 opts.Add(
319 'X11_CPPPATH'
320 ,'Location of X11 includes. EXPERIMENTAL'
321 ,'$X11/include'
322 )
323
324 opts.Add(
325 'X11_LIB'
326 ,'Name of X11 lib. EXPERIMENTAL'
327 ,'X11'
328 )
329
330 opts.Add(
331 'INSTALL_PREFIX'
332 ,'Root location for installed files'
333 ,'/usr/local'
334 )
335
336 opts.Add(
337 'INSTALL_BIN'
338 ,'Location to put binaries during installation'
339 ,"$INSTALL_PREFIX/bin"
340 )
341
342 opts.Add(
343 'INSTALL_LIB'
344 ,'Location to put libraries during installation'
345 ,"$INSTALL_PREFIX/lib"
346 )
347
348 opts.Add(
349 'INSTALL_SHARE'
350 ,'Common shared-file location on this system'
351 ,"$INSTALL_PREFIX/share"
352 )
353
354
355 opts.Add(
356 'INSTALL_ASCDATA'
357 ,"Location of ASCEND shared data (TK, python, models etc)"
358 ,"$INSTALL_SHARE/ascend"
359 )
360
361 opts.Add(
362 'INSTALL_INCLUDE'
363 ,'Location to put header files during installation'
364 ,"$INSTALL_PREFIX/include"
365 )
366
367 opts.Add(
368 'PYGTK_ASSETS'
369 ,'Default location for Glade assets (placed in pygtk/config.py)'
370 ,default_install_assets
371 )
372
373 opts.Add(BoolOption(
374 'DEBUG'
375 ,"Compile source with debugger symbols, eg for use with 'gdb'"
376 ,False
377 ))
378
379 opts.Add(BoolOption(
380 'MALLOC_DEBUG'
381 ,"Compile with debugging version of MALLOC. Required for full CUnit testing"
382 ,False
383 ))
384
385 opts.Add(
386 'INSTALL_ROOT'
387 ,'For use by RPM only: location of %{buildroot} during rpmbuild'
388 ,""
389 )
390
391 opts.Add(
392 'DISTTAR_NAME'
393 ,"Stem name of the tarball created by 'scons dist'. So for 'ascend-aaa.tar.bz2', set this to 'ascend-aaa'."
394 ,"ascend-"+version
395 )
396
397 opts.Add(
398 'RELEASE'
399 ,"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."
400 ,"0"
401 )
402
403 opts.Add(BoolOption(
404 'ABSOLUTE_PATHS'
405 ,"Whether to use absolute or relative paths in the installed Tcl/Tk interface. If you want to build an RPM, set this to false."
406 ,default_absolute_paths
407 ))
408
409 opts.Add(
410 'WIN_INSTALLER_NAME'
411 ,"Name of the installer .exe to create under Windows (minus the '.exe')"
412 ,"ascend-"+version
413 )
414
415 opts.Add(BoolOption(
416 'WITH_XTERM_COLORS'
417 ,"Set to 0 if you don't want xterm colour codes in the console output"
418 ,True
419 ))
420
421 opts.Add(BoolOption(
422 'WITH_EXTFNS'
423 ,"Set to 0 if you don't want to attempt to build external modules bundled"
424 + " with ASCEND."
425 ,True
426 ))
427
428 if platform.system()!="Windows":
429 opts.Add(BoolOption(
430 'WITH_GCCVISIBILITY'
431 , 'Whether to use GCC Visibility extensions when building with GCC 4.0'
432 , True
433 ))
434
435 # TODO: OTHER OPTIONS?
436 # TODO: flags for optimisation
437 # TODO: turning on/off bintoken functionality
438 # TODO: Where will the 'Makefile.bt' file be installed?
439
440 # Import the outside environment
441
442 if os.environ.get('OSTYPE')=='msys':
443 env = Environment(
444 ENV=os.environ
445 , tools=['mingw','lex','yacc','fortran','swig','disttar','nsis','doxygen']
446 , toolpath=['scons']
447 )
448 env['IS_MINGW']=True
449
450 elif platform.system()=="Windows":
451 env = Environment(
452 ENV={
453 'PATH':os.environ['PATH']
454 ,'INCLUDE':os.environ['INCLUDE']
455 ,'LIB':os.environ['LIB']
456 ,'MSVS_IGNORE_IDE_PATHS':1
457 }
458 , tools = ['default','lex','yacc','fortran','swig','disttar','nsis','doxygen']
459 , toolpath = ['scons']
460 )
461 env.Append(CPPDEFINES=['_CRT_SECURE_NO_DEPRECATE'])
462 else:
463 env = Environment(
464 ENV=os.environ
465 , tools=['default','lex','yacc','fortran','swig','disttar','nsis','doxygen']
466 , toolpath=['scons']
467 )
468
469 opts.Update(env)
470 opts.Save('options.cache',env)
471
472 Help(opts.GenerateHelpText(env))
473
474 with_tcltk = env.get('WITH_TCLTK')
475 without_tcltk_reason = "disabled by options/config.py"
476
477 with_python = env.get('WITH_PYTHON')
478 without_python_reason = "disabled by options/config.py"
479
480 with_cunit = env.get('WITH_CUNIT')
481 without_cunit_reason = "not requested"
482
483 with_extfns = env.get('WITH_EXTFNS')
484 without_extfn_reason = "disabled by options/config.py"
485
486 if platform.system()=="Windows":
487 with_installer=1
488 else:
489 with_installer=0
490 without_installer_reason = "only possible under Windows"
491
492 if 'LSOD' in env['WITH_SOLVERS']:
493 with_lsode=True
494 else:
495 with_lsode=False
496 without_lsode_reason = "not requested (WITH_SOLVERS)"
497
498 if 'IDA' in env['WITH_SOLVERS']:
499 with_ida=True
500 else:
501 with_ida=False
502 without_ida_reason = "not requested (WITH_SOLVERS)"
503
504
505 if 'CONOPT' in env['WITH_SOLVERS']:
506 with_conopt=True
507 else:
508 with_conopt=False
509 without_conopt_reason = "not requested (WITH_SOLVERS)"
510
511
512 #print "SOLVERS:",env['WITH_SOLVERS']
513 #print "WITH_BINTOKEN:",env['WITH_BINTOKEN']
514 #print "DEFAULT_ASCENDLIBRARY:",env['DEFAULT_ASCENDLIBRARY']
515
516 can_install = True
517 if platform.system()=='Windows':
518 can_install = False
519
520 env['CAN_INSTALL']=can_install
521
522 env['INSTALL_MODELS']=env['INSTALL_ASCDATA']+"/models/"
523
524 print "TCL_CPPPATH =",env['TCL_CPPPATH']
525 print "TCL_LIBPATH =",env['TCL_LIBPATH']
526 print "TCL_LIB =",env['TCL_LIB']
527 print "CC =",env['CC']
528 print "CXX =",env['CXX']
529 print "FORTRAN=",env.get('FORTRAN')
530
531 print "ABSOLUTE PATHS =",env['ABSOLUTE_PATHS']
532 #------------------------------------------------------
533 # SPECIAL CONFIGURATION TESTS
534
535 need_fortran = False
536
537 #----------------
538 # SWIG
539
540 import os,re
541
542 def get_swig_version(env):
543 cmd = env['SWIG']+' -version'
544 (cin,coutcerr) = os.popen4(cmd)
545 output = coutcerr.read()
546
547 restr = "SWIG\\s+Version\\s+(?P<maj>[0-9]+)\\.(?P<min>[0-9]+)\\.(?P<pat>[0-9]+)\\s*$"
548 expr = re.compile(restr,re.M);
549 m = expr.search(output);
550 if not m:
551 return None
552 maj = int(m.group('maj'))
553 min = int(m.group('min'))
554 pat = int(m.group('pat'))
555
556 return (maj,min,pat)
557
558
559 def CheckSwigVersion(context):
560
561 try:
562 context.Message("Checking version of SWIG... ")
563 maj,min,pat = get_swig_version(context.env)
564 except:
565 context.Result("Failed to detect version, or failed to run SWIG")
566 return 0;
567
568 context.env['SWIGVERSION']=tuple([maj,min,pat])
569
570 if maj == 1 and (
571 min > 3
572 or (min == 3 and pat >= 24)
573 ):
574 context.Result("ok, %d.%d.%d" % (maj,min,pat))
575 return 1;
576 else:
577 context.Result("too old, %d.%d.%d" % (maj,min,pat))
578 return 0;
579
580 #----------------
581 # General purpose library-and-header test
582
583 class KeepContext:
584 def __init__(self,context,varprefix,static=False):
585 self.keep = {}
586 for k in ['LIBS','LIBPATH','CPPPATH','LINKFLAGS']:
587 #print "Keeping env %s = %s" % (k,context.env.get(k))
588 self.keep[k]=context.env.get(k)
589
590 if context.env.has_key(varprefix+'_CPPPATH'):
591 context.env.AppendUnique(CPPPATH=[env[varprefix+'_CPPPATH']])
592 #print "Adding '"+str(cpppath_add)+"' to cpp path"
593
594 if static:
595 staticlib=env[varprefix+'_LIB']
596 #print "STATIC LIB = ",staticlib
597 context.env.Append(
598 LINKFLAGS=[staticlib]
599 )
600 else:
601 if context.env.has_key(varprefix+'_LIBPATH'):
602 context.env.Append(LIBPATH=[env[varprefix+'_LIBPATH']])
603 #print "Adding '"+str(libpath_add)+"' to lib path"
604
605 if context.env.has_key(varprefix+'_LIB'):
606 context.env.Append(LIBS=[env[varprefix+'_LIB']])
607 #print "Adding '"+str(env[varprefix+'_LIB'])+"' to libs"
608
609 def restore(self,context):
610 #print "RESTORING CONTEXT"
611 #print self.keep
612 #print "..."
613 for k in self.keep:
614 if self.keep[k]==None:
615 if context.env.has_key(k):
616 #print "Clearing "+str(k)
617 del context.env[k];
618 else:
619 #print "Restoring %s to '%s'" %(k,self.keep.get(k))
620 context.env[k]=self.keep[k];
621
622 def CheckExtLib(context,libname,text,ext='.c',varprefix=None,static=False):
623 """This method will check for variables LIBNAME_LIBPATH
624 and LIBNAME_CPPPATH and try to compile and link the
625 file with the provided text, linking with the
626 library libname."""
627
628 if static:
629 context.Message( 'Checking for static '+libname+'... ' )
630 else:
631 context.Message( 'Checking for '+libname+'... ' )
632
633 if varprefix==None:
634 varprefix = libname.upper()
635
636 #print "LIBS is currently:",context.env.get('LIBS')
637 keep = KeepContext(context,varprefix,static)
638
639 if not context.env.has_key(varprefix+'_LIB'):
640 # if varprefix_LIB were in env, KeepContext would
641 # have appended it already
642 context.env.Append(LIBS=[libname])
643
644 is_ok = context.TryLink(text,ext)
645
646 #print "Link success? ",(is_ok != 0)
647
648 keep.restore(context)
649
650 # print "Restored CPPPATH="+str(context.env['CPPPATH'])
651 # print "Restored LIBS="+str(context.env['LIBS'])
652 # print "Restored LIBPATH="+str(context.env['LIBPATH'])
653
654 context.Result(is_ok)
655 return is_ok
656
657 #----------------
658 # GCC
659
660 gcc_test_text = """
661 #ifndef __GNUC__
662 # error "Not using GCC"
663 #endif
664
665 int main(void){
666 return __GNUC__;
667 }
668 """
669
670 def CheckGcc(context):
671 context.Message("Checking for GCC... ")
672 is_ok = context.TryCompile(gcc_test_text,".c")
673 context.Result(is_ok)
674 return is_ok
675
676 #----------------
677 # GCC VISIBILITY feature
678
679 gccvisibility_test_text = """
680 #if __GNUC__ < 4
681 # error "Require GCC version 4 or newer"
682 #endif
683
684 __attribute__ ((visibility("default"))) int x;
685
686 int main(void){
687 extern int x;
688 x = 4;
689 }
690 """
691
692 def CheckGccVisibility(context):
693 context.Message("Checking for GCC 'visibility' capability... ")
694 if not context.env.has_key('WITH_GCCVISIBILITY') or not env['WITH_GCCVISIBILITY']:
695 context.Result("disabled")
696 return 0
697 is_ok = context.TryCompile(gccvisibility_test_text,".c")
698 context.Result(is_ok)
699 return is_ok
700
701 #----------------
702 # YACC
703
704 yacc_test_text = """
705 %{
706 #include <stdio.h>
707
708 /* MSVC++ needs this before it can swallow Bison output */
709 #ifdef _MSC_VER
710 # define __STDC__
711 #endif
712 %}
713 %token MSG
714 %start ROOT
715 %%
716 ROOT:
717 MSG { printf("HELLO"); }
718 ;
719 %%
720 """
721
722 def CheckYacc(context):
723 context.Message("Checking for Yacc ('%s')... " % context.env.get('YACC'))
724 is_ok = context.TryCompile(yacc_test_text,".y")
725 context.Result(is_ok)
726 return is_ok
727
728 #----------------
729 # CUnit test
730
731 cunit_test_text = """
732 #include <CUnit/CUnit.h>
733 int maxi(int i1, int i2){
734 return (i1 > i2) ? i1 : i2;
735 }
736
737 void test_maxi(void){
738 CU_ASSERT(maxi(0,2) == 2);
739 CU_ASSERT(maxi(0,-2) == 0);
740 CU_ASSERT(maxi(2,2) == 2);
741
742 }
743 int main(void){
744 /* CU_initialize_registry() */
745 return 0;
746 }
747 """
748
749 def CheckCUnit(context):
750 return CheckExtLib(context,'cunit',cunit_test_text)
751
752 #----------------
753 # MATH test
754
755 math_test_text = """
756 #ifndef _ALL_SOURCE
757 # define _ALL_SOURCE
758 #endif
759 #ifndef _XOPEN_SOURCE
760 # define _XOPEN_SOURCE
761 #endif
762 #ifndef _XOPEN_SOURCE_EXTENDED
763 # define _XOPEN_SOURCE_EXTENDED 1
764 #endif
765 #include <math.h>
766 int main(void){
767 double x = 1.0; double y = 1.0; int i = 1;
768 acosh(x); asinh(x); atanh(x); cbrt(x); expm1(x); erf(x); erfc(x); isnan(x);
769 j0(x); j1(x); jn(i,x); ilogb(x); logb(x); log1p(x); rint(x);
770 y0(x); y1(x); yn(i,x);
771 #ifdef _THREAD_SAFE
772 gamma_r(x,&i);
773 lgamma_r(x,&i);
774 #else
775 gamma(x);
776 lgamma(x);
777 #endif
778 hypot(x,y); nextafter(x,y); remainder(x,y); scalb(x,y);
779 return 0;
780 }
781 """
782
783 def CheckMath(context):
784 context.Message('Checking for IEE math library... ')
785 libsave=context.env.get('LIBS');
786 context.env.AppendUnique(LIBS=['m'])
787 is_ok=context.TryLink(math_test_text,".c")
788 context.Result(is_ok)
789 if not is_ok:
790 context.env['LIBS']=libsave
791 return is_ok
792
793 #----------------
794 # IDA test
795
796 ida_test_text = """
797 #include <ida/ida.h>
798 #include <nvector/nvector_serial.h>
799 #include <ida/ida_spgmr.h>
800 int main(){
801 void *ida_mem;
802 ida_mem = IDACreate();
803 return 0;
804 }
805 """
806
807 def CheckIDA(context):
808 context.Message( 'Checking for IDA (SUNDIALS)... ' )
809
810 keep = KeepContext(context,"IDA")
811
812 is_ok = context.TryLink(ida_test_text,".c")
813 context.Result(is_ok)
814
815 keep.restore(context)
816
817 return is_ok
818
819 #----------------
820 # CONOPT test
821
822 conopt_test_text = """
823 #define FNAME_LCASE_DECOR
824 #include <conopt.h>
825 #include <stdlib.h>
826 int main(){
827 int s, *v, e;
828 s = COIDEF_Size();
829 v = (int *)malloc(s*sizeof(int));
830 e = COIDEF_Ini(v);
831 return e;
832 }
833 """
834
835 def CheckCONOPT(context):
836 context.Message( 'Checking for CONOPT... ' )
837
838 keep = KeepContext(context,"CONOPT")
839
840 is_ok = context.TryLink(conopt_test_text,".c")
841 context.Result(is_ok)
842
843 keep.restore(context)
844
845 return is_ok
846
847 #----------------
848 # Tcl test
849
850 # TCL and TK required version 8.1, 8.2, 8.3, or 8.4:
851 tcltk_minor_newest_acceptable = 4
852 tcltk_major_required = 8
853
854 tcl_check_text = r"""
855 #include <tcl.h>
856 #include <stdio.h>
857 int main(void){
858 printf("%s",TCL_PATCH_LEVEL);
859 return 0;
860 }
861 """
862
863 def CheckTcl(context):
864 return CheckExtLib(context,'tcl',tcl_check_text,static=env['STATIC_TCLTK'])
865
866 def CheckTclVersion(context):
867 keep = KeepContext(context,'TCL',static=env['STATIC_TCLTK'])
868 context.Message("Checking Tcl version... ")
869 (is_ok,output) = context.TryRun(tcl_check_text,'.c')
870 keep.restore(context)
871 if not is_ok:
872 context.Result("failed to run check")
873 return 0
874
875 major,minor,patch = tuple([int(i) for i in output.split(".")])
876 if major != tcltk_major_required or minor > tcltk_minor_newest_acceptable:
877 context.Result(output+" (bad version)")
878 # bad version
879 return 0
880
881 # good version
882 context.Result(output+", good")
883 return 1
884
885 #----------------
886 # Tk test
887
888 tk_check_text = r"""
889 #include <tk.h>
890 #include <stdio.h>
891 int main(void){
892 printf("%s",TK_PATCH_LEVEL);
893 return 0;
894 }
895 """
896 def CheckTk(context):
897 return CheckExtLib(context,'tk',tk_check_text,static=env['STATIC_TCLTK'])
898
899
900 def CheckTkVersion(context):
901 keep = KeepContext(context,'TK',static=context.env['STATIC_TCLTK'])
902 context.Message("Checking Tk version... ")
903 #print "LINKFLAGS =",context.env['LINKFLAGS']
904 (is_ok,output) = context.TryRun(tk_check_text,'.c')
905 keep.restore(context)
906 if not is_ok:
907 context.Result("failed to run check")
908 return 0
909
910 major,minor,patch = tuple([int(i) for i in output.split(".")])
911 if major != tcltk_major_required or minor > tcltk_minor_newest_acceptable:
912 # bad version
913 context.Result(output+" (bad version)")
914 return 0
915
916 # good version
917 context.Result(output+" (good)")
918 return 1
919
920 #----------------
921 # Tktable test
922
923 tktable_check_text = r"""
924 #include <tkTable.h>
925 #include <stdio.h>
926 int main(void){
927 Table mytable;
928 return 0;
929 }
930 """
931
932 def CheckTkTable(context):
933 return CheckExtLib(context,'tktable',tktable_check_text,static=env['STATIC_TCLTK'])
934
935 #---------------
936 # X11 test
937
938 x11_check_text = r"""
939 #include <X11/Xlib.h>
940 #include <X11/IntrinsicP.h>
941 #include <X11/Intrinsic.h>
942 #include <X11/ObjectP.h>
943 #include <X11/Object.h>
944 int main(void){
945 Object mything;
946 return 0;
947 }
948 """
949
950 def CheckX11(context):
951 return CheckExtLib(context,'X11',x11_check_text)
952
953 #----------------
954 # GCC Version sniffing
955
956 # TODO FIXME
957
958 gcc_version4 = False
959
960 #------------------------------------------------------
961 # CONFIGURATION
962
963 conf = Configure(env
964 , custom_tests = {
965 'CheckMath' : CheckMath
966 , 'CheckSwigVersion' : CheckSwigVersion
967 , 'CheckCUnit' : CheckCUnit
968 , 'CheckTcl' : CheckTcl
969 , 'CheckTclVersion' : CheckTclVersion
970 , 'CheckTk' : CheckTk
971 , 'CheckTkVersion' : CheckTkVersion
972 , 'CheckGcc' : CheckGcc
973 , 'CheckGccVisibility' : CheckGccVisibility
974 , 'CheckYacc' : CheckYacc
975 , 'CheckTkTable' : CheckTkTable
976 , 'CheckX11' : CheckX11
977 , 'CheckIDA' : CheckIDA
978 , 'CheckCONOPT' : CheckCONOPT
979 # , 'CheckIsNan' : CheckIsNan
980 # , 'CheckCppUnitConfig' : CheckCppUnitConfig
981 }
982 # , config_h = "config.h"
983 )
984
985 # stdio -- just to check that compiler is behaving
986
987 if not conf.CheckHeader('stdio.h'):
988 print "Did not find 'stdio.h'! Check your compiler configuration."
989 Exit(1)
990
991 # Math library
992
993 if need_libm:
994 if not conf.CheckMath():
995 print 'Did not find math library, exiting!'
996 Exit(1)
997 #pass
998
999 # Where is 'isnan'?
1000
1001 if not conf.CheckFunc('isnan') and not conf.CheckFunc('_isnan'):
1002 print "Didn't find isnan"
1003 # Exit(1)
1004
1005 # GCC visibility
1006
1007 if conf.CheckGcc():
1008 conf.env['HAVE_GCC']=True;
1009 if env['WITH_GCCVISIBILITY'] and conf.CheckGccVisibility():
1010 conf.env['HAVE_GCCVISIBILITY']=True;
1011 conf.env.Append(CCFLAGS=['-fvisibility=hidden'])
1012 conf.env.Append(CPPDEFINES=['HAVE_GCCVISIBILITY'])
1013 conf.env.Append(CCFLAGS=['-Wall'])
1014
1015 # YACC
1016
1017 if not conf.CheckYacc():
1018 print "YACC NOT FOUND OR NOT WORKING"
1019 else:
1020 conf.env['HAVE_YACC']=True
1021
1022 conf.env['HAVE_LEX']=True
1023
1024 # Tcl/Tk
1025
1026 if with_tcltk:
1027 if conf.CheckTcl():
1028 if conf.CheckTclVersion():
1029 if conf.CheckTk():
1030 if with_tcltk and conf.CheckTkVersion():
1031 if env['STATIC_TCLTK']:
1032 if conf.CheckTkTable():
1033 pass
1034 else:
1035 without_tcltk_reason = "TkTable not found"
1036 with_tcltk = False
1037 else:
1038 without_tcltk_reason = "Require Tk version <= 8.4. See 'scons -h'"
1039 with_tcltk = False
1040 else:
1041 without_tcltk_reason = "Tk not found."
1042 with_tcltk = False
1043 else:
1044 without_tcltk_reason = "Require Tcl <= 8.4 Tcl."
1045 with_tcltk = False
1046
1047 else:
1048 without_tcltk_reason = "Tcl not found."
1049 with_tcltk = False
1050
1051 if env['STATIC_TCLTK']:
1052 conf.CheckX11()
1053
1054 # Python... obviously we're already running python, so we just need to
1055 # check that we can link to the python library OK:
1056
1057 if platform.system()=="Windows":
1058 python_lib='python24'
1059 else:
1060 python_lib='python2.4'
1061
1062 # SWIG version
1063
1064 if not conf.CheckSwigVersion():
1065 without_python_reason = 'SWIG >= 1.3.24 is required'
1066 with_python = False
1067
1068 # CUnit
1069
1070 if with_cunit:
1071 if not conf.CheckCUnit():
1072 without_cunit_reason = 'CUnit not found'
1073 with_cunit = False
1074 #print "CUNIT NOT FOUND, LIBS=",conf.env.get('LIBS')
1075
1076 # IDA
1077
1078 if not with_ida:
1079 without_ida_reason = "Not selected (see config option WITH_SOLVERS)"
1080 elif not conf.CheckIDA():
1081 with_ida = False
1082 without_ida_reason = "IDA not found"
1083
1084 # IDA
1085
1086 if not with_conopt:
1087 without_conopt_reason = "Not selected (see config option WITH_SOLVERS)"
1088 elif not conf.CheckCONOPT():
1089 with_ida = False
1090 without_ida_reason = "CONOPT not found"
1091
1092 # BLAS
1093
1094 need_blas=False
1095
1096 if with_lsode:
1097 need_fortran = True
1098 need_blas=True
1099
1100 if need_blas:
1101 if conf.CheckLib('blas'):
1102 with_local_blas = False
1103 without_local_blas_reason = "Found BLAS installed on system"
1104 else:
1105 with_local_blas = True
1106 need_fortran = True
1107 else:
1108 with_local_blas= False;
1109 without_local_blas_reason = "BLAS not required"
1110
1111 # FORTRAN
1112
1113 if need_fortran:
1114 conf.env.Tool('fortran')
1115 detect_fortran = conf.env.Detect(['g77','f77','gfortran'])
1116 if detect_fortran:
1117 # For some reason, g77 doesn't get detected properly on MinGW
1118 if not env.has_key('F77') and not env.has_key('FORTRAN'):
1119 conf.env.Replace(F77=detect_fortran)
1120 conf.env.Replace(F77COM='$F77 $F77FLAGS -c -o $TARGET $SOURCE')
1121 conf.env.Replace(F77FLAGS='')
1122 #print "F77:",conf.env['F77']
1123 #print "F77COM:",conf.env['F77COM']
1124 #print "F77FLAGS:",conf.env['F77FLAGS']
1125 fortran_builder = Builder(
1126 action='$F77COM'
1127 , suffix='.o'
1128 , src_suffix='.f'
1129 )
1130 conf.env.Append(BUILDERS={'Fortran':fortran_builder})
1131 else:
1132 with_lsode=False;
1133 without_lsode_reason="FORTRAN-77 required but not found"
1134
1135 #else:
1136 # print "FORTRAN not required"
1137
1138 # F2C
1139
1140 if need_fortran:
1141 if platform.system()=="Windows":
1142 conf.env.Append(LIBPATH='c:\mingw\lib')
1143
1144
1145 # TODO: -D_HPUX_SOURCE is needed
1146
1147 # TODO: check size of void*
1148
1149 # TODO: detect if dynamic libraries are possible or not
1150
1151 if platform.system()=="Windows" and env.has_key('MSVS'):
1152 _found_windows_h = conf.CheckHeader('Windows.h')
1153
1154 if not _found_windows_h:
1155 print "Could not locate 'Windows.h' in CPPPATH. Check your configuration."
1156 Exit(1)
1157
1158 if with_python and not conf.CheckHeader(['basetsd.h','BaseTsd.h']):
1159 with_python = 0;
1160 without_python_reason = "Header file 'basetsd.h' not found. Install the MS Platform SDK."
1161
1162 conf.env.Append(CPPDEFINES=env['PACKAGE_LINKING'])
1163
1164 conf.Finish()
1165
1166 env.Append(PYTHON_LIBPATH=[distutils.sysconfig.PREFIX+"/libs"])
1167 env.Append(PYTHON_LIB=[python_lib])
1168 env.Append(PYTHON_CPPPATH=[distutils.sysconfig.get_python_inc()])
1169
1170 #---------------------------------------
1171 # SUBSTITUTION DICTIONARY for .in files
1172
1173 release = env.get('RELEASE')
1174 if release=="0.":
1175 release="0"
1176
1177 subst_dict = {
1178 '@DEFAULT_ASCENDLIBRARY@':env['DEFAULT_ASCENDLIBRARY']
1179 , '@GLADE_FILE@':'ascend.glade'
1180 , '@HELP_ROOT@':''
1181 , '@ICON_EXTENSION@':icon_extension
1182 , '@INSTALL_ASCDATA@':env['INSTALL_ASCDATA']
1183 , '@INSTALL_BIN@':env['INSTALL_BIN']
1184 , '@INSTALL_INCLUDE@':env['INSTALL_INCLUDE']
1185 , '@INSTALL_LIB@':env['INSTALL_LIB']
1186 , '@INSTALL_MODELS@':env['INSTALL_MODELS']
1187 , '@PYGTK_ASSETS@':env['PYGTK_ASSETS']
1188 , '@VERSION@':version
1189 , '@RELEASE@':release
1190 , '@DISTTAR_NAME@':env['DISTTAR_NAME']
1191 , '@WEBHELPROOT@':'http://pye.dyndns.org/ascend/manual/'
1192 , '@ASC_SHLIBSUFFIX@':env['SHLIBSUFFIX']
1193 , '@ASC_SHLIBPREFIX@':env['SHLIBPREFIX']
1194 , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'
1195 , '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir
1196 , '@PYTHON@' : python_exe
1197 }
1198
1199 if env.get('WITH_LOCAL_HELP'):
1200 print "WITH_LOCAL_HELP:",env['WITH_LOCAL_HELP']
1201 subst_dict['@HELP_ROOT@']=env['WITH_LOCAL_HELP']
1202
1203 # bool options...
1204 for k,v in {
1205 'ABSOLUTE_PATHS' : 'ASC_ABSOLUTE_PATHS'
1206 ,'WITH_XTERM_COLORS' : 'ASC_XTERM_COLORS'
1207 ,'MALLOC_DEBUG' : 'MALLOC_DEBUG'
1208 }.iteritems():
1209 if env.get(k):
1210 # subst_dict['@'+v+'@']='1'
1211 subst_dict["/\\* #define "+v+' @'+v+"@ \\*/"]='# define '+v+' 1 '
1212
1213 if with_ida:
1214 subst_dict["/\\* #define ASC_WITH_IDA @ASC_WITH_IDA@ \\*/"]='#define ASC_WITH_IDA '
1215
1216 if with_conopt:
1217 subst_dict["/\\* #define ASC_WITH_CONOPT @ASC_WITH_CONOPT@ \\*/"]='#define ASC_WITH_CONOPT '
1218
1219 if with_lsode:
1220 subst_dict["/\\* #define ASC_WITH_LSODE @ASC_WITH_LSODE@ \\*/"]='#define ASC_WITH_LSODE '
1221
1222 if with_python:
1223 subst_dict['@ASCXX_USE_PYTHON@']="1"
1224 env['WITH_PYTHON']=1;
1225
1226 if env.has_key('HAVE_GCCVISIBILITY'):
1227 subst_dict['@HAVE_GCCVISIBILITY@'] = "1"
1228
1229 env.Append(SUBST_DICT=subst_dict)
1230
1231 #------------------------------------------------------
1232 # RECIPE: SWIG scanner
1233
1234 import SCons.Script
1235
1236 SWIGScanner = SCons.Scanner.ClassicCPP(
1237 "SWIGScan"
1238 , ".i"
1239 , "CPPPATH"
1240 , '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
1241 )
1242
1243 env.Append(SCANNERS=[SWIGScanner])
1244
1245 #------------------------------------------------------
1246 # RECIPE: 'SubstInFile', used in pygtk SConscript
1247
1248 import re
1249 from SCons.Script import * # the usual scons stuff you get in a SConscript
1250
1251 def TOOL_SUBST(env):
1252 """Adds SubstInFile builder, which substitutes the keys->values of SUBST_DICT
1253 from the source to the target.
1254 The values of SUBST_DICT first have any construction variables expanded
1255 (its keys are not expanded).
1256 If a value of SUBST_DICT is a python callable function, it is called and
1257 the result is expanded as the value.
1258 If there's more than one source and more than one target, each target gets
1259 substituted from the corresponding source.
1260 """
1261 env.Append(TOOLS = 'SUBST')
1262 def do_subst_in_file(targetfile, sourcefile, dict):
1263 """Replace all instances of the keys of dict with their values.
1264 For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
1265 then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
1266 """
1267 try:
1268 f = open(sourcefile, 'rb')
1269 contents = f.read()
1270 f.close()
1271 except:
1272 raise SCons.Errors.UserError, "Can't read source file %s"%sourcefile
1273 for (k,v) in dict.items():
1274 contents = re.sub(k, v, contents)
1275 try:
1276 f = open(targetfile, 'wb')
1277 f.write(contents)
1278 f.close()
1279 except:
1280 raise SCons.Errors.UserError, "Can't write target file %s"%targetfile
1281 return 0 # success
1282
1283 def subst_in_file(target, source, env):
1284 if not env.has_key('SUBST_DICT'):
1285 raise SCons.Errors.UserError, "SubstInFile requires SUBST_DICT to be set."
1286 d = dict(env['SUBST_DICT']) # copy it
1287 for (k,v) in d.items():
1288 if callable(v):
1289 d[k] = env.subst(v())
1290 elif SCons.Util.is_String(v):
1291 d[k]=env.subst(v)
1292 else:
1293 raise SCons.Errors.UserError, "SubstInFile: key %s: %s must be a string or callable"%(k, repr(v))
1294 for (t,s) in zip(target, source):
1295 return do_subst_in_file(str(t), str(s), d)
1296
1297 def subst_in_file_string(target, source, env):
1298 """This is what gets printed on the console."""
1299 return '\n'.join(['Substituting vars from %s into %s'%(str(s), str(t))
1300 for (t,s) in zip(target, source)])
1301
1302 def subst_emitter(target, source, env):
1303 """Add dependency from substituted SUBST_DICT to target.
1304 Returns original target, source tuple unchanged.
1305 """
1306 d = env['SUBST_DICT'].copy() # copy it
1307 for (k,v) in d.items():
1308 if callable(v):
1309 d[k] = env.subst(v())
1310 elif SCons.Util.is_String(v):
1311 d[k]=env.subst(v)
1312 Depends(target, SCons.Node.Python.Value(d))
1313 return target, source
1314
1315 subst_action=SCons.Action.Action(subst_in_file, subst_in_file_string)
1316 env['BUILDERS']['SubstInFile'] = Builder(action=subst_action, emitter=subst_emitter)
1317
1318 TOOL_SUBST(env)
1319
1320 #------------------------------------------------------
1321 # Recipe for 'CHMOD' ACTION
1322
1323 import SCons
1324 from SCons.Script.SConscript import SConsEnvironment
1325 SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod,
1326 lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode))
1327
1328 def InstallPerm(env, dest, files, perm):
1329 obj = env.Install(dest, files)
1330 for i in obj:
1331 env.AddPostAction(i, env.Chmod(str(i), perm))
1332
1333 SConsEnvironment.InstallPerm = InstallPerm
1334
1335 # define wrappers
1336 SConsEnvironment.InstallProgram = lambda env, dest, files: InstallPerm(env, dest, files, 0755)
1337 SConsEnvironment.InstallHeader = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
1338 SConsEnvironment.InstallShared = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
1339
1340 #------------------------------------------------------
1341 # BUILD...
1342
1343 # so that #include <modulename/headername.h> works across all modules...
1344 env.AppendUnique(CPPPATH=['#base/generic'])
1345
1346 if env['DEBUG']:
1347 env.Append(CCFLAGS=['-g'])
1348
1349 if env['GCOV']:
1350 env.Append(
1351 CPPFLAGS=['-g','-fprofile-arcs','-ftest-coverage']
1352 , LIBS=['gcov']
1353 , LINKFLAGS=['-fprofile-arcs','-ftest-coverage']
1354 )
1355
1356 if with_ida:
1357 env.Append(WITH_IDA=1)
1358
1359 if with_conopt:
1360 env.Append(WITH_CONOPT=1)
1361
1362 #-------------
1363 # TCL/TK GUI
1364
1365 if with_tcltk:
1366 env.SConscript(['tcltk/generic/interface/SConscript'],'env')
1367 else:
1368 print "Skipping... Tcl/Tk GUI isn't being built:",without_tcltk_reason
1369
1370 #-------------
1371 # PYTHON INTERFACE
1372
1373 if with_python:
1374 env.SConscript(['pygtk/SConscript'],'env')
1375 else:
1376 print "Skipping... Python GUI isn't being built:",without_python_reason
1377
1378 #------------
1379 # BASE/GENERIC SUBDIRECTORIES
1380
1381 libascend_env = env.Copy()
1382
1383 dirs = ['general','utilities','compiler','solver','packages']
1384
1385 srcs = []
1386 for d in dirs:
1387 heresrcs = libascend_env.SConscript('base/generic/'+d+'/SConscript','libascend_env')
1388 srcs += heresrcs
1389
1390 #-------------
1391 # IMPORTED CODE: LSODE, BLAS, etc
1392
1393 if with_lsode:
1394 srcs += env.SConscript(['lsod/SConscript'],'env')
1395 srcs += env.SConscript(['linpack/SConscript'],'env')
1396 else:
1397 print "Skipping... LSODE won't be built:", without_lsode_reason
1398
1399 if with_local_blas:
1400 srcs += env.SConscript(['blas/SConscript'],'env')
1401 else:
1402 print "Skipping... BLAS won't be built:", without_local_blas_reason
1403
1404 if not with_ida:
1405 print "Skipping... IDA won't be built:", without_ida_reason
1406
1407 #-------------
1408 # LIBASCEND -- all base/generic functionality
1409
1410 libascend = libascend_env.SharedLibrary('ascend',srcs)
1411
1412 env.Alias('libascend',libascend)
1413
1414 #-------------
1415 # UNIT TESTS (C CODE)
1416
1417 if with_cunit:
1418 testdirs = ['general','solver','utilities']
1419 testsrcs = []
1420 for testdir in testdirs:
1421 path = 'base/generic/'+testdir+'/test/'
1422 env.SConscript([path+'SConscript'],'env')
1423 testsrcs += [i.path for i in env['TESTSRCS_'+testdir.upper()]]
1424
1425 #print "TESTSRCS =",testsrcs
1426
1427 env.SConscript(['test/SConscript'],'env')
1428 env.SConscript(['base/generic/test/SConscript'],'env')
1429
1430 env.Alias('test',[env.Dir('test'),env.Dir('base/generic/test')])
1431
1432 else:
1433 print "Skipping... CUnit tests aren't being built:",without_cunit_reason
1434
1435 #-------------
1436 # EXTERNAL FUNCTIONS
1437
1438 extfns = []
1439 if with_extfns:
1440 testdirs = ['johnpye/extfn']
1441 for testdir in testdirs:
1442 path = 'models/'+testdir+"/SConscript"
1443 extfns += env.SConscript(path,'env')
1444 else:
1445 print "Skipping... External modules aren't being built:",without_extfns_reason
1446
1447 env.Alias('extfns',extfns)
1448
1449 #------------------------------------------------------
1450 # CREATE ASCEND-CONFIG scriptlet
1451
1452 ascendconfig = env.SubstInFile('ascend-config.in')
1453
1454 #------------------------------------------------------
1455 # INSTALLATION
1456
1457 if env.get('CAN_INSTALL'):
1458 # the models directory only needs to be processed for installation, no other processing required.
1459 env.SConscript(['models/SConscript'],'env')
1460
1461 dirs = ['INSTALL_BIN','INSTALL_ASCDATA','INSTALL_LIB', 'INSTALL_INCLUDE']
1462 install_dirs = [env['INSTALL_ROOT']+env[d] for d in dirs]
1463
1464 # TODO: add install options
1465 env.Alias('install',install_dirs)
1466
1467 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_LIB'],libascend)
1468
1469 env.InstallProgram(env['INSTALL_ROOT']+env['INSTALL_BIN'],ascendconfig)
1470
1471 #------------------------------------------------------
1472 # WINDOWS INSTALLER
1473 # For the windows installer, please see pygtk/SConscript
1474
1475 if with_installer:
1476 pass
1477 else:
1478 print "Skipping... Windows installer isn't being built:",without_installer_reason
1479
1480 #------------------------------------------------------
1481 # PROJECT FILE for MSVC
1482
1483 env.SConscript(['base/msvc/SConscript'],['env','libascend']);
1484
1485 #------------------------------------------------------
1486 # CREATE the SPEC file for generation of RPM packages
1487
1488 if platform.system()=="Linux":
1489 env.SubstInFile('ascend.spec.in')
1490
1491 #------------------------------------------------------
1492 # DISTRIBUTION TAR FILE
1493
1494 env['DISTTAR_FORMAT']='bz2'
1495 env.Append(
1496 DISTTAR_EXCLUDEEXTS=['.o','.os','.so','.a','.dll','.cc','.cache','.pyc','.cvsignore','.dblite','.log','.pl']
1497 , DISTTAR_EXCLUDEDIRS=['CVS','.svn','.sconf_temp', 'dist']
1498 )
1499
1500 tar = env.DistTar("dist/"+env['DISTTAR_NAME']
1501 , [env.Dir('#')]
1502 )
1503
1504 env.Depends(tar,'ascend.spec')
1505
1506 #------------------------------------------------------
1507 # LIBASCEND DOXYGEN DOCUMENTATION
1508
1509 env.SConscript('base/doc/SConscript',['env'])
1510
1511 #------------------------------------------------------
1512 # RPM BUILD
1513
1514 # for RPM builds, 'scons dist' then 'rpmbuild -ta dist/ascend-*.tar.bz2'
1515 # (check * for the version number used to create the tarball)
1516
1517 #------------------------------------------------------
1518 # DEFAULT TARGETS
1519
1520 default_targets =['libascend']
1521 if with_tcltk:
1522 default_targets.append('tcltk')
1523 if with_python:
1524 default_targets.append('pygtk')
1525 if with_installer:
1526 default_targets.append('installer')
1527 if with_extfns:
1528 default_targets.append('extfns')
1529
1530 env.Default(default_targets)
1531
1532 print "Building targets:"," ".join([str(i) for i in BUILD_TARGETS])
1533
1534 # vim: set syntax=python:
1535

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