1 |
Import('env') |
2 |
|
3 |
srcs = Split(""" |
4 |
|
5 |
library.cpp type.cpp module.cpp symchar.cpp |
6 |
instance.cpp instanceinterfacedata.cpp |
7 |
method.cpp name.cpp |
8 |
reporter.cpp simulation.cpp set.cpp units.cpp dimensions.cpp extmethod.cpp |
9 |
variable.cpp relation.cpp |
10 |
solver.cpp curve.cpp plot.cpp |
11 |
solverparameters.cpp solverparameter.cpp solverparameteriterator.cpp |
12 |
solverstatus.cpp solverreporter.cpp |
13 |
incidencematrix.cpp |
14 |
|
15 |
""") |
16 |
|
17 |
libs = Split(""" |
18 |
asccompiler ascpackages ascsolver ascutilities ascgeneral |
19 |
""") |
20 |
|
21 |
|
22 |
libpath = [ |
23 |
'../../base/generic/compiler' |
24 |
,'../../base/generic/packages' |
25 |
,'../../base/generic/solver' |
26 |
,'../../base/generic/utilities' |
27 |
,'../../base/generic/general' |
28 |
] |
29 |
|
30 |
# Build a static library with all the sources |
31 |
|
32 |
lib = env.Library("ascxx",srcs |
33 |
, LIBS = libs |
34 |
, LIBPATH = libpath |
35 |
, CPPPATH = ['../../base/generic']+env['PYTHON_CPPPATH'] |
36 |
, CPPDEFINES = { |
37 |
'ASCXX_USE_PYTHON':None |
38 |
,'DEFAULT_ASCENDLIBRARY':'\\"'+env['DEFAULT_ASCENDLIBRARY']+'\\"' |
39 |
} |
40 |
, CPPFLAGS = ['-O3'] |
41 |
) |
42 |
|
43 |
#---------------------------------------------- |
44 |
# SWIG Builder |
45 |
|
46 |
def swig_modify_targets(target, source, env): |
47 |
target.append('ascend.py') |
48 |
target.append('ascend_wrap.h') |
49 |
return target, source |
50 |
|
51 |
swig_builder = Builder( |
52 |
action='$SWIG $SWIGFLAGS -o $TARGET $SOURCE' |
53 |
, emitter=swig_modify_targets |
54 |
) |
55 |
env.Append(BUILDERS={'Swig':swig_builder}) |
56 |
#--------------------------------------------- |
57 |
|
58 |
|
59 |
swig = env.Swig(target=['ascend_wrap.cc'],source=['ascend.i'] |
60 |
, SWIGFLAGS=['-python','-c++'] |
61 |
, CPPFLAGS = ['-O3'] |
62 |
) |
63 |
|
64 |
|
65 |
swiglib = env.SharedLibrary("ascend",['ascend_wrap.cc'] |
66 |
, LIBS = ['ascxx']+libs+env['PYTHON_LIB'] |
67 |
, LIBPATH = ['.']+libpath+env['PYTHON_LIBPATH'] |
68 |
, CPPPATH = ['../../base/generic']+env['PYTHON_CPPPATH'] |
69 |
, CPPDEFINES = { |
70 |
'ASCXX_USE_PYTHON':None |
71 |
,'DEFAULT_ASCENDLIBRARY':'\\"'+env['DEFAULT_ASCENDLIBRARY']+'\\"' |
72 |
} |
73 |
, CPPFLAGS = ['-O3'] |
74 |
, SHLIBPREFIX = '_' |
75 |
) |
76 |
|
77 |
env.Depends(swiglib,'ascend.py') |
78 |
|
79 |
print env['SUBST_DICT'] |
80 |
|
81 |
env.SubstInFile(source='config.py.in') |
82 |
|