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

Contents of /trunk/pygtk/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 743 - (show annotations) (download)
Thu Jul 6 14:22:26 2006 UTC (14 years, 4 months ago) by johnpye
File size: 3455 byte(s)
Few small changes to fix for Linux after the recent MSVC++ oriented changes.
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 integrator.cpp
15 integratorreporter.cpp
16 """)
17
18 # Build a static library with all the sources
19
20 python_env = env.Copy()
21
22 import platform
23
24 if platform.system()=='Windows' and env.get('MSVS'):
25 python_env.Append(CCFLAGS=['/EHsc']) # for exceptions (as suggested by a MSVC error msg, dunno if it's right or not -- JP)
26
27 swig_has_gccvisibility = False
28 min,maj,pat = env['SWIGVERSION']
29 if min==1 and maj==3 and pat>=29:
30 swig_has_gccvisibility = True
31
32 if env.get('HAVE_GCC'):
33 python_env.Append(CPPFLAGS=['-O3'])
34 if swig_has_gccvisibility and env.has_key('HAVE_GCCVISIBILITY'):
35 python_env.Append(CCFLAGS=['-fvisibility=hidden']);
36
37 objs = []
38
39 python_env.AppendUnique(CPPPATH=['#base/generic']+env['PYTHON_CPPPATH'])
40
41 for s in srcs:
42 objs += python_env.SharedObject(s)
43
44 #----------------------------------------------
45 # SWIG wrapper
46
47 def get_new_swig_flags(env):
48 min,maj,pat = env['SWIGVERSION']
49 flags = []
50 if min==1 and maj==3 and pat>=28:
51 flags += ['-O']
52 return flags
53
54 swigobj = python_env.SharedObject('ascpy.i'
55 , SWIGFLAGS=['-python','-c++'] + get_new_swig_flags(env)
56 )
57 python_env.SideEffect(['ascpy.py','ascpy_wrap.h'],'ascpy$SWIGCXXFILESUFFIX')
58 python_env.Depends('ascpy.py',['ascpy.i'])
59 python_env.Clean('ascpy_wrap$SWIGCXXFILESUFFIX',swigobj)
60 python_env.Clean('ascpy.py','ascpy$SWIGCXXFILESUFFIX')
61 python_env.Clean('ascpy_wrap.h','ascpy$SWIGCXXFILESUFFIX')
62
63 _libs = ['ascend']+env['PYTHON_LIB']
64 if not env.get('MSVS'):
65 _libs.append('stdc++')
66
67 swiglib = python_env.SharedLibrary("ascpy",objs + swigobj
68 , LIBS = _libs
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.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",pythonfiles)
108
109 gladefiles = glob.glob("glade/*")
110 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/glade/",gladefiles)
111
112 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",swiglib)
113
114 import platform
115 if platform.system()=="Windows":
116 env.Append(NSISDEFINES={'OUTFILE':env['WIN_INSTALLER_NAME']})
117 installer = env.Installer('create.nsi')
118 Depends(installer,[swiglib,configpy,configh])
119 env.Alias('installer',installer)

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