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

Contents of /trunk/pygtk/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 922 - (show annotations) (download)
Wed Nov 8 05:25:37 2006 UTC (16 years ago) by johnpye
File size: 3641 byte(s)
Expanded the 'ascend-config' mechanism to be supported in Windows installations (On Windows, ascend-config is installed in $INSTDIR and uses the registry instead of hard-coded file paths).

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

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