/[ascend]/trunk/pygtk/interface/SConscript
ViewVC logotype

Contents of /trunk/pygtk/interface/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 509 - (show annotations) (download)
Wed Apr 19 05:13:08 2006 UTC (14 years, 5 months ago) by johnpye
File size: 2875 byte(s)
SWIG < 1.3.28 can't do GCC visibility, so turn off for python interface in that case.
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 # Build a static library with all the sources
18
19 python_env = env.Copy()
20 python_env.Replace(
21 CPPFLAGS=[]
22 , CCFLAGS=[]
23 , CPPDEFINES=[]
24 , LIBS=[]
25 )
26
27 import platform
28
29 if platform.system()=='Windows' and env.has_key('MSVS'):
30 python_env.Append(CCFLAGS=['/EHsc']) # for exceptions (as suggested by a MSVC error msg, dunno if it's right or not -- JP)
31
32 swig_has_gccvisibility = False
33 min,maj,pat = env['SWIGVERSION']
34 if min==1 and maj==3 and pat>=29:
35 swig_has_gccvisibility = True
36
37 if env.has_key('HAVE_GCC'):
38 python_env.Append(CPPFLAGS=['-O3'])
39 if swig_has_gccvisibility and env.has_key('HAVE_GCCVISIBILITY'):
40 python_env.Append(CCFLAGS=['-fvisibility=hidden']);
41
42 objs = []
43
44 python_env.Append(CPPPATH=['#base/generic']+env['PYTHON_CPPPATH'])
45
46 for s in srcs:
47 objs += python_env.SharedObject(s)
48
49 #----------------------------------------------
50 # SWIG Builder
51
52 #def swig_modify_targets(target, source, env):
53 # target.append('ascpy.py')
54 # target.append('ascpy_wrap.h')
55 # return target, source
56 #
57 #swig_builder = Builder(
58 # action='$SWIG $SWIGFLAGS -o $TARGET $SOURCE'
59 # , emitter=swig_modify_targets
60 #)
61 #python_env.Append(BUILDERS={'Swig':swig_builder})
62
63 #---------------------------------------------
64
65 def get_new_swig_flags(env):
66 min,maj,pat = env['SWIGVERSION']
67 flags = []
68 if min==1 and maj==3 and pat>=28:
69 flags += ['-O']
70 return flags
71
72 swiglib = python_env.SharedLibrary("ascpy",objs + ['ascpy.i']
73 , LIBS = ['ascend'] + env['PYTHON_LIB']
74 , LIBPATH = ['#'] + env['PYTHON_LIBPATH']
75 , SWIGFLAGS=['-python','-c++'] + get_new_swig_flags(env)
76 , SHLIBPREFIX = '_'
77 )
78
79 configpy = env.SubstInFile(source='config.py.in')
80 configh = env.SubstInFile(source='config.h.in')
81
82 ascendcmd = env.SubstInFile(source='ascend.in')
83
84 env.Execute(Chmod(ascendcmd, 0755))
85
86 #---------------------------------------------
87 # INSTALLATION
88
89 if env.has_key('CAN_INSTALL') and env['CAN_INSTALL']:
90 env.InstallProgram(env['INSTALL_ROOT']+env['INSTALL_BIN'],ascendcmd)
91
92 import glob
93 pythonfiles = glob.glob("*.py")
94
95 env.Install(env['INSTALL_ROOT']+env['INSTALL_DATA']+"/ascend/",pythonfiles)
96
97 gladefiles = glob.glob("glade/*")
98 env.Install(env['INSTALL_ROOT']+env['INSTALL_DATA']+"/ascend/glade/",gladefiles)
99
100 env.Install(env['INSTALL_ROOT']+env['INSTALL_DATA']+"/ascend/",swiglib)
101
102 if env.has_key('WITH_INSTALLER') and env['WITH_INSTALLER']:
103 import platform
104 if platform.system()=="Windows":
105 installer = env.Nsis('create.nsi')
106 Depends(installer,[swiglib,configpy,configh,ascendcmd])

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