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

Contents of /trunk/pygtk/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 960 - (show annotations) (download)
Sun Dec 10 03:14:24 2006 UTC (13 years, 9 months ago) by johnpye
File size: 4031 byte(s)
Able to compile now on Solaris.
Fixed a problem with datareader.c returning non-void.
Remains a problem with std::logic_error not being linked to _ascpy
1 Import('env')
2
3 import platform
4
5 srcs = Split("""
6
7 library.cpp compiler.cpp type.cpp module.cpp symchar.cpp
8 instance.cpp instanceinterfacedata.cpp
9 method.cpp name.cpp
10 reporter.cpp simulation.cpp set.cpp units.cpp dimensions.cpp extmethod.cpp
11 variable.cpp registry.cpp relation.cpp
12 solver.cpp curve.cpp plot.cpp
13 solverparameters.cpp solverparameter.cpp solverparameteriterator.cpp
14 solverstatus.cpp solverreporter.cpp
15 incidencematrix.cpp
16 integrator.cpp
17 integratorreporter.cpp
18 annotation.cpp
19 """)
20
21 # Build a static library with all the sources
22
23 python_env = env.Copy()
24
25 if platform.system()=='Windows' and env.get('MSVS'):
26 python_env.Append(CCFLAGS=['/EHsc']) # for exceptions (as suggested by a MSVC error msg, dunno if it's right or not -- JP)
27
28 swig_has_gccvisibility = False
29 min,maj,pat = env['SWIGVERSION']
30 if min==1 and maj==3 and pat>=29:
31 swig_has_gccvisibility = True
32
33 if env.get('HAVE_GCC'):
34 python_env.Append(CPPFLAGS=['-O3'])
35 if swig_has_gccvisibility and env.has_key('HAVE_GCCVISIBILITY'):
36 python_env.Append(CCFLAGS=['-fvisibility=hidden']);
37
38 objs = []
39
40 python_env.AppendUnique(CPPPATH=['#base/generic']+env['PYTHON_CPPPATH'])
41
42 for s in srcs:
43 objs += python_env.SharedObject(s)
44
45 #----------------------------------------------
46 # SWIG wrapper
47
48 def get_new_swig_flags(env):
49 min,maj,pat = env['SWIGVERSION']
50 flags = []
51 if min==1 and maj==3 and pat>=28:
52 flags += ['-O']
53 return flags
54
55 swig_env = python_env.Copy()
56 if '-Wall' in swig_env.get('CCFLAGS'):
57 swig_env['CCFLAGS'] = swig_env['CCFLAGS'].remove('-Wall')
58
59 swigobjs = []
60
61 for swigf in Split("""
62 ascpy.i
63 """):
64 swigobj = swig_env.SharedObject(swigf
65 , SWIGFLAGS=['-python','-c++'] + get_new_swig_flags(env)
66 )
67 swig_env.SideEffect(['ascpy.py','ascpy_wrap.h'],'ascpy$SWIGCXXFILESUFFIX')
68 swig_env.Depends('ascpy.py',['ascpy.i'])
69 swig_env.Clean('ascpy_wrap$SWIGCXXFILESUFFIX',swigobj)
70 swig_env.Clean('ascpy.py','ascpy$SWIGCXXFILESUFFIX')
71 swig_env.Clean('ascpy_wrap.h','ascpy$SWIGCXXFILESUFFIX')
72
73 swigobjs.append(swigobj)
74
75 swig_env['LIBS'] = ['ascend']+env['PYTHON_LIB']
76 swig_env['LIBPATH'] = ['#'] + env['PYTHON_LIBPATH']
77 swig_env.Append(LINKFLAGS=env['PYTHON_LINKFLAGS'])
78
79 if not env.get('MSVS'):
80 swig_env.Append(LIBS = ['stdc++'])
81
82 if env.get('WITH_DMALLOC'):
83 swig_env.Append(LIBS = ['dmalloc'])
84 swig_env.Append(LIBPATH = [env.get('DMALLOC_LIBPATH')])
85
86 swiglib = swig_env.SharedLibrary("ascpy",objs + swigobjs
87 , SHLIBPREFIX = '_'
88 )
89
90 #---------------------------------------------
91 # CONFIG & runtime shell script for posix
92
93 configpy = env.SubstInFile(source='config.py.in')
94 configh = env.SubstInFile(source='config.h.in')
95
96 if platform.system() != "Windows" or env.has_key('IS_MINGW'):
97 ascendcmd = env.SubstInFile(source='ascend.in')
98 env.AddPostAction(ascendcmd, 'chmod 755 $TARGET')
99 ascdevcmd = env.SubstInFile(source='ascdev.in')
100 env.AddPostAction(ascdevcmd, 'chmod 755 $TARGET')
101
102 #---------------------------------------------
103 # LITTLE WEE TEST PROGRAM for debuggin the c++ wrapper
104 #
105 #libascxx = env.SharedLibrary('ascxx',objs
106 # , LIBS = ['ascend'] + env['PYTHON_LIB']
107 # , LIBPATH = ['.'] + ['#'] + env['PYTHON_LIBPATH']
108 #)
109 #
110 #ascxxtest = env.Program('ascxxtest',['ascxxtest.cpp']
111 # , LIBS = ['ascxx','ascend']
112 # , LIBPATH = ['.','#']
113 #)
114 #
115 #env.Alias('ascxx',ascxxtest)
116
117 #---------------------------------------------
118 # INSTALLATION
119
120 if env.get('CAN_INSTALL'):
121 env.InstallProgram(env['INSTALL_ROOT']+env['INSTALL_BIN'],ascendcmd)
122
123 import glob
124 pythonfiles = glob.glob("*.py")
125
126 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",pythonfiles)
127
128 gladefiles = glob.glob("glade/*")
129 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/glade/",gladefiles)
130
131 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",swiglib)
132
133 if platform.system()=="Windows":
134 env.Append(NSISDEFINES={'OUTFILE':env['WIN_INSTALLER_NAME']})
135 installer = env.Installer('create.nsi')
136 Depends(installer,[swiglib,configpy,configh,"../models","../ascend-config"])
137 env.Alias('installer',installer)
138
139 # vim: set syntax=python:
140

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