/[escript]/branches/scons-dev/SConstruct
ViewVC logotype

Annotation of /branches/scons-dev/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1655 - (hide annotations)
Wed Jul 16 05:10:10 2008 UTC (12 years, 3 months ago) by ksteube
File size: 20154 byte(s)
Compiles and runs under MPI, and without compiler warnings.
Improved compiler options.
saveVTK() issues a warning (not an error) if VTK is unavailable.

1 jongui 961 # Copyright 2006 by ACcESS MNRF
2 jgs 214 #
3 matt 863 # http://www.access.edu.au
4     # Primary Business: Queensland, Australia
5     # Licensed under the Open Software License version 3.0
6     # http://www.opensource.org/licenses/osl-3.0.php
7 jgs 455
8 ksteube 1641 # TODO use Install() to install python files instead of custom builder build_py?
9     # TODO How to modify CCFLAGS for only one file? Look for example with Program(...)
10     # TODO use USE_VTK in saveVTK to enable/disable this method
11     # TODO set CPPDEFINES and CXXDEFINES the same
12 ksteube 1647 # TODO configure for both 96.91 and 98.03
13 ksteube 1641
14 robwdcock 682 EnsureSConsVersion(0,96,91)
15     EnsurePythonVersion(2,3)
16 jgs 214
17 ksteube 1641 import sys, os, re, socket
18    
19 robwdcock 682 # Add our extensions
20 ksteube 1641 if os.path.isdir('scons'): sys.path.append('scons')
21 robwdcock 682 import scons_extensions
22 jgs 192
23 ksteube 1641 # The string python2.4 or python2.5
24     python_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
25 gross 1374
26 ksteube 1641 # Which /usr/lib? Prefer /usr/lib64 if available for 64-bit systems
27     usr_lib = '/usr/lib'
28     if os.path.isdir('/usr/lib64'): usr_lib = '/usr/lib64'
29 gross 806
30 ksteube 1641 # MS Windows support, many thanks to PH
31     IS_WINDOWS_PLATFORM = (os.name== "nt")
32 gross 806
33 ksteube 1641 prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)
34 gross 1133 print "Install prefix is: ", prefix
35 gross 806
36 ksteube 1641 # Read configuration options from file scons/<hostname>_options.py
37     hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])
38     tmp = os.path.join("scons",hostname+"_options.py")
39     options_file = ARGUMENTS.get('options_file', tmp)
40     if not os.path.isfile(options_file): options_file = False
41 ksteube 1217
42 ksteube 1641 # Is setting options based on compiler name adequate instead of these?
43     # If scons/<hostname>_options.py not found try to specify defaults based on OS
44     #if not options_file:
45     # if IS_WINDOWS_PLATFORM:
46     # options_file = "scons/windows_mscv71_options.py"
47     # else:
48     # options_file = "scons/linux_gcc_eg_options.py"
49 phornby 1246
50 ksteube 1641 # Load options file and command-line arguments
51 gross 1133 opts = Options(options_file, ARGUMENTS)
52 gross 1149
53 gross 1133 #==============================================================================================
54     # Default options and options help text
55     # These are defaults and can be overridden using command line arguments or an options file.
56     # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
57     # DO NOT CHANGE THEM HERE
58 robwdcock 682 opts.AddOptions(
59     # Where to install esys stuff
60 ksteube 1217 ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),
61 ksteube 1641 ('libinstall', 'where the esys libraries will be installed', os.path.join(prefix,"lib")),
62     ('pyinstall', 'where the esys python modules will be installed', os.path.join(prefix,"esys")),
63 robwdcock 682 # Compilation options
64 ksteube 1652 BoolOption('dodebug', 'For backwards compatibility', 'no'),
65     BoolOption('usedebug', 'Do you want a debug build?', 'no'),
66     BoolOption('usevtk', 'Do you want to use VTK?', 'yes'),
67 ksteube 1641 ('options_file', "File of paths/options. Default: scons/<hostname>_options.py", options_file),
68 robwdcock 682 ('cc_defines','C/C++ defines to use', None),
69 ksteube 1641 ('cc_flags', 'C compiler flags to use', '-DEFAULT_1'),
70 ksteube 1655 ('cc_optim', 'C compiler optimization flags to use', '-DEFAULT_2'),
71     ('cc_debug', 'C compiler debug flags to use', '-DEFAULT_3'),
72     ('omp_optim', 'OpenMP compiler flags to use (Release build)', '-DEFAULT_4'),
73     ('omp_debug', 'OpenMP compiler flags to use (Debug build)', '-DEFAULT_5'),
74 ksteube 1647 ('sys_libs', 'System libraries to link with', []),
75 ksteube 1641 ('ar_flags', 'Static library archiver flags to use', ''),
76 ksteube 1655 BoolOption('useopenmp', 'Compile parallel version using OpenMP', 'yes'),
77 ksteube 1641 # Python
78 ksteube 1652 PathOption('python_path', 'Path to Python includes', '/usr/include/'+python_version),
79     PathOption('python_lib_path', 'Path to Python libs', usr_lib),
80     ('python_lib', 'Python libraries to link with', [python_version]),
81 ksteube 1641 ('python_cmd', 'Python command', 'python'),
82     # Boost
83     PathOption('boost_path', 'Path to Boost includes', "/usr/include"),
84     PathOption('boost_lib_path', 'Path to Boost libs', usr_lib),
85     ('boost_lib', 'Boost libraries to link with', ['boost_python']),
86 ksteube 1652 # NetCDF
87     BoolOption('usenetcdf', 'switch on/off the usage of netCDF', 'yes'),
88 ksteube 1641 PathOption('netCDF_path', 'Path to netCDF includes', '/usr/include'),
89     PathOption('netCDF_lib_path', 'Path to netCDF libs', usr_lib),
90     ('netCDF_libs', 'netCDF C++ libraries to link with', ['netcdf_c++', 'netcdf']),
91     # MPI
92 ksteube 1652 BoolOption('useMPI', 'For backwards compatibility', 'no'),
93     BoolOption('usempi', 'Compile parallel version using MPI', 'no'),
94 ksteube 1641 ('MPICH_IGNORE_CXX_SEEK', 'name of macro to ignore MPI settings of C++ SEEK macro (for MPICH)' , 'MPICH_IGNORE_CXX_SEEK'),
95     PathOption('mpi_path', 'Path to MPI includes', '/usr/include'),
96     ('mpi_run', 'mpirun name' , 'mpiexec -np 1'),
97     PathOption('mpi_lib_path', 'Path to MPI libs (needs to be added to the LD_LIBRARY_PATH)', usr_lib),
98     ('mpi_libs', 'MPI libraries to link with (needs to be shared!)', ['mpich' , 'pthread', 'rt']),
99     # ParMETIS
100 ksteube 1652 BoolOption('useparmetis', 'Compile parallel version using ParMETIS', 'yes'),
101 ksteube 1641 ('parmetis_path', 'Path to ParMETIS includes', '/usr/include'),
102     ('parmetis_lib_path', 'Path to ParMETIS library', usr_lib),
103     ('parmetis_libs', 'ParMETIS library to link with', []),
104     # PAPI
105     PathOption('papi_path', 'Path to PAPI includes', None),
106     PathOption('papi_lib_path', 'Path to PAPI libs', None),
107     ('papi_libs', 'PAPI libraries to link with', []),
108 ksteube 1652 BoolOption('papi_instrument_solver', 'use PAPI in Solver.c to instrument each iteration of the solver', False),
109 robwdcock 682 # MKL
110 matt 863 PathOption('mkl_path', 'Path to MKL includes', None),
111     PathOption('mkl_lib_path', 'Path to MKL libs', None),
112 ksteube 1641 ('mkl_libs', 'MKL libraries to link with', []),
113 matt 863 # UMFPACK
114 ksteube 1641 PathOption('ufc_path', 'Path to UFconfig includes', '/usr/include'),
115     PathOption('umf_path', 'Path to UMFPACK includes', '/usr/include'),
116     PathOption('umf_lib_path', 'Path to UMFPACK libs', usr_lib),
117     ('umf_libs', 'UMFPACK libraries to link with', []),
118 gross 806 # AMD (used by UMFPACK)
119 ksteube 1641 PathOption('amd_path', 'Path to AMD includes', '/usr/include'),
120     PathOption('amd_lib_path', 'Path to AMD libs', usr_lib),
121     ('amd_libs', 'AMD libraries to link with', []),
122 gross 805 # BLAS
123 matt 863 PathOption('blas_path', 'Path to BLAS includes', None),
124     PathOption('blas_lib_path', 'Path to BLAS libs', None),
125 ksteube 1641 ('blas_libs', 'BLAS libraries to link with', []),
126 robwdcock 682 )
127 phornby 1232
128 ksteube 1647 # Specify which compilers to use (intelc uses regular expressions
129     # improperly and emits a warning about failing to find the compilers.
130 ksteube 1655 # This warning can be safely ignored)
131 ksteube 1647
132 gross 1133 if IS_WINDOWS_PLATFORM:
133     env = Environment(tools = ['default', 'msvc'], options = opts)
134 robwdcock 682 else:
135 ksteube 1559 if socket.gethostname().split('.')[0] == 'service0':
136 gross 1133 env = Environment(tools = ['default', 'intelc'], options = opts)
137 ksteube 1559 elif os.uname()[4]=='ia64':
138     env = Environment(tools = ['default', 'intelc'], options = opts)
139 gross 1133 if env['CXX'] == 'icpc':
140 ksteube 1641 env['LINK'] = env['CXX'] # version >=9 of intel c++ compiler requires use of icpc to link in C++ runtimes (icc does not)
141 gross 1133 else:
142     env = Environment(tools = ['default'], options = opts)
143     Help(opts.GenerateHelpText(env))
144 phornby 1232
145 ksteube 1647 # Default compiler options (override allowed in hostname_options.py, but should not be necessary)
146 ksteube 1655 # For both C and C++ you get: cc_flags and either the optim flags or debug flags
147 ksteube 1641 if env["CC"] == "icc":
148     # Intel compilers
149 ksteube 1655 cc_flags = "-fPIC -ansi -wd161 -w1 -vec-report0 -DBLOCKTIMER -DCORE_ID1"
150 ksteube 1641 cc_optim = "-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias"
151 ksteube 1653 cc_debug = "-g -O0 -UDOASSERT -DDOPROF"
152 ksteube 1655 omp_optim = "-openmp -openmp_report0"
153     omp_debug = "-openmp -openmp_report0"
154 ksteube 1641 elif env["CC"] == "gcc":
155     # GNU C on any system
156 ksteube 1655 cc_flags = "-fPIC -ansi -ffast-math -Wno-unknown-pragmas -pedantic-errors -Wno-long-long -DBLOCKTIMER"
157 ksteube 1641 cc_optim = "-O3"
158 ksteube 1653 cc_debug = "-g -O0 -UDOASSERT -DDOPROF"
159 ksteube 1655 omp_optim = ""
160     omp_debug = ""
161 ksteube 1641 elif env["CC"] == "cl":
162     # Microsoft Visual C on Windows
163     cc_flags = "/FD /EHsc /GR /wd4068 -D_USE_MATH_DEFINES -DDLL_NETCDF"
164     cc_optim = "/O2 /Op /MT /W3"
165     cc_debug = "/Od /RTC1 /MTd /ZI"
166 ksteube 1655 omp_optim = ""
167     omp_debug = ""
168 ksteube 1312
169 ksteube 1641 # If not specified in hostname_options.py then set them here
170     if env["cc_flags"] == "-DEFAULT_1": env['cc_flags'] = cc_flags
171 ksteube 1655 if env["cc_optim"] == "-DEFAULT_2": env['cc_optim'] = cc_optim
172     if env["cc_debug"] == "-DEFAULT_3": env['cc_debug'] = cc_debug
173     if env["omp_optim"] == "-DEFAULT_4": env['omp_optim'] = omp_optim
174     if env["omp_debug"] == "-DEFAULT_5": env['omp_debug'] = omp_debug
175 gross 1024
176 ksteube 1655 # OpenMP is disabled if useopenmp=no or both variables omp_optim and omp_debug are empty
177     if not env["useopenmp"]:
178     env['omp_optim'] = ""
179     env['omp_debug'] = ""
180    
181     if env['omp_optim'] == "" and env['omp_debug'] == "": env["useopenmp"] = 0
182    
183 ksteube 1641 # Get the global Subversion revision number for getVersion() method
184 gross 1024 try:
185 ksteube 1641 global_revision = os.popen("svnversion -n .").read()
186     global_revision = re.sub(":.*", "", global_revision)
187     global_revision = re.sub("[^0-9]", "", global_revision)
188     except:
189     global_revision="-1"
190 ksteube 1647 if global_revision == "": global_revision="-2"
191 ksteube 1641 env.Append(CPPDEFINES = ["SVN_VERSION="+global_revision])
192 phornby 1243
193 ksteube 1647 ############ Copy environment variables into scons env #########
194 ksteube 1312
195 ksteube 1641 try: env['ENV']['OMP_NUM_THREADS'] = os.environ['OMP_NUM_THREADS']
196     except KeyError: env['ENV']['OMP_NUM_THREADS'] = 1
197 gross 1160
198 ksteube 1641 try: env['ENV']['PATH'] = os.environ['PATH']
199     except KeyError: pass
200 ksteube 1312
201 ksteube 1641 try: env['ENV']['PYTHONPATH'] = os.environ['PYTHONPATH']
202     except KeyError: pass
203 gross 1163
204 ksteube 1641 try: env['ENV']['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
205     except KeyError: pass
206 phornby 1243
207 ksteube 1641 try: env['ENV']['LIBRARY_PATH'] = os.environ['LIBRARY_PATH']
208     except KeyError: pass
209 robwdcock 682
210 ksteube 1641 try: env['ENV']['DISPLAY'] = os.environ['DISPLAY']
211     except KeyError: pass
212 phornby 1244
213 ksteube 1641 try: env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']
214     except KeyError: pass
215 robwdcock 682
216 ksteube 1641 try: env['ENV']['HOME'] = os.environ['HOME']
217     except KeyError: pass
218 robwdcock 682
219 ksteube 1647 # A few creature conveniences
220 ksteube 1641 libinstall = env['libinstall']
221     incinstall = env['incinstall']
222     pyinstall = env['pyinstall']
223     sys_libs = env['sys_libs']
224 ksteube 1312
225 ksteube 1647 # Configure for test suite: python run_testname.py
226 ksteube 1641 env.PrependENVPath('PYTHONPATH', prefix)
227     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
228 ksteube 1312
229 ksteube 1652 # Backwards compatibility (we now use usedebug=yes and usempi=yes)
230     if env['dodebug']: env['usedebug'] = 1
231     if env['useMPI']: env['usempi'] = 1
232    
233 ksteube 1641 ############ Set up paths for Configure() ######################
234 ksteube 1312
235 ksteube 1647 # Add gcc option -I<Escript>/trunk/include
236 ksteube 1641 env.Append(CPPPATH = [Dir('include')])
237 ksteube 1312
238 ksteube 1647 # Add gcc option -L<Escript>/trunk/lib
239 ksteube 1641 env.Append(LIBPATH = [Dir('lib')])
240 ksteube 1312
241 ksteube 1641 # Create a Configure() environment only for checking existence of
242 ksteube 1647 # libraries and headers. Later we throw it away then build the real
243     # environment.
244 robwdcock 682 try:
245 ksteube 1641 conf = Configure(env.Clone()) # scons-98.03
246     except AttributeError:
247     conf = Configure(env.Copy()) # scons-96.92
248 ksteube 1312
249 ksteube 1641 # Must add all paths at first or Configure() can't cache results
250 ksteube 1652 conf.env.Append(CPPPATH = [env['python_path']])
251     conf.env.Append(LIBS = [env['python_lib']])
252     conf.env.Append(LIBPATH = [env['python_lib_path']])
253     conf.env.Append(CPPPATH = [env['boost_path']])
254     conf.env.Append(LIBS = [env['boost_lib']])
255     conf.env.Append(LIBPATH = [env['boost_lib_path']])
256     if env['usenetcdf']:
257     conf.env.Append(CPPPATH = [env['netCDF_path']])
258     conf.env.Append(LIBS = [env['netCDF_libs']])
259     conf.env.Append(LIBPATH = [env['netCDF_lib_path']])
260 ksteube 817
261 ksteube 1647 ############ numarray (required) ###############################
262 phornby 1246
263 ksteube 1641 try: from numarray import identity
264     except ImportError: sys.exit(1)
265 phornby 1634
266 ksteube 1652 ############ python libraries (required) #######################
267 phornby 1634
268 ksteube 1641 if not conf.CheckCHeader('Python.h'): sys.exit(1)
269     if not conf.CheckFunc('Py_Main'): sys.exit(1)
270 robwdcock 682
271 ksteube 1647 ############ boost (required) ##################################
272 ksteube 1348
273 ksteube 1641 if not conf.CheckCXXHeader('boost/python.hpp'): sys.exit(1)
274     if not conf.CheckFunc('PyObject_SetAttr'): sys.exit(1)
275 gross 700
276 ksteube 1647 ############ NetCDF (optional) #################################
277 gross 700
278 ksteube 1652 if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0
279     if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0
280 gross 806
281 ksteube 1647 ############ VTK (optional) ####################################
282 gross 806
283 ksteube 1652 if env['usevtk']:
284     try:
285     import vtk
286     except ImportError:
287     env['usevtk'] = 0
288 gross 805
289 ksteube 1647 ############ MPI (optional) ####################################
290 gross 805
291 ksteube 1653 if env['usempi']:
292 ksteube 1652 conf.env.Append(CPPPATH = [env['mpi_path']])
293     conf.env.Append(LIBS = [env['mpi_libs']])
294     conf.env.Append(LIBPATH = [env['mpi_lib_path']])
295 ksteube 1653 if not conf.CheckCHeader('mpi.h'): env['usempi'] = 0
296     if not conf.CheckFunc('MPI_Init'): env['usempi'] = 0
297 gross 805
298 ksteube 1647 ############ ParMETIS (optional) ###############################
299 ksteube 1312
300 ksteube 1653 if not env['usempi']: env['useparmetis'] = 0
301 ksteube 1312
302 ksteube 1652 if env['useparmetis']:
303     conf.env.Append(CPPPATH = [env['parmetis_path']])
304     conf.env.Append(LIBS = [env['parmetis_libs']])
305     conf.env.Append(LIBPATH = [env['parmetis_lib_path']])
306     if not conf.CheckCHeader('parmetis.h'): env['useparmetis'] = 0
307     if not conf.CheckFunc('ParMETIS_V3_PartGeomKway'): env['useparmetis'] = 0
308    
309 ksteube 1641 ############ Configure finished, now modify environment ########
310 ksteube 1312
311 ksteube 1641 conf.Finish()
312 ksteube 1312
313 ksteube 1641 # Enable debug
314 ksteube 1652 if env['usedebug']:
315 ksteube 1641 env.Append(CCFLAGS = env['cc_debug'])
316 ksteube 1655 env.Append(CCFLAGS = env['omp_debug'])
317 ksteube 1641 env.Append(CCFLAGS = env['cc_flags'])
318 ksteube 1647 env.Append(CPPDEFINES = ['BOUNDS_CHECK'])
319 ksteube 1312 else:
320 ksteube 1641 env.Append(CCFLAGS = env['cc_optim'])
321 ksteube 1655 env.Append(CCFLAGS = env['omp_optim'])
322 ksteube 1641 env.Append(CCFLAGS = env['cc_flags'])
323 ksteube 1312
324 ksteube 1641 # Python
325     env.Append(CPPPATH = [env['python_path']])
326     env.Append(LIBPATH = [env['python_lib_path']])
327     env.Append(LIBS = [env['python_lib']])
328 gross 806
329 ksteube 1641 # Boost
330     env.Append(CPPPATH = [env['boost_path']])
331     env.Append(LIBPATH = [env['boost_lib_path']])
332     env.Append(LIBS = [env['boost_lib']])
333 gross 805
334 ksteube 1641 # NetCDF
335 ksteube 1652 if env['usenetcdf']:
336 ksteube 1641 env.Append(CPPPATH = [env['netCDF_path']])
337     env.Append(LIBPATH = [env['netCDF_lib_path']])
338     env.Append(LIBS = [env['netCDF_libs']])
339     env.Append(CPPDEFINES = ['USE_NETCDF'])
340 phornby 1246
341 ksteube 1641 # VTK
342 ksteube 1652 if env['usevtk']:
343 ksteube 1641 env.Append(CPPDEFINES = ['USE_VTK'])
344 gross 950
345 ksteube 1641 # MS Windows
346     if IS_WINDOWS_PLATFORM:
347     env.PrependENVPath('PATH', [env['boost_lib_path']])
348     env.PrependENVPath('PATH', libinstall)
349 ksteube 1652 if env['usenetcdf']:
350 ksteube 1641 env.PrependENVPath('PATH', [env['netCDF_lib_path']])
351 gross 1023
352 ksteube 1641 # Create a modified environment for MPI programs
353 gross 950 try:
354 ksteube 1641 env_mpi = env.Clone() # scons-98.03
355     except AttributeError:
356     env_mpi = env.Copy() # scons-96.92
357 ksteube 1459
358 ksteube 1641 # MPI
359 ksteube 1653 if env_mpi['usempi']:
360 ksteube 1641 env_mpi.Append(CPPPATH = [env['mpi_path']])
361     env_mpi.Append(LIBPATH = [env['mpi_lib_path']])
362     env_mpi.Append(LIBS = [env['mpi_libs']])
363     env_mpi.Append(CPPDEFINES = ['PASO_MPI', 'MPI_NO_CPPBIND', env_mpi['MPICH_IGNORE_CXX_SEEK']])
364 robwdcock 682
365 ksteube 1641 # ParMETIS
366 ksteube 1652 if env_mpi['useparmetis']:
367 ksteube 1641 env_mpi.Append(CPPPATH = [env['parmetis_path']])
368     env_mpi.Append(LIBPATH = [env['parmetis_lib_path']])
369     env_mpi.Append(LIBS = [env['parmetis_libs']])
370     env_mpi.Append(CPPDEFINES = ['USE_PARMETIS'])
371 gross 707
372 ksteube 1641 env.Append(ARFLAGS = env['ar_flags'])
373 ksteube 1312
374 ksteube 1641 ############ End of modify environment #########################
375 ksteube 1312
376 ksteube 1655 print ""
377     print "Summary of configuration"
378     print " Using python"
379     print " Using numarray"
380     print " Using boost"
381     if env['usenetcdf']: print " Using NetCDF"
382     else: print " Not using NetCDF"
383     if env['usevtk']: print " Using VTK"
384     else: print " Not using VTK"
385     if env['useopenmp']: print " Using OpenMP"
386     else: print " Not using OpenMP"
387     if env['usempi']: print " Using MPI"
388     else: print " Not using MPI"
389     if env['useparmetis']: print " Using ParMETIS"
390     else: print " Not using ParMETIS"
391     if env['usedebug']: print " Compiling for debug"
392     else: print " Not compiling for debug"
393     print ""
394    
395 ksteube 1641 #==========================================================================
396     #
397     # Add some custom builders
398     #
399     py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
400     env.Append(BUILDERS = {'PyCompile' : py_builder});
401 gross 700
402 ksteube 1655 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix=env['PROGSUFFIX'], single_source=True)
403 ksteube 1641 env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
404 gross 700
405 ksteube 1641 runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
406     env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
407 gross 700
408 ksteube 1641 # ============= Remember what options were used in the compile =====================================
409     if not IS_WINDOWS_PLATFORM:
410     env.Execute("/bin/rm -f " + libinstall + "/Compiled.with.*")
411 ksteube 1652 if env['usedebug']: env.Execute("touch " + libinstall + "/Compiled.with.debug")
412 ksteube 1653 if env['usempi']: env.Execute("touch " + libinstall + "/Compiled.with.mpi")
413 ksteube 1655 if env['omp_optim'] != '': env.Execute("touch " + libinstall + "/Compiled.with.OpenMP")
414 gross 707
415 ksteube 1641 Export(["env", "env_mpi", "incinstall", "libinstall", "pyinstall", "sys_libs", "prefix" ])
416 robwdcock 682
417     env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
418     env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
419 gross 958 # env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
420 ksteube 1641 env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
421     env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
422 robwdcock 682 env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
423     env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
424 gross 707 env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
425 matt 863 env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
426 gross 898 env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)
427 matt 863 env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
428 phornby 1243
429 ksteube 1647 ############ Targets to build and install libraries ############
430    
431 ksteube 1641 target_init = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))
432     env.Alias('target_init', [target_init])
433 phornby 1243
434 ksteube 1647 # The headers have to be installed prior to build in order to satisfy #include <paso/Common.h>
435     env.Alias('build_esysUtils', ['target_install_esysUtils_headers', 'target_esysUtils_a'])
436     env.Alias('install_esysUtils', ['build_esysUtils', 'target_install_esysUtils_a'])
437 phornby 1243
438 ksteube 1647 env.Alias('build_paso', ['target_install_paso_headers', 'target_paso_a'])
439     env.Alias('install_paso', ['build_paso', 'target_install_paso_a'])
440 ksteube 1641
441 ksteube 1647 env.Alias('build_escript', ['target_install_escript_headers', 'target_escript_so', 'target_escriptcpp_so'])
442     env.Alias('install_escript', ['build_escript', 'target_install_escript_so', 'target_install_escriptcpp_so', 'target_install_escript_py'])
443 ksteube 1641
444 ksteube 1647 env.Alias('build_finley', ['target_install_finley_headers', 'target_finley_so', 'target_finleycpp_so'])
445     env.Alias('install_finley', ['build_finley', 'target_install_finley_so', 'target_install_finleycpp_so', 'target_install_finley_py'])
446 ksteube 1641
447     # Now gather all the above into a couple easy targets: build_all and install_all
448     build_all_list = []
449     build_all_list += ['build_esysUtils']
450     build_all_list += ['build_paso']
451     build_all_list += ['build_escript']
452     build_all_list += ['build_finley']
453     # build_all_list += ['build_bruce']
454 ksteube 1655 if env['usempi']: build_all_list += ['target_pythonMPI_exe']
455 ksteube 1641
456     install_all_list = []
457     install_all_list += ['target_init']
458     install_all_list += ['install_esysUtils']
459     install_all_list += ['install_paso']
460     install_all_list += ['install_escript']
461     install_all_list += ['install_finley']
462     install_all_list += ['target_install_pyvisi_py']
463     install_all_list += ['target_install_modellib_py']
464     install_all_list += ['target_install_pycad_py']
465     # install_all_list += ['target_install_bruce']
466     # install_all_list += ['target_install_bruce_py']
467 ksteube 1655 if env['usempi']: install_all_list += ['target_install_pythonMPI_exe']
468 ksteube 1641
469     env.Alias('build_all', build_all_list)
470     env.Alias('install_all', install_all_list)
471    
472     env.Default('install_all')
473    
474 ksteube 1647 ############ Targets to build and run the test suite ###########
475    
476     env.Alias('build_cppunittest', ['target_install_cppunittest_headers', 'target_cppunittest_a'])
477     env.Alias('install_cppunittest', ['build_cppunittest', 'target_install_cppunittest_a'])
478     env.Alias('run_tests', ['install_all', 'target_install_cppunittest_a'])
479     env.Alias('all_tests', ['install_all', 'target_install_cppunittest_a', 'run_tests', 'py_tests'])
480    
481     ############ Targets to build the documentation ################
482    
483     env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'guide_html'])
484    

  ViewVC Help
Powered by ViewVC 1.1.26