-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
3215 lines (2598 loc) · 83 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python invoke_using_scons
# This is a build script for use with SCons. Use it to compile ASCEND on
# Linux, Windows. It should also give some success on Mac, although this is
# much less tested.
# version number for this ASCEND build:
version = "0.9.10"
# shared library API numbering, for Linux (FIXME windows too?)
soname_major_int = "1"
soname_minor = ".0"
import sys, os, commands, platform, distutils.sysconfig, os.path, re, types
import subprocess
# version number for python, useful on Windows
pyversion = "%d.%d" % (sys.version_info[0],sys.version_info[1])
# architecture label
winarchtag = "-win32"
mingw64suff = ""
mingw64excpt ="_dw2"
if platform.architecture()[0] == "64bit":
winarchtag="-amd64"
mingw64suff = "_64"
mingw64excpt ="_seh"
import SCons.Warnings
SCons.Warnings.suppressWarningClass(SCons.Warnings.VisualCMissingWarning)
#------------------------------------------------------
# PLATFORM DEFAULTS
#print "PLATFORM = ",platform.system()
soname_major = "." + soname_major_int
default_install_prefix = '/usr/local'
default_install_bin = "$INSTALL_PREFIX/bin"
default_install_lib = "$INSTALL_PREFIX/lib"
default_install_models = "$INSTALL_LIB/ascend/models"
default_install_solvers = "$INSTALL_LIB/ascend/solvers"
default_install_assets = "$INSTALL_ASCDATA/glade/"
default_install_ascdata = "$INSTALL_SHARE/ascend"
default_install_include = "$INSTALL_PREFIX/include"
default_python=sys.executable
default_install_python = distutils.sysconfig.get_python_lib(plat_specific=1)
default_install_python_ascend = "$INSTALL_PYTHON/ascend"
default_tcl = '/usr'
default_tcl_libpath = "$TCL/lib"
default_tcl_cpppath = "$TCL/include"
default_conopt_envvar="CONOPT_PATH"
default_with_graphviz = True
default_tcl_lib = "tcl8.5"
default_tk_lib = "tk8.5"
default_tktable_lib = "Tktable2.9"
default_ida_prefix="$DEFAULT_PREFIX"
default_ipopt_libpath = "$IPOPT_PREFIX/lib"
default_ipopt_dll = ["$DEFAULT_PREFIX/bin/%s.dll"%i for i in ["libgfortran$MINGW64SUFF-3", "libstdc++$MINGW64SUFF-6","libquadmath$MINGW64SUFF-0","libgcc_s$MINGW64EXCPT$MINGW64SUFF-1"]]+[None] # should be five here
default_ipopt_libs = ["$F2C_LIB","blas","lapack","pthread","ipopt"]
default_conopt_prefix="$DEFAULT_PREFIX"
default_conopt_libpath="$CONOPT_PREFIX"
default_conopt_cpppath="$CONOPT_PREFIX"
default_conopt_dlpath="$CONOPT_PREFIX"
default_prefix="/usr"
default_libpath="$DEFAULT_PREFIX/lib"
default_cpppath="$DEFAULT_PREFIX/include"
default_f2c_lib="gfortran"
default_swig="swig"
icon_extension = '.png'
if platform.system()=="Windows":
try:
d = os.path.split(os.path.dirname(WhereIs("gcc.exe")))[0]
default_prefix=d
except:
default_prefix="c:\\mingw"
default_libpath="$DEFAULT_PREFIX\\lib"
default_cpppath="$DEFAULT_PREFIX\\include"
# these correspond the the version of Tcl/Tk linked to in the NSIS scripts
default_tcl_lib = "tcl85"
default_tk_lib = "tk85"
default_tktable_lib = "Tktable28"
# on windows, we locate explicitly in gtkbrowser.py:
default_install_assets = ""
default_tcl = "c:\\Tcl"
if os.environ.get('MSYSTEM'):
default_tcl_libpath="$TCL\\bin"
else:
default_tcl_libpath="$TCL\\lib"
# on Windows, we build ASCEND such that it finds it support files
# using paths relative to the location of the executable
default_absolute_paths = False
default_dist_rel_bin = '.'
default_tk_rel_dist = 'tcltk'
default_library_rel_dist = 'models'
default_solvers_rel_dist = 'solvers'
# where to look for IDA solver libraries, headers, etc.
default_ida_prefix = "$DEFAULT_PREFIX"
# IPOPT. we now prefer to build our own version.
default_ipopt_libs = ["ipopt",'stdc++','coinmumps','coinmetis','coinlapack','coinblas','gfortran','pthread']
# where to look for CONOPT when compiling
default_conopt_prefix = "c:\\Program Files\\CONOPT"
default_conopt_lib="conopt3"
need_libm = False
python_exe = sys.executable
default_with_scrollkeeper=False
pathsep = ";"
default_f2c_lib="gfortran"
default_swig=WhereIs("swig.exe")
soname_minor = ""
soname_major = ""
# still problems with Graphviz on Windows, leave it off now by default.
if not os.path.exists(default_conopt_prefix):
default_conopt_prefix = None
elif platform.system()=="Darwin":
default_install_prefix = ''
default_install_bin = "$INSTALL_PREFIX/ASCEND.app/Contents"
default_install_lib = "$INSTALL_BIN"
default_install_models = "$INSTALL_BIN/Models"
default_install_solvers = "$INSTALL_BIN/Solvers"
default_install_ascdata = "$INSTALL_BIN/Resources"
default_install_include = "$INSTALL_BIN/Headers"
default_install_python = "$INSTALL_BIN/Python"
default_install_python_ascend = default_install_python
default_install_assets = "$INSTALL_ASCDATA/glade/"
# FIXME still need to work out the Tcl/Tk side of things...
# within the bundle, we'll use relative paths
default_absolute_paths = False
default_dist_rel_bin = '.'
default_tk_rel_dist = 'tcltk'
# we should move these to /Library/ASCEND/Models and /Library/ASCEND/Solvers, for visibility
default_library_rel_dist = 'Models'
default_solvers_rel_dist = 'Solvers'
# where to look for CONOPT when compiling
default_conopt_prefix = "/Library/CONOPT"
default_conopt_lib="conopt3"
need_libm = False
python_exe = sys.executable
default_with_scrollkeeper=False
pathsep = ";"
if not os.path.exists(default_conopt_prefix):
default_conopt_prefix = None
else: # LINUX, unix we hope
# the scons 'philosophy' if there is one is that the scons input arguments
# completely determine what external tools get picked any time there might
# be choices.
# We don't follow that philosophy with regard to tcl/tk.
# tcl/tk are often in multiple versions and locations on any given system.
# This leaves us trying to guess whether we should take:
# - only explicit arguments, otherwise disable tcl, tk
# - the first tcl/tk in the users path
# - the tcl/tk under a given user-specified prefix
# - the folklore-based canonical location of distributor's tcl/tk on a given linux dist
# We know one thing for sure. Any tcl installation includes tclsh, and thus
# it's the canonical way to find anything about tcl once tclsh is picked.
# So all the above reduces to 'how do we find tclsh?'
icon_extension = '.svg'
# here's the folklore we know.
if os.path.exists("/etc/debian_version"):
default_tcl_cpppath = "/usr/include/tcl8.4"
default_tcl_lib = "tcl8.4"
default_tk_lib = "tk8.4"
default_tktable_lib = "Tktable2.8"
if os.path.exists("/etc/SuSE-release"):
default_tcl_cpppath = "/usr/include"
default_tcl_lib = "tcl8.4"
default_tk_lib = "tk8.4"
default_tktable_lib = "Tktable2.9"
if os.path.exists("/etc/lsb-release"):
_f = file("/etc/lsb-release")
_r = re.compile("([A-Z][^=]*)=(.*)")
LSB = {}
for l in _f:
_m = _r.match(l.strip())
LSB[_m.group(1)] = _m.group(2)
print LSB
if LSB.has_key('DISTRIB_ID') and LSB['DISTRIB_ID'] == "Ubuntu":
if float(LSB['DISTRIB_RELEASE']) >= 9.04:
default_tcl_lib = "tcl8.5"
default_tk_lib = "tk8.5"
default_tktable_lib = "Tktable2.9"
default_tcl_cpppath = "/usr/include/tcl8.5"
if not os.path.exists(default_tcl_cpppath):
default_tcl_lib = "tcl8.4"
default_tk_lib = "tk8.4"
default_tktable_lib = "Tktable2.9"
default_tcl_cpppath = "/usr/include/tcl8.4"
# centos 5
if os.path.exists("/etc/redhat-release"):
default_tcl_cpppath = "/usr/include"
default_tcl_lib = "tcl"
if sys.maxint > 2**32:
default_tcl_libpath = "/usr/lib64"
else:
default_tcl_libpath = "/usr/lib"
default_tk_lib = "tk"
default_tktable_lib = "Tktable2.9"
default_absolute_paths = True
default_dist_rel_bin = '..'
default_tk_rel_dist = 'share/ascend/tcltk'
default_library_rel_dist = 'lib/ascend/models'
default_solvers_rel_dist = 'lib/ascend/solvers'
default_conopt_libpath="$CONOPT_PREFIX/lib"
default_conopt_cpppath="$CONOPT_PREFIX/include"
default_conopt_dlpath= default_conopt_libpath + ":/usr/local/lib"
default_conopt_lib="consub3"
need_libm = True
if not os.path.isdir(default_tcl):
default_tcl = '/usr'
python_exe = distutils.sysconfig.EXEC_PREFIX+"/bin/python"
default_with_scrollkeeper=False
pathsep = ":"
if not os.path.exists(default_ida_prefix):
default_ida_prefix = None
soname_clean = "${SHLIBPREFIX}ascend${SHLIBSUFFIX}"
soname_full = "%s%s" % (soname_clean,soname_major)
#------------------------------------------------------
# OPTIONS
#
# The following give the set of command-line parameters that can be passed to
# SCons from the commandline. Options will be 'remembered' by being cached
# in the file 'options.cache'; if you want to start with a clean slate, you
# should remove that file.
vars = Variables(['options.cache', 'config.py'])
vars.Add('HOST_PREFIX'
,"Host architecture prefix"
,""
)
vars.Add('CC'
,'C Compiler command'
,"${HOST_PREFIX}gcc"
)
vars.Add('CXX'
,'C++ Compiler command'
,"${HOST_PREFIX}g++"
)
vars.Add(BoolVariable('GCOV'
, 'Whether to enable coverage testing in object code'
, False
))
if platform.system()!="Windows":
vars.Add(BoolVariable('WITH_GCCVISIBILITY'
,"Whether to use GCC Visibility features (only applicable if available)"
,True
))
vars.Add(BoolVariable('WITH_SIGNALS'
,"Whether to permit use of signals for flow control in the C-level code"
,True
))
# You can turn off building of Tcl/Tk interface
vars.Add(BoolVariable('WITH_TCLTK'
,"Set to False if you don't want to build the original Tcl/Tk GUI."
, True
))
# You can turn off the building of the Python interface
vars.Add(BoolVariable('WITH_PYTHON'
,"Set to False if you don't want to build Python wrappers."
, True
))
# Which solvers will we allow?
vars.Add(ListVariable('WITH_SOLVERS'
,"List of the solvers you want to build. The default is the minimum that"
+" works. The option 'LSOD' is provided for backwards compatibility"
+"; the value 'LSODE' is preferred."
,["QRSLV","CMSLV","LSODE","IDA","CONOPT","LRSLV","IPOPT","DOPRI5"]
,['QRSLV','MPS','SLV','OPTSQP'
,'NGSLV','CMSLV','LRSLV','MINOS','CONOPT'
,'LSODE','LSOD','OPTSQP',"IDA","TRON","IPOPT","DOPRI5","MAKEMPS","RADAU5"
]
))
# Where will the local copy of the help files be kept?
vars.Add(BoolVariable('WITH_DOC'
, "Should we try to build and install help files? If not, ASCEND will access online help files"
, True
))
vars.Add(BoolVariable('WITH_DOC_BUILD'
, "If true, we'll attempt to build docs. Set false, we'll assume we already have then (eg from the tarball)"
, "$WITH_DOC"
))
vars.Add(BoolVariable('WITH_DOC_INSTALL'
, "If true, SCons will install the documentation file(s). If false, assume rpm or dpkg is going to do it."
, "$WITH_DOC"
))
vars.Add('HELP_ROOT'
, "Location of the main help file"
, "$INSTALL_DOC/book.pdf"
)
# Will bintoken support be enabled?
vars.Add(BoolVariable('WITH_BINTOKEN'
,"Enable bintoken support? This means compiling models as C-code before"
+" running them, to increase solving speed for large models."
,False
))
# What should the default ASCENDLIBRARY path be?
# Note: users can change it by editing their ~/.ascend.ini
vars.Add('DEFAULT_ASCENDLIBRARY'
,"Set the default value of the ASCENDLIBRARY -- the location where"
+" ASCEND will look for models when running ASCEND"
,"$INSTALL_MODELS"
)
# What should the default ASCENDLIBRARY path be?
# Note: users can change it by editing their ~/.ascend.ini
vars.Add('DEFAULT_ASCENDSOLVERS'
,"Set the default value of ASCENDSOLVERS -- the location where"
+" ASCEND will look for solver shared-library files"
,"$INSTALL_SOLVERS"
)
# Where is SWIG?
vars.Add('SWIG'
,"SWIG location, probably only required for MinGW and MSVC users."
+" Enter the location as a Windows-style path, for example"
+" 'c:\\msys\\1.0\\home\\john\\swigwin-1.3.29\\swig.exe'."
,default_swig
)
# Build the test suite?
vars.Add(BoolVariable('WITH_CUNIT'
,"You can disable CUnit tests with this option. This will basically stop"
+" SCons from parsing the SConscript files relating to the 'test'"
+" target, which just might make things marginally faster. Probably"
+" you can just ignore this option though. SCons will sniff for Cunit"
+" but build the tests only if you specify the 'test' target."
,True
))
# Build with MMIO matrix export support?
vars.Add(BoolVariable('WITH_MMIO'
,"Include support for exporting matrices in Matrix Market format"
,True
))
#----- default paths -----
vars.Add(PackageVariable('DEFAULT_PREFIX'
,"Where are most of the shared libraries located on your system?"
,default_prefix
))
#------ cunit --------
# CUnit is a unit testing library that we use to test libascend.
# Where was CUNIT installed?
vars.Add(PackageVariable('CUNIT_PREFIX'
,"Where are your CUnit files?"
,"$DEFAULT_PREFIX"
))
# Where are the CUnit includes?
vars.Add(PackageVariable('CUNIT_CPPPATH'
,"Where are your CUnit include files?"
,"$CUNIT_PREFIX/include"
))
# Where are the CUnit libraries?
vars.Add(PackageVariable('CUNIT_LIBPATH'
,"Where are your CUnit libraries?"
,"$CUNIT_PREFIX/lib"
))
# ----- conopt-----
vars.Add(PackageVariable("CONOPT_PREFIX"
,"Prefix for your CONOPT install (CONOPT ./configure --prefix)"
,default_conopt_prefix
))
vars.Add("CONOPT_LIB"
,"Library linked to for CONOPT. This is the name of the CONOPT .so or DLL. On Windows it seems to be called 'copopt3' but on linux it seems to be called 'consub3'."
,default_conopt_lib
)
vars.Add(BoolVariable("CONOPT_LINKED"
,"Do you want to dynamically link to CONOPT (only possible if CONOPT is available at buildtime)"
,False
))
vars.Add('CONOPT_CPPPATH'
,"Where is your conopt.h?"
,default_conopt_cpppath
)
vars.Add('CONOPT_LIBPATH'
,"Where is your CONOPT library installed?"
,default_conopt_libpath
)
vars.Add('CONOPT_DLPATH'
,"Default (fallback) search path that ASCEND should use when dlopening the CONOPT library at runtime? This is only used if the conopt environment variable doesn't exist and doesn't point to a location where the DLL/SO is found. This is in platform-specific form (paths with ';' separator in Windows, ':' separator on Linux)."
,default_conopt_dlpath
)
vars.Add('CONOPT_ENVVAR'
,"Name of the optional environment variable which will be used for the value of the searchpath for the CONOPT DLL/SO."
,default_conopt_envvar
)
#------- IPOPT -------
if platform.system()=="Windows":
vars.Add(PackageVariable("IPOPT_PREFIX"
,"Prefix for your IPOPT install (IPOPT ./configure --prefix)"
,default_conopt_prefix
))
vars.Add("IPOPT_LIBS"
,"Library linked to for IPOPT"
,default_ipopt_libs
)
vars.Add("IPOPT_LIBPATH"
,"Where is your IPOPT library installed"
,default_ipopt_libpath
)
vars.Add('IPOPT_CPPPATH'
,"Where is your IPOPT coin/IpStdCInterface.h (do not include the 'coin' in the path)"
,"$IPOPT_PREFIX/include"
)
vars.Add('MINGW64SUFF'
,"Suffix for 64-bit GCC-related DLLs for bundling with the installer"
,mingw64suff
)
vars.Add('MINGW64EXCPT'
,"Suffix to specify exception style for GCC-related DLLs to be bundled with the installer"
,mingw64excpt
)
for i in range(5):
vars.Add('IPOPT_DLL%d'%(i+1)
,"Exact path of IPOPT DLL (%d) to be included in the installer (Windows only)"%(i+1)
,default_ipopt_dll[i]
)
#-------- f2c ------
vars.Add("F2C_LIB"
,"F2C library (eg. g2c, gfortran, f2c)"
,default_f2c_lib # the default is gfortran now
)
vars.Add(PackageVariable("F2C_LIBPATH"
,"Directory containing F2C library (i.e. g2c, gfortran, f2c, etc.), if not already accessible"
,"off"
))
vars.Add("FORTRAN"
,"Fortran compiler (eg g77, gfortran)"
,"${HOST_PREFIX}gfortran"
)
vars.Add("SHFORTRAN"
,"Fortran compiler for shared library object (should normally be same as FORTRAN)"
,"$FORTRAN"
)
#------- Python --------
vars.Add('PYTHON'
,"Location of the Python executable to which ASCEND should be linked"
,default_python
)
#------- tcl/tk --------
vars.Add('TCL'
,'Base of Tcl distribution'
,default_tcl
)
# Where are the Tcl includes?
vars.Add('TCL_CPPPATH'
,"Where are your Tcl include files?"
,default_tcl_cpppath
)
# Where are the Tcl libs?
vars.Add('TCL_LIBPATH'
,"Where are your Tcl libraries?"
,default_tcl_libpath
)
# What is the name of the Tcl lib?
vars.Add('TCL_LIB'
,"Name of Tcl lib (eg 'tcl' or 'tcl83'), for full path to static library (if STATIC_TCLTK is set)"
,default_tcl_lib
)
# Where are the Tk includes?
vars.Add('TK_CPPPATH'
,"Where are your Tk include files?"
,'$TCL_CPPPATH'
)
# Where are the Tk libs?
vars.Add('TK_LIBPATH'
,"Where are your Tk libraries?"
,'$TCL_LIBPATH'
)
# What is the name of the Tk lib?
vars.Add('TK_LIB'
,"Name of Tk lib (eg 'tk' or 'tk83'), or full path to static library"
,default_tk_lib
)
# Static linking to TkTable
vars.Add(BoolVariable('STATIC_TCLTK'
,'Set true for static linking for Tcl/Tk and TkTable. EXPERIMENTAL'
,False
))
vars.Add('TKTABLE_LIBPATH'
,'Location of TkTable static library'
,'$TCL_LIBPATH/Tktable2.8'
)
vars.Add('TKTABLE_LIB'
,'Stem name of TkTable (eg tktable2.8, no ".so" or "lib") shared library, or full path of static tktable (/usr/lib/...)'
,default_tktable_lib
)
vars.Add('TKTABLE_CPPPATH'
,'Location of TkTable header file'
,'$TCL_CPPPATH'
)
vars.Add('X11'
,'Base X11 directory. Only used when STATIC_TCLTK is turned on. EXPERIMENTAL'
,'/usr/X11R6'
)
vars.Add('X11_LIBPATH'
,'Location of X11 lib. EXPERIMENTAL'
,'$X11/lib'
)
vars.Add('X11_CPPPATH'
,'Location of X11 includes. EXPERIMENTAL'
,'$X11/include'
)
vars.Add('X11_LIB'
,'Name of X11 lib. EXPERIMENTAL'
,'X11'
)
#----- installed file locations (for 'scons install') -----
vars.Add('INSTALL_PREFIX'
,'Root location for installed files'
,default_install_prefix
)
vars.Add('INSTALL_BIN'
,'Location to put binaries during installation'
,default_install_bin
)
vars.Add('INSTALL_LIB'
,'Location to put libraries during installation'
,default_install_lib
)
vars.Add('INSTALL_SHARE'
,'Common shared-file location on this system'
,"$INSTALL_PREFIX/share"
)
vars.Add('INSTALL_ASCDATA'
,"Location of ASCEND shared data (TK, python, models etc)"
,default_install_ascdata
)
vars.Add('INSTALL_PYTHON'
,'General location for Python extensions on this system'
,default_install_python
)
vars.Add('INSTALL_PYTHON_ASCEND'
,'Location for installation of Python modules specific to ASCEND'
,default_install_python_ascend
)
vars.Add('INSTALL_TK'
,'Location for Tcl/Tk files used by ASCEND Tk GUI'
,"$INSTALL_ASCDATA/tcltk"
)
vars.Add('INSTALL_MODELS'
,"Location of ASCEND model files (.a4c,.a4l,.a4s)"
,default_install_models
)
vars.Add('INSTALL_SOLVERS'
,"Location of ASCEND solvers"
,default_install_solvers
)
vars.Add('INSTALL_DOC'
,"Location of ASCEND documentation files"
,"$INSTALL_SHARE/doc/ascend-"+version
)
vars.Add('INSTALL_INCLUDE'
,'Location to put header files during installation'
,default_install_include
)
vars.Add('INSTALL_ROOT'
,'For use by RPM only: location of %{buildroot} during rpmbuild'
,""
)
vars.Add('EXTLIB_SUFFIX'
,"Filename suffix for ASCEND 'external libraries' (for use with IMPORT"
,"_ascend$SHLIBSUFFIX"
)
vars.Add('EXTLIB_PREFIX'
,"Filename suffix for ASCEND 'external libraries' (for use with IMPORT"
,"$SHLIBPREFIX"
)
#----------------------
vars.Add('PYGTK_ASSETS'
,'Default location for Glade assets (will be recorded in pygtk/config.py)'
,default_install_assets
)
vars.Add(BoolVariable('DEBUG'
,"Compile source with debugger symbols, eg for use with 'gdb'"
,False
))
vars.Add(BoolVariable('MALLOC_DEBUG'
,"Compile with debugging version of MALLOC. Required for full CUnit testing"
,False
))
#------ dmalloc --------
vars.Add(PackageVariable('DMALLOC_PREFIX'
,"Where are your dmalloc files?"
,"$DEFAULT_PREFIX"
))
vars.Add(PackageVariable('DMALLOC_CPPPATH'
,"Where are your dmalloc include files?"
,default_cpppath
))
vars.Add(PackageVariable('DMALLOC_LIBPATH'
,"Where are your dmalloc libraries?"
,default_libpath
))
vars.Add(BoolVariable('WITH_DMALLOC'
,"Link to the DMALLOC library (if available) for debugging of memory usage."
,False
))
vars.Add(BoolVariable('WITH_GRAPHVIZ'
,"Link to the GRAPHVIZ library (if available, for generating incidence graphs)"
,default_with_graphviz
))
#------ ufsparse --------
vars.Add(PackageVariable('UFSPARSE_PREFIX'
,"Where are your UFSPARSE files?"
,"$DEFAULT_PREFIX"
))
vars.Add(PackageVariable('UFSPARSE_CPPPATH'
,"Where are your UFSPARSE include files?"
,default_cpppath
))
vars.Add(PackageVariable('UFSPARSE_LIBPATH'
,"Where are your UFSPARSE libraries?"
,default_libpath
))
vars.Add(BoolVariable('WITH_UFSPARSE'
,"Link to the UFSPARSE library (if available, for additional sparse matrix routines)"
,True
))
#-----------------------
vars.Add(BoolVariable('UPDATE_NO_YACC_LEX'
,"Update the *_no_yacc* and *_no_lex* files in the source tree? (these files are created so that ASCEND can be compiled in the absence of those tools)"
,False
))
vars.Add('DISTTAR_NAME'
,"Stem name of the tarball created by 'scons dist'. So for 'ascend-aaa.tar.bz2', set this to 'ascend-aaa'."
,"ascend-"+version
)
vars.Add('RELEASE'
,"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."
,"0"
)
vars.Add(BoolVariable('ABSOLUTE_PATHS'
,"Whether to use absolute or relative paths in the installed Tcl/Tk interface. If you want to build an RPM, set this to false."
,default_absolute_paths
))
vars.Add('WIN_INSTALLER_NAME'
,"Name of the installer .exe to create under Windows (minus the '.exe')"
,"ascend-"+version+winarchtag+"-py"+pyversion+".exe"
)
vars.Add(BoolVariable('WITH_XTERM_COLORS'
,"Set to 0 if you don't want xterm colour codes in the console output"
,True
))
vars.Add(BoolVariable('WITH_EXTFNS'
,"Set to 0 if you don't want to attempt to build the external modules bundled with ASCEND"
,True
))
vars.Add(BoolVariable('WITH_SCROLLKEEPER'
,"Set to to 1 if you want to install an OMF file that can be read by scrollkeeper (eg Yelp on GNOME)"
,default_with_scrollkeeper
))
vars.Add(BoolVariable('WITH_MSVCR71'
,"Attempt to link against MSVCR71.DLL, to enable passing of FILE* objects to/from python"
,False
))
# TODO: OTHER OPTIONS?
# TODO: flags for optimisation
# TODO: turning on/off bintoken functionality
# TODO: Where will the 'Makefile.bt' file be installed?
# Import the outside environment
def c_escape(str):
return re.sub("\\\\","/",str)
envadditional={}
tools = [
'lex', 'yacc', 'fortran', 'swig', 'substinfile'
,'disttar', 'tar', 'graphviz','sundials', 'dvi', 'pdflatex'
]
if platform.system()=="Windows":
tools += ['nsis']
if os.environ.get('OSTYPE')=='msys' or os.environ.get('MSYSTEM'):
envenv = os.environ
tools += ['mingw']
envadditional['IS_MINGW']=True
else:
print "Assuming VC++ build environment (Note: MinGW is preferred)"
envenv = {
'PATH':os.environ['PATH']
,'INCLUDE':os.environ['INCLUDE']
,'LIB':os.environ['LIB']
,'MSVS_IGNORE_IDE_PATHS':1
}
tools += ['default']
envadditional['CPPDEFINES']=['_CRT_SECURE_NO_DEPRECATE']
else:
envenv = os.environ
tools += ['default','doxygen','ipopt']
env = Environment(
ENV=envenv
, toolpath=['scons']
, tools=tools
, **envadditional
)
# Create .def files by default on Windows (or else SCons 2.0.1 never seems to be happy)
if platform.system()=="Windows":
env.Append(WINDOWS_INSERT_DEF=1)
#print "PATH =",os.environ['PATH']
#print "PROGSUFFIX =",env['PROGSUFFIX']
#print "CPPPATH =",env['CPPPATH']
vars.Update(env)
for l in ['SUNDIALS','IPOPT']:
var = "%s_LIBS" % l
if env.get(var) and not isinstance(env[var],types.ListType):
env[var] = env[var].split(",")
if 'LSOD' in env['WITH_SOLVERS']:
if 'LSODE' not in env['WITH_SOLVERS']:
env['WITH_SOLVERS'].append('LSODE')
env['WITH_SOLVERS'].remove('LSOD')
vars.Save('options.cache',env)
Help(vars.GenerateHelpText(env))
if env['ENV'].get('HOST_PREFIX'):
triplet = re.compile("^[a-z0-9_]+-[a-z0-9_]+-[a-z0-9]+$")
if not triplet.match(env['ENV']['HOST_PREFIX']):
print "NOTE: invalid host triplet from environment variable HOST_PREFIX has been ignored"
else:
print "NOTE: using HOST_PREFIX=%s from environment to override HOST_PREFIX SCons variable" % env['ENV']['HOST_PREFIX']
env['HOST_PREFIX'] = env['ENV']['HOST_PREFIX']+"-"
with_tcltk = env.get('WITH_TCLTK')
without_tcltk_reason = "disabled by options/config.py"
with_python = env.get('WITH_PYTHON')
without_python_reason = "disabled by options/config.py"
with_cunit = env.get('WITH_CUNIT')
without_cunit_reason = "not requested"
with_extfns = env.get('WITH_EXTFNS')
without_extfn_reason = "disabled by options/config.py"
with_scrollkeeper = env.get('WITH_SCROLLKEEPER')
without_scrollkeeper_reason = "disabled by options/config.py"
with_dmalloc = env.get('WITH_DMALLOC')
without_dmalloc_reason = "disabled by options/config.py"
with_graphviz = env.get('WITH_GRAPHVIZ')
without_graphiviz_reason = "disabled by options/config.py"
with_ufsparse = env.get('WITH_UFSPARSE')
without_ufsparse_reason = "disabled by options/config.py"
with_mmio = env.get('WITH_MMIO')
without_mmio_reason = "disabled by options/config.py"
with_signals = env.get('WITH_SIGNALS')
without_signals_reason = "disabled by options/config.py"
with_doc = env.get('WITH_DOC')
with_doc_build = env.get('WITH_DOC_BUILD');
without_doc_build_reason = "disabled by options/config.py"
if not with_doc:
with_doc_build = False
without_doc_build_reason = "disabled by with_doc"
with_latex2html = False
if platform.system()=="Windows":
with_installer=1
else:
with_installer=0
without_installer_reason = "only possible under Windows"
notselected = "Not selected (see config option WITH_SOLVERS)"
with_lsode = 'LSODE' in env['WITH_SOLVERS']
without_lsode_reason = notselected
with_ida = 'IDA' in env['WITH_SOLVERS']
without_ida_reason = notselected
with_dopri5 = 'DOPRI5' in env['WITH_SOLVERS']
without_dopri5_reason = notselected
with_radau5 = 'RADAU5' in env['WITH_SOLVERS']
without_radau5_reason = notselected
with_conopt = 'CONOPT' in env['WITH_SOLVERS']
without_conopt_reason = notselected
with_ipopt = 'IPOPT' in env['WITH_SOLVERS']
without_ipopt_reason = notselected
with_makemps = 'MAKEMPS' in env['WITH_SOLVERS']
without_makemps_reason = notselected
#print "SOLVERS:",env['WITH_SOLVERS']
#print "WITH_BINTOKEN:",env['WITH_BINTOKEN']
#print "DEFAULT_ASCENDLIBRARY:",env['DEFAULT_ASCENDLIBRARY']
can_install = True
if platform.system()=='Windows':
can_install = False
env['CAN_INSTALL']=can_install
#print "TCL=",env['TCL']
#print "TCL_CPPPATH =",env['TCL_CPPPATH']
#print "TCL_LIBPATH =",env['TCL_LIBPATH']
#print "TCL_LIB =",env['TCL_LIB']
#print "ABSOLUTE PATHS =",env['ABSOLUTE_PATHS']
#print "INSTALL_ASCDATA =",env['INSTALL_ASCDATA']
#print "INSTALL_PREFIX =",env['INSTALL_PREFIX']
#print "INSTALL_MODELS =",env['INSTALL_MODELS']
#print "INSTALL_SOLVERS =",env['INSTALL_SOLVERS']
#print "INSTALL_PYTHON =",env['INSTALL_PYTHON']
#print "INSTALL_PYTHON_ASCEND =",env['INSTALL_PYTHON_ASCEND']
#print "DEFAULT_ASCENDLIBRARY =",env['DEFAULT_ASCENDLIBRARY']
#print "DEFAULT_ASCENDSOLVERS =",env['DEFAULT_ASCENDSOLVERS']
#------------------------------------------------------
# SPECIAL CONFIGURATION TESTS
need_fortran = False
need_fortran_reasons = []
#----------------
# CC
cc_test_text = """
int main(void){
return 0;
}
""";
def CheckCC(context):
context.Message("Checking C compiler ('%s')... " % context.env.subst('$CC'))
is_ok = context.TryCompile(cc_test_text,".c")
context.Result(is_ok)
return is_ok
#----------------
# CXX
cxx_test_text = """
template<class X>
class pair{
public:
X a;
X b;
};
int main(void){
pair<double> P;
P.a = 0;
return 0;
}