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

Annotation of /trunk/pygtk/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1413 - (hide annotations) (download)
Tue Apr 24 13:34:35 2007 UTC (16 years, 10 months ago) by jpye
File size: 4932 byte(s)
Almost there with the debian package now
1 johnpye 387 Import('env')
2    
3 johnpye 908 import platform
4    
5 johnpye 387 srcs = Split("""
6 johnpye 770 library.cpp compiler.cpp type.cpp module.cpp symchar.cpp
7 johnpye 387 instance.cpp instanceinterfacedata.cpp
8 johnpye 1126 matrix.cpp method.cpp name.cpp
9 johnpye 387 reporter.cpp simulation.cpp set.cpp units.cpp dimensions.cpp extmethod.cpp
10 johnpye 869 variable.cpp registry.cpp relation.cpp
11 johnpye 387 solver.cpp curve.cpp plot.cpp
12     solverparameters.cpp solverparameter.cpp solverparameteriterator.cpp
13     solverstatus.cpp solverreporter.cpp
14     incidencematrix.cpp
15 johnpye 669 integrator.cpp
16     integratorreporter.cpp
17 johnpye 897 annotation.cpp
18 johnpye 387 """)
19    
20 johnpye 395 # Build a static library with all the sources
21    
22 johnpye 508 python_env = env.Copy()
23 johnpye 502
24 johnpye 552 if platform.system()=='Windows' and env.get('MSVS'):
25 johnpye 508 python_env.Append(CCFLAGS=['/EHsc']) # for exceptions (as suggested by a MSVC error msg, dunno if it's right or not -- JP)
26 johnpye 502
27 johnpye 509 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 johnpye 552 if env.get('HAVE_GCC'):
33 johnpye 979 #python_env.Append(CPPFLAGS=['-O3'])
34 johnpye 509 if swig_has_gccvisibility and env.has_key('HAVE_GCCVISIBILITY'):
35 johnpye 508 python_env.Append(CCFLAGS=['-fvisibility=hidden']);
36 johnpye 502
37 johnpye 463 objs = []
38 johnpye 508
39 johnpye 743 python_env.AppendUnique(CPPPATH=['#base/generic']+env['PYTHON_CPPPATH'])
40 johnpye 508
41 johnpye 463 for s in srcs:
42 johnpye 508 objs += python_env.SharedObject(s)
43 johnpye 500
44 johnpye 398 #----------------------------------------------
45 johnpye 529 # SWIG wrapper
46 johnpye 398
47 johnpye 478 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 johnpye 482 flags += ['-O']
52 johnpye 1112 sep = ":"
53     if platform.system=="Windows": sep=";"
54    
55     print "FLAGS=%s" % env.get('MFGRAPH_CPPPATH')
56     if env.get('WITH_MFGRAPH') and env.get('MFGRAPH_CPPPATH'):
57     flags += ['-I%s' % i for i in env.get('MFGRAPH_CPPPATH').split(sep)]
58 johnpye 478 return flags
59 johnpye 395
60 johnpye 925 swig_env = python_env.Copy()
61 johnpye 929 if '-Wall' in swig_env.get('CCFLAGS'):
62     swig_env['CCFLAGS'] = swig_env['CCFLAGS'].remove('-Wall')
63 johnpye 925
64 johnpye 932 swigobjs = []
65 johnpye 519
66 johnpye 932 for swigf in Split("""
67     ascpy.i
68     """):
69     swigobj = swig_env.SharedObject(swigf
70     , SWIGFLAGS=['-python','-c++'] + get_new_swig_flags(env)
71     )
72     swig_env.SideEffect(['ascpy.py','ascpy_wrap.h'],'ascpy$SWIGCXXFILESUFFIX')
73 jpye 1380 swig_env.Depends('ascpy$SWIGCXXFILESUFFIX',['ascpy.i','solver.i'])
74 johnpye 932 swig_env.Clean('ascpy_wrap$SWIGCXXFILESUFFIX',swigobj)
75     swig_env.Clean('ascpy.py','ascpy$SWIGCXXFILESUFFIX')
76     swig_env.Clean('ascpy_wrap.h','ascpy$SWIGCXXFILESUFFIX')
77    
78     swigobjs.append(swigobj)
79    
80 johnpye 960 swig_env['LIBS'] = ['ascend']+env['PYTHON_LIB']
81 johnpye 938 swig_env['LIBPATH'] = ['#'] + env['PYTHON_LIBPATH']
82 johnpye 960 swig_env.Append(LINKFLAGS=env['PYTHON_LINKFLAGS'])
83 johnpye 938
84 johnpye 742 if not env.get('MSVS'):
85 johnpye 938 swig_env.Append(LIBS = ['stdc++'])
86 johnpye 742
87 johnpye 938 if env.get('WITH_DMALLOC'):
88     swig_env.Append(LIBS = ['dmalloc'])
89 johnpye 1111 swig_env.AppendUnique(LIBPATH = [env.get('DMALLOC_LIBPATH')])
90 johnpye 938
91 johnpye 1111 if env.get('WITH_MFGRAPH'):
92     swig_env.Append(LIBS = ['mfgraph'])
93     swig_env.AppendUnique(LIBPATH = [env.get('MFGRAPH_LIBPATH')])
94    
95 johnpye 932 swiglib = swig_env.SharedLibrary("ascpy",objs + swigobjs
96 johnpye 392 , SHLIBPREFIX = '_'
97 johnpye 387 )
98 johnpye 529
99     #---------------------------------------------
100     # CONFIG & runtime shell script for posix
101    
102 johnpye 505 configpy = env.SubstInFile(source='config.py.in')
103     configh = env.SubstInFile(source='config.h.in')
104 johnpye 393
105 johnpye 529 if platform.system() != "Windows" or env.has_key('IS_MINGW'):
106     ascendcmd = env.SubstInFile(source='ascend.in')
107     env.AddPostAction(ascendcmd, 'chmod 755 $TARGET')
108 johnpye 858 ascdevcmd = env.SubstInFile(source='ascdev.in')
109     env.AddPostAction(ascdevcmd, 'chmod 755 $TARGET')
110 johnpye 436
111 johnpye 435 #---------------------------------------------
112 johnpye 529 # LITTLE WEE TEST PROGRAM for debuggin the c++ wrapper
113 johnpye 961 # currently out of order because of need for a separate builddir due to ASCXX_WITH_PYTHON flag taking different value
114 johnpye 542 #
115     #libascxx = env.SharedLibrary('ascxx',objs
116     # , LIBS = ['ascend'] + env['PYTHON_LIB']
117     # , LIBPATH = ['.'] + ['#'] + env['PYTHON_LIBPATH']
118     #)
119     #
120 johnpye 1228 idatest = swig_env.Program('idatest',['idatest.cpp'] + objs)
121 johnpye 542 #
122     #env.Alias('ascxx',ascxxtest)
123 johnpye 529
124     #---------------------------------------------
125 johnpye 435 # INSTALLATION
126    
127 jpye 1408 # python compile bytecode
128    
129     import py_compile
130     def pyc_build(target, source, env):
131     py_compile.compile(str(source[0]),str(target[0]),"",True)
132     return None
133     env.Append(BUILDERS = {'PYC' : Builder(action = pyc_build,suffix='.pyc',src_suffix='.py')})
134    
135 johnpye 552 if env.get('CAN_INSTALL'):
136 johnpye 463 env.InstallProgram(env['INSTALL_ROOT']+env['INSTALL_BIN'],ascendcmd)
137 johnpye 435
138 johnpye 463 import glob
139     pythonfiles = glob.glob("*.py")
140 johnpye 435
141 jpye 1408 pythonpycs = []
142     for f in pythonfiles:
143     pythonpycs.append( env.PYC(f) )
144    
145     for f in pythonfiles + pythonpycs:
146     env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",f)
147    
148 johnpye 1096 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/","config.py")
149 johnpye 435
150 johnpye 463 gladefiles = glob.glob("glade/*")
151 johnpye 629 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/glade/",gladefiles)
152 johnpye 435
153 johnpye 629 env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_ASCDATA']+"/",swiglib)
154 johnpye 466
155 johnpye 631 if platform.system()=="Windows":
156 jpye 1382 env.Append(NSISDEFINES={'OUTFILE':"#dist/$WIN_INSTALLER_NAME'"})
157 johnpye 631 installer = env.Installer('create.nsi')
158 johnpye 922 Depends(installer,[swiglib,configpy,configh,"../models","../ascend-config"])
159 johnpye 631 env.Alias('installer',installer)
160 johnpye 811
161     # vim: set syntax=python:
162    

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