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

Contents of /trunk/pygtk/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 629 - (show annotations) (download)
Wed May 24 04:34:25 2006 UTC (14 years, 6 months ago) by johnpye
File size: 3320 byte(s)
Added changes to allow autotools build on ubuntu. There were some wrong assumptions
about file locations that I was able to correct using information in the 
tclConfig.sh and tkConfig.sh files. This will need testing on Fedora/Unix/etc.
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
21 import platform
22
23 if platform.system()=='Windows' and env.get('MSVS'):
24 python_env.Append(CCFLAGS=['/EHsc']) # for exceptions (as suggested by a MSVC error msg, dunno if it's right or not -- JP)
25
26 swig_has_gccvisibility = False
27 min,maj,pat = env['SWIGVERSION']
28 if min==1 and maj==3 and pat>=29:
29 swig_has_gccvisibility = True
30
31 if env.get('HAVE_GCC'):
32 python_env.Append(CPPFLAGS=['-O3'])
33 if swig_has_gccvisibility and env.has_key('HAVE_GCCVISIBILITY'):
34 python_env.Append(CCFLAGS=['-fvisibility=hidden']);
35
36 objs = []
37
38 python_env.Append(CPPPATH=['#base/generic']+env['PYTHON_CPPPATH'])
39
40 for s in srcs:
41 objs += python_env.SharedObject(s)
42
43 #----------------------------------------------
44 # SWIG wrapper
45
46 def get_new_swig_flags(env):
47 min,maj,pat = env['SWIGVERSION']
48 flags = []
49 if min==1 and maj==3 and pat>=28:
50 flags += ['-O']
51 return flags
52
53 swigobj = python_env.SharedObject('ascpy.i'
54 , SWIGFLAGS=['-python','-c++'] + get_new_swig_flags(env)
55 )
56 python_env.SideEffect(['ascpy.py','ascpy_wrap.h'],'ascpy$SWIGCXXFILESUFFIX')
57 python_env.Clean('ascpy_wrap$SWIGCXXFILESUFFIX',swigobj)
58 python_env.Clean('ascpy.py','ascpy$SWIGCXXFILESUFFIX')
59 python_env.Clean('ascpy_wrap.h','ascpy$SWIGCXXFILESUFFIX')
60
61 swiglib = python_env.SharedLibrary("ascpy",objs + swigobj
62 , LIBS = ['ascend'] + env['PYTHON_LIB'] + ['stdc++']
63 , LIBPATH = ['#'] + env['PYTHON_LIBPATH']
64 , SHLIBPREFIX = '_'
65 )
66
67 #---------------------------------------------
68 # CONFIG & runtime shell script for posix
69
70 configpy = env.SubstInFile(source='config.py.in')
71 configh = env.SubstInFile(source='config.h.in')
72
73 if platform.system() != "Windows" or env.has_key('IS_MINGW'):
74 ascendcmd = env.SubstInFile(source='ascend.in')
75 env.AddPostAction(ascendcmd, 'chmod 755 $TARGET')
76
77 #---------------------------------------------
78 # LITTLE WEE TEST PROGRAM for debuggin the c++ wrapper
79 #
80 #libascxx = env.SharedLibrary('ascxx',objs
81 # , LIBS = ['ascend'] + env['PYTHON_LIB']
82 # , LIBPATH = ['.'] + ['#'] + env['PYTHON_LIBPATH']
83 #)
84 #
85 #ascxxtest = env.Program('ascxxtest',['ascxxtest.cpp']
86 # , LIBS = ['ascxx','ascend']
87 # , LIBPATH = ['.','#']
88 #)
89 #
90 #env.Alias('ascxx',ascxxtest)
91
92 #---------------------------------------------
93 # INSTALLATION
94
95 if env.get('CAN_INSTALL'):
96 env.InstallProgram(env['INSTALL_ROOT']+env['INSTALL_BIN'],ascendcmd)
97
98 import glob
99 pythonfiles = glob.glob("*.py")
100
101 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",pythonfiles)
102
103 gladefiles = glob.glob("glade/*")
104 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/glade/",gladefiles)
105
106 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",swiglib)
107
108 if env.get('WITH_INSTALLER'):
109 import platform
110 if platform.system()=="Windows":
111 env.Append(NSISDEFINES={'OUTFILE':env['WIN_INSTALLER_NAME']})
112 installer = env.Installer('create.nsi')
113 Depends(installer,[swiglib,configpy,configh])

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