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

Annotation of /trunk/pygtk/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2027 - (hide annotations) (download)
Thu Apr 30 08:27:56 2009 UTC (14 years, 10 months ago) by jpye
File size: 5143 byte(s)
Bump version to 0.9.6.
Documented changes since last release in CHANGELOG.txt
1 jpye 2007 #!/usr/bin/env python
2 johnpye 387 Import('env')
3    
4 johnpye 908 import platform
5    
6 johnpye 387 srcs = Split("""
7 johnpye 770 library.cpp compiler.cpp type.cpp module.cpp symchar.cpp
8 johnpye 387 instance.cpp instanceinterfacedata.cpp
9 johnpye 1126 matrix.cpp method.cpp name.cpp
10 johnpye 387 reporter.cpp simulation.cpp set.cpp units.cpp dimensions.cpp extmethod.cpp
11 johnpye 869 variable.cpp registry.cpp relation.cpp
12 johnpye 387 solver.cpp curve.cpp plot.cpp
13     solverparameters.cpp solverparameter.cpp solverparameteriterator.cpp
14     solverstatus.cpp solverreporter.cpp
15     incidencematrix.cpp
16 johnpye 669 integrator.cpp
17     integratorreporter.cpp
18 johnpye 897 annotation.cpp
19 johnpye 387 """)
20    
21 johnpye 395 # Build a static library with all the sources
22    
23 jpye 1786 python_env = env.Clone()
24 johnpye 502
25 johnpye 552 if platform.system()=='Windows' and env.get('MSVS'):
26 johnpye 508 python_env.Append(CCFLAGS=['/EHsc']) # for exceptions (as suggested by a MSVC error msg, dunno if it's right or not -- JP)
27 johnpye 502
28 johnpye 509 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 johnpye 552 if env.get('HAVE_GCC'):
34 johnpye 979 #python_env.Append(CPPFLAGS=['-O3'])
35 johnpye 509 if swig_has_gccvisibility and env.has_key('HAVE_GCCVISIBILITY'):
36 johnpye 508 python_env.Append(CCFLAGS=['-fvisibility=hidden']);
37 johnpye 502
38 johnpye 463 objs = []
39 johnpye 508
40 jpye 2018 python_env.AppendUnique(
41     CPPPATH=env['PYTHON_CPPPATH']
42     )
43 johnpye 508
44 jpye 2018 print "PYTHON_CPPPATH = %s" % env['PYTHON_CPPPATH']
45    
46 johnpye 463 for s in srcs:
47 jpye 2018 objs += python_env.SharedObject(s)
48 johnpye 500
49 johnpye 398 #----------------------------------------------
50 johnpye 529 # SWIG wrapper
51 johnpye 398
52 johnpye 478 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 johnpye 482 flags += ['-O']
57 johnpye 1112 sep = ":"
58     if platform.system=="Windows": sep=";"
59    
60 jpye 2016 #print "FLAGS=%s" % env.get('GRAPHVIZ_CPPPATH')
61 jpye 1678 if env.get('WITH_GRAPHVIZ') and env.get('GRAPHVIZ_CPPPATH'):
62 jpye 1853 flags += ['-I%s' % i for i in env.get('GRAPHVIZ_CPPPATH')]
63 jpye 1720
64     if 'msvcr71' in env['LIBS']:
65     flags += ['-DHAVE_MSVCR71']
66    
67 johnpye 478 return flags
68 johnpye 395
69 jpye 1786 swig_env = python_env.Clone()
70 johnpye 929 if '-Wall' in swig_env.get('CCFLAGS'):
71     swig_env['CCFLAGS'] = swig_env['CCFLAGS'].remove('-Wall')
72 johnpye 925
73 jpye 1467 if platform.system()=="Windows":
74     swig_env['SHLIBSUFFIX']='.pyd'
75 jpye 1720 if 'msvcr71' in env['LIBS']:
76     swig_env.Append(CPPDEFINES=['HAVE_MSVCR71'])
77 jpye 1467
78 johnpye 932 swigobjs = []
79 johnpye 519
80 johnpye 932 for swigf in Split("""
81     ascpy.i
82     """):
83     swigobj = swig_env.SharedObject(swigf
84     , SWIGFLAGS=['-python','-c++'] + get_new_swig_flags(env)
85     )
86 jpye 1786 #swig_env.SideEffect(['ascpy.py','ascpy_wrap.h'],'ascpy$SWIGCXXFILESUFFIX')
87 jpye 1440 swig_env.Depends('ascpy$SWIGCXXFILESUFFIX',['ascpy.i','solver.i','plot.i'])
88 johnpye 932 swig_env.Clean('ascpy_wrap$SWIGCXXFILESUFFIX',swigobj)
89     swig_env.Clean('ascpy.py','ascpy$SWIGCXXFILESUFFIX')
90     swig_env.Clean('ascpy_wrap.h','ascpy$SWIGCXXFILESUFFIX')
91    
92     swigobjs.append(swigobj)
93    
94 jpye 1720 swig_env.Append(LIBS = ['ascend']+env['PYTHON_LIB'])
95     swig_env.Append(LIBPATH = ['#'] + env['PYTHON_LIBPATH'])
96 johnpye 960 swig_env.Append(LINKFLAGS=env['PYTHON_LINKFLAGS'])
97 johnpye 938
98 johnpye 742 if not env.get('MSVS'):
99 johnpye 938 swig_env.Append(LIBS = ['stdc++'])
100 johnpye 742
101 johnpye 938 if env.get('WITH_DMALLOC'):
102     swig_env.Append(LIBS = ['dmalloc'])
103 johnpye 1111 swig_env.AppendUnique(LIBPATH = [env.get('DMALLOC_LIBPATH')])
104 johnpye 938
105 jpye 1678 if env.get('WITH_GRAPHVIZ'):
106     swig_env.Append(LIBS = env['GRAPHVIZ_LIBS'])
107     swig_env.AppendUnique(LIBPATH = [env.get('GRAPHVIZ_LIBPATH')])
108 johnpye 1111
109 johnpye 932 swiglib = swig_env.SharedLibrary("ascpy",objs + swigobjs
110 johnpye 392 , SHLIBPREFIX = '_'
111 johnpye 387 )
112 johnpye 529
113     #---------------------------------------------
114     # CONFIG & runtime shell script for posix
115    
116 johnpye 505 configpy = env.SubstInFile(source='config.py.in')
117     configh = env.SubstInFile(source='config.h.in')
118 johnpye 393
119 jpye 2027 ascendcmd = env.SubstInFile(source='ascend.in')
120     env.AddPostAction(ascendcmd, 'chmod 755 $TARGET')
121    
122 johnpye 529 if platform.system() != "Windows" or env.has_key('IS_MINGW'):
123 jpye 1786 envdev = env.Clone()
124 jpye 1747 # add 'WITH_SOLVERS' to the SUBST_DICT used by ascdev...
125     envdev['SUBST_DICT']['@WITH_SOLVERS@'] = ",".join(env.get('WITH_SOLVERS'))
126     ascdevcmd = envdev.SubstInFile(source='ascdev.in')
127 johnpye 858 env.AddPostAction(ascdevcmd, 'chmod 755 $TARGET')
128 johnpye 436
129 johnpye 435 #---------------------------------------------
130 johnpye 529 # LITTLE WEE TEST PROGRAM for debuggin the c++ wrapper
131 johnpye 961 # currently out of order because of need for a separate builddir due to ASCXX_WITH_PYTHON flag taking different value
132 johnpye 542 #
133     #libascxx = env.SharedLibrary('ascxx',objs
134     # , LIBS = ['ascend'] + env['PYTHON_LIB']
135     # , LIBPATH = ['.'] + ['#'] + env['PYTHON_LIBPATH']
136     #)
137 jpye 1803
138     ipopttest = swig_env.Program('testipopt',['testipopt.cpp'] + objs)
139    
140 johnpye 542 #env.Alias('ascxx',ascxxtest)
141 johnpye 529
142     #---------------------------------------------
143 johnpye 435 # INSTALLATION
144    
145 jpye 1408 # python compile bytecode
146    
147     import py_compile
148     def pyc_build(target, source, env):
149     py_compile.compile(str(source[0]),str(target[0]),"",True)
150     return None
151     env.Append(BUILDERS = {'PYC' : Builder(action = pyc_build,suffix='.pyc',src_suffix='.py')})
152    
153 johnpye 552 if env.get('CAN_INSTALL'):
154 jpye 1436 env.InstallProgram(Dir(env.subst("$INSTALL_ROOT$INSTALL_BIN")),ascendcmd)
155 johnpye 435
156 johnpye 463 import glob
157     pythonfiles = glob.glob("*.py")
158 johnpye 435
159 jpye 1408 pythonpycs = []
160     for f in pythonfiles:
161     pythonpycs.append( env.PYC(f) )
162    
163     for f in pythonfiles + pythonpycs:
164 jpye 2016 env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_PYTHON")),f)
165 jpye 1408
166 jpye 2016 env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_PYTHON")),"config.py")
167 johnpye 435
168 johnpye 463 gladefiles = glob.glob("glade/*")
169 jpye 1436 env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_ASCDATA/glade")),gladefiles)
170 johnpye 435
171 jpye 2007 env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_PYTHON")),swiglib)
172 jpye 1465
173 johnpye 811 # vim: set syntax=python:
174    

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