This repository has been archived by the owner on Dec 2, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
201 lines (160 loc) · 6.45 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
# Scons Build script for the SBW conservation and clapack
# libraries and modules
#
# Author: Frank Bergmann (fbergman@u.washington.edu)
#
import glob
import sys
#SBW_DIR = '/home/fbergmann/dev/buildall/build/cvs-dl/core/include'
#LIBSBML_DIR = '/home/fbergmann/dev/buildall/build/cvs-dl/libsbml/'
#SBW_DIR = '/Users/fbergmann/Development/buildall/build/cvs-dl/core/include'
#SBW_DIR = '../buildall/build/cvs-dl/core/include'
#LIBSBML_DIR = '../buildall/build/cvs-dl/libsbml/'
SBW_DIR = '/Users/fbergmann/Development/core/include'
LIBSBML_DIR = '/Users/fbergmann/Development/libsbml/'
LPSOLVE = '/Users/fbergman/Development/buildall/build/cvs-dl/lib/liblpsolve55.a'
#SBW_DIR = '../core/include'
#LIBSBML_DIR = '../libsbml/'
if ARGUMENTS.has_key('SBW'):
SBW_DIR = ARGUMENTS.get('SBW')
print "Using SBW directory: " + SBW_DIR
if ARGUMENTS.has_key('LIBSBML'):
LIBSBML_DIR = ARGUMENTS.get('LIBSBML')
print "Using libsbml directory: " + LIBSBML_DIR
if ARGUMENTS.has_key('LPSOLVE'):
LPSOLVE = ARGUMENTS.get('LPSOLVE')
print "Using lpsolve: " + LPSOLVE
FRAMEWORKS = []
buildArchs = ''
compileFlags = ''
bzipLib = ''
# set up platform specific defines
if sys.platform in ['win32'] :
sbw_target = ' -DWIN32'
elif sys.platform in ['darwin']:
sbw_target = ' -DDARWIN -DLINUX '
FRAMEWORKS = [ 'vecLib' ]
if ARGUMENTS.get('UNIVERSAL') == 'no':
# make sure we compile little or big endiannes correctly
if sys.byteorder in ['little']:
sbw_target = sbw_target + " -D__LITTLE_ENDIAN__"
else:
sbw_target = sbw_target + " -D__BIG_ENDIAN__"
else:
buildArchs = ' -arch i386 -arch ppc '
else:
sbw_target = ' -DLINUX'
if ARGUMENTS.get("BZIP") == 'no':
print "BZ2: not linking against bzip"
else:
print "BZ2: linking against bzip"
bzipLib = 'bz2'
if ARGUMENTS.get('DEBUG') == 'yes':
print 'BUILD: building LibStructural DEBUG'
compileFlags = compileFlags + ' -g -Wall -D_GNU_SOURCE ' + sbw_target + ' -D_DEBUG'
else:
print 'BUILD: building LibStructural RELEASE'
compileFlags = compileFlags+ ' ' + sbw_target
externalLibs = []
if ARGUMENTS.has_key('EXTERNAL_LIBS'):
#When a single item list is provided, Split does not return a list
tmp = Split(ARGUMENTS['EXTERNAL_LIBS'].replace(',',' '))
if(type(tmp)==type([])):
externalLibs=tmp
else:
externalLibs=[tmp]
externalPaths = []
if ARGUMENTS.has_key('EXTERNAL_LIB_PATHS'):
tmp = Split(ARGUMENTS['EXTERNAL_LIB_PATHS'].replace(',',' '))
if(type(tmp)==type([])):
externalPaths = tmp
else:
externalPaths = [tmp]
externalIncPaths = []
if ARGUMENTS.has_key('EXTERNAL_INC_PATHS'):
tmp = Split(ARGUMENTS['EXTERNAL_INC_PATHS'].replace(',',' '))
if(type(tmp)==type([])):
externalIncPaths=tmp
else:
externalIncPaths=[tmp]
srcLibLA = Split ( glob.glob( './LibLA/*.cpp' ) )
srcLibStructural = Split ( glob.glob( './LibStructural/*.cpp' ) )
srcSbwCLAPACK = Split ( glob.glob( './SBW_CLAPACK/*.cpp' ) )
srcSbwStructural = Split ( glob.glob( './SBW_Structural/*.cpp' ) ) + [ './SBW_CLAPACK/sbwutil.cpp']
incLibLA = externalIncPaths + [ './include' ]
incLibStructural = incLibLA + [ './include', LIBSBML_DIR + 'include' ]
incSbwCLAPACK = incLibLA + [ './SBW_CLAPACK/', SBW_DIR, SBW_DIR + '/include' ]
incSbwStructural = incLibStructural + [ './SBW_Structural/', SBW_DIR, SBW_DIR + '/include' ]
libsLibLA = externalLibs + [ ]
libsLibStructural = externalLibs + [ 'sbml-static', 'LibLA-static', 'xml2', 'z', bzipLib, 'sbml-static', 'lpsolve55' ]
libsSbwCLAPACK = externalLibs + [ 'SBW-static', 'pthread', 'LibLA-static' ]
libsSbwStructural = externalLibs + [ 'LibLA-static', 'sbml-static', 'SBW-static', 'pthread', 'LibLA-static', 'LibStructural-static', 'xml2', 'z', bzipLib ,'LibLA-static', 'sbml-static' ]
# platform specific alterations for the above
if sys.platform in ['win32'] :
# none
print 'PLATFORM: Windows'
elif sys.platform in ['darwin']:
# none
print 'PLATFORM: OS X'
else:
print 'PLATFORM: *nix'
lapackLibs = ['lapack']
libsLibStructural = libsLibStructural + lapackLibs
libsSbwCLAPACK = libsSbwCLAPACK + lapackLibs
libsSbwStructural = libsSbwStructural + lapackLibs
libPath = externalPaths + [ SBW_DIR + '/../lib', './lib', LIBSBML_DIR + '/src/']
if ARGUMENTS.has_key('LIBSBML_LIBPATH'):
libPath = libPath + [ ARGUMENTS.get('LIBSBML_LIBPATH' ) ]
env = Environment(
CC = 'g++',
CFLAGS = compileFlags + buildArchs,
CXXFLAGS = compileFlags + buildArchs,
LINKFLAGS = buildArchs,
LIBPATH = libPath,
FRAMEWORKS = FRAMEWORKS
)
env.SharedLibrary (
target = './lib/LibLA',
CPPPATH = incLibLA,
source = srcLibLA,
LIBS = libsLibLA
)
env.SharedLibrary (
target = './lib/LibStructural',
CPPPATH = incLibStructural,
source = srcLibStructural,
LIBS = libsLibStructural
)
env.Library (
target = './lib/LibLA-static',
CPPPATH = incLibLA,
source = srcLibLA,
LIBS = libsLibLA
)
env.Library (
target = './lib/LibStructural-static',
CPPPATH = incLibStructural,
source = srcLibStructural,
LIBS = libsLibStructural
)
env.Program (
target = './bin/SBW_CLAPACK',
source = srcSbwCLAPACK,
CPPPATH = incSbwCLAPACK,
LIBS = libsSbwCLAPACK
)
env.Program (
target = './bin/SBW_STRUCTURAL',
source = srcSbwStructural,
CPPPATH = incSbwStructural,
LIBS = libsSbwStructural
)
if ARGUMENTS.get('EXAMPLE') == 'yes':
env.Program(
CC = 'gcc', CXX='gcc',
target = './bin/printmatrices',
source = './examples/c/loadstoichiometry.c',
CPPPATH = ['./LibLA/include', './LibStructural/include'],
LIBS = ['LibStructural'],
LIBPATH = './lib'
)