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

Contents of /trunk/pygtk/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 925 - (show annotations) (download)
Tue Nov 21 23:30:30 2006 UTC (15 years, 7 months ago) by johnpye
File size: 3715 byte(s)
Suppressing -Wall warnings while building ascpy_wrap.cc
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 swig_env['CCFLAGS'] = swig_env['CCFLAGS'].remove('-Wall')
57
58 swigobj = swig_env.SharedObject('ascpy.i'
59 , SWIGFLAGS=['-python','-c++'] + get_new_swig_flags(env)
60 )
61 swig_env.SideEffect(['ascpy.py','ascpy_wrap.h'],'ascpy$SWIGCXXFILESUFFIX')
62 swig_env.Depends('ascpy.py',['ascpy.i'])
63 swig_env.Clean('ascpy_wrap$SWIGCXXFILESUFFIX',swigobj)
64 swig_env.Clean('ascpy.py','ascpy$SWIGCXXFILESUFFIX')
65 swig_env.Clean('ascpy_wrap.h','ascpy$SWIGCXXFILESUFFIX')
66
67 _libs = ['ascend']+env['PYTHON_LIB']
68 if not env.get('MSVS'):
69 _libs.append('stdc++')
70
71 swiglib = swig_env.SharedLibrary("ascpy",objs + swigobj
72 , LIBS = _libs
73 , LIBPATH = ['#'] + env['PYTHON_LIBPATH']
74 , SHLIBPREFIX = '_'
75 )
76
77 #---------------------------------------------
78 # CONFIG & runtime shell script for posix
79
80 configpy = env.SubstInFile(source='config.py.in')
81 configh = env.SubstInFile(source='config.h.in')
82
83 if platform.system() != "Windows" or env.has_key('IS_MINGW'):
84 ascendcmd = env.SubstInFile(source='ascend.in')
85 env.AddPostAction(ascendcmd, 'chmod 755 $TARGET')
86 ascdevcmd = env.SubstInFile(source='ascdev.in')
87 env.AddPostAction(ascdevcmd, 'chmod 755 $TARGET')
88
89 #---------------------------------------------
90 # LITTLE WEE TEST PROGRAM for debuggin the c++ wrapper
91 #
92 #libascxx = env.SharedLibrary('ascxx',objs
93 # , LIBS = ['ascend'] + env['PYTHON_LIB']
94 # , LIBPATH = ['.'] + ['#'] + env['PYTHON_LIBPATH']
95 #)
96 #
97 #ascxxtest = env.Program('ascxxtest',['ascxxtest.cpp']
98 # , LIBS = ['ascxx','ascend']
99 # , LIBPATH = ['.','#']
100 #)
101 #
102 #env.Alias('ascxx',ascxxtest)
103
104 #---------------------------------------------
105 # INSTALLATION
106
107 if env.get('CAN_INSTALL'):
108 env.InstallProgram(env['INSTALL_ROOT']+env['INSTALL_BIN'],ascendcmd)
109
110 import glob
111 pythonfiles = glob.glob("*.py")
112
113 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",pythonfiles)
114
115 gladefiles = glob.glob("glade/*")
116 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/glade/",gladefiles)
117
118 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",swiglib)
119
120 if platform.system()=="Windows":
121 env.Append(NSISDEFINES={'OUTFILE':env['WIN_INSTALLER_NAME']})
122 installer = env.Installer('create.nsi')
123 Depends(installer,[swiglib,configpy,configh,"../models","../ascend-config"])
124 env.Alias('installer',installer)
125
126 # vim: set syntax=python:
127

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