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

Contents of /trunk/pygtk/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 578 - (show annotations) (download)
Tue May 9 04:59:03 2006 UTC (13 years, 8 months ago) by johnpye
File size: 3378 byte(s)
Customisable installer .exe names.
Moved NSIS tool into the scons subdirectory, reverted to standard NsisSconsBuilder from the SCons Wiki.
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.get('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.get('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 wrapper
51
52 def get_new_swig_flags(env):
53 min,maj,pat = env['SWIGVERSION']
54 flags = []
55 if min==1 and maj==3 and pat>=28:
56 flags += ['-O']
57 return flags
58
59 swigobj = python_env.SharedObject('ascpy.i'
60 , SWIGFLAGS=['-python','-c++'] + get_new_swig_flags(env)
61 )
62 python_env.SideEffect(['ascpy.py','ascpy_wrap.h'],'ascpy$SWIGCXXFILESUFFIX')
63 python_env.Clean('ascpy_wrap$SWIGCXXFILESUFFIX',swigobj)
64 python_env.Clean('ascpy.py','ascpy$SWIGCXXFILESUFFIX')
65 python_env.Clean('ascpy_wrap.h','ascpy$SWIGCXXFILESUFFIX')
66
67 swiglib = python_env.SharedLibrary("ascpy",objs + swigobj
68 , LIBS = ['ascend'] + env['PYTHON_LIB']
69 , LIBPATH = ['#'] + env['PYTHON_LIBPATH']
70 , SHLIBPREFIX = '_'
71 )
72
73 #---------------------------------------------
74 # CONFIG & runtime shell script for posix
75
76 configpy = env.SubstInFile(source='config.py.in')
77 configh = env.SubstInFile(source='config.h.in')
78
79 if platform.system() != "Windows" or env.has_key('IS_MINGW'):
80 ascendcmd = env.SubstInFile(source='ascend.in')
81 env.AddPostAction(ascendcmd, 'chmod 755 $TARGET')
82
83 #---------------------------------------------
84 # LITTLE WEE TEST PROGRAM for debuggin the c++ wrapper
85 #
86 #libascxx = env.SharedLibrary('ascxx',objs
87 # , LIBS = ['ascend'] + env['PYTHON_LIB']
88 # , LIBPATH = ['.'] + ['#'] + env['PYTHON_LIBPATH']
89 #)
90 #
91 #ascxxtest = env.Program('ascxxtest',['ascxxtest.cpp']
92 # , LIBS = ['ascxx','ascend']
93 # , LIBPATH = ['.','#']
94 #)
95 #
96 #env.Alias('ascxx',ascxxtest)
97
98 #---------------------------------------------
99 # INSTALLATION
100
101 if env.get('CAN_INSTALL'):
102 env.InstallProgram(env['INSTALL_ROOT']+env['INSTALL_BIN'],ascendcmd)
103
104 import glob
105 pythonfiles = glob.glob("*.py")
106
107 env.Install(env['INSTALL_ROOT']+env['INSTALL_DATA']+"/ascend/",pythonfiles)
108
109 gladefiles = glob.glob("glade/*")
110 env.Install(env['INSTALL_ROOT']+env['INSTALL_DATA']+"/ascend/glade/",gladefiles)
111
112 env.Install(env['INSTALL_ROOT']+env['INSTALL_DATA']+"/ascend/",swiglib)
113
114 if env.get('WITH_INSTALLER'):
115 import platform
116 if platform.system()=="Windows":
117 env.Append(NSISDEFINES={'OUTFILE':env['WIN_INSTALLER_NAME']})
118 installer = env.Installer('create.nsi')
119 Depends(installer,[swiglib,configpy,configh])

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