/[escript]/branches/RW_WIN32/SConstruct
ViewVC logotype

Annotation of /branches/RW_WIN32/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 240 - (hide annotations)
Mon Nov 28 06:09:41 2005 UTC (14 years, 11 months ago) by robwdcock
File size: 4204 byte(s)
+ Fixed problem with build paths for python tests being in the wrong location
+ Added build & run for python unit tests for escript and finley.

NOTES
+ scons defaults to building ALL targets so if will build everything, including running all tests. This behaviour can be modified by specifying the DEFAULT targets but I've not done this yet. In the interim specify the target you want.
+ Some dependencies need to be specified as scons does not figure them out automatically, though a helper scanner might be able to. These can be specified explicitly using scons Depend function. Not yet done so you can get an invalid build (especially in parallel). Examples include python depends on shared libraries, possibly a couple of library dependencies for install targets - need to verify. 
1 robwdcock 229 import scons_ext
2    
3 robwdcock 186 opts = Options('custom.py')
4     opts.AddOptions(
5     BoolOption('RELEASE', 'Set to build for release', 0),
6 robwdcock 222 PathOption('PYTHON_HOME','Path to python home','/usr/lib/python2.3'),
7     PathOption('BOOST_HOME','Path to boost home','/usr/include/boost')
8 robwdcock 186 )
9 robwdcock 220
10 robwdcock 229 env = Environment(tools = ['default'],options = opts)
11 robwdcock 220
12 robwdcock 229 Help(opts.GenerateHelpText(env))
13 robwdcock 220
14 robwdcock 229 py_builder = Builder(action = scons_ext.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
15 robwdcock 220 env.Append(BUILDERS = {'PyCompile' : py_builder});
16 robwdcock 186
17 robwdcock 229 if env['PLATFORM'] == "win32":
18     runUnitTest_builder = Builder(action = scons_ext.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
19     else:
20     runUnitTest_builder = Builder(action = scons_ext.runUnitTest, suffix = '.passed', single_source=True)
21     env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
22    
23 robwdcock 230 runPyUnitTest_builder = Builder(action = scons_ext.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
24     env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
25 robwdcock 229
26 robwdcock 230
27 robwdcock 186 print "PLATFORM is:", env['PLATFORM']
28    
29     EnsurePythonVersion(2,3)
30    
31     #TODO: How do I convert these to options?
32     #TODO: Is there a more compact way of setting up the include paths?
33    
34     # Third-Party libraries
35 robwdcock 222 boost_home = env['BOOST_HOME']
36 robwdcock 209 python_home = env['PYTHON_HOME']
37 robwdcock 186
38     # Where to install (and find) esys includes and libraries
39     # Note: #/ means relative to the top of source tree
40     esys_inc = '#/include'
41     esys_lib = '#/lib'
42    
43     # Derived paths
44 phornby 221 if env['PLATFORM'] == "win32":
45     python_inc = python_home + '/include'
46     python_lib = python_home + '/libs'
47     boost_inc = boost_home
48 robwdcock 222 boost_lib = boost_home + '/windows_binary/lib'
49 phornby 221 elif env['PLATFORM'] == "posix":
50     python_inc = '/usr/include/python2.3'
51     python_lib = '/usr/lib'
52     boost_inc = '/usr/include'
53     boost_lib = '/usr/lib'
54 robwdcock 186
55     incdir = [ boost_inc, python_inc, esys_inc ]
56 robwdcock 209 libdir = [ boost_lib, python_lib, esys_lib ]
57 robwdcock 186
58     env.Append(CPPPATH=incdir)
59     env.Append(LIBPATH=libdir)
60    
61    
62     if env['PLATFORM'] == "win32":
63     env.Append(CCFLAGS = ' /GR /EHsc /TP /wd4068')
64     env.Append(CPPDEFINES = ['MSVC', 'WIN32'])
65     if False :
66     print "RELEASE build"
67     else:
68     print "DEBUG build"
69 phornby 221 env.Append(CPPDEFINES = ['DOASSERT'])
70 robwdcock 186 env.Append(CCFLAGS = ' /Od /MDd /RTC1')
71     env.Append(CPPDEFINES = ['_DEBUG'])
72 robwdcock 209 boost_lib_name = 'boost_python-vc71-mt-sgd'
73 phornby 221 elif env['PLATFORM'] == "posix":
74     env.Append(CC = ' -std=c99')
75     env.Append(CCFLAGS = ' -c -fpic -W -Wall -Wno-unknown-pragmas')
76     boost_lib_name = 'boost_python'
77     if False :
78     print "RELEASE build"
79     else:
80     print "DEBUG build"
81     env.Append(CPPDEFINES = ['DOASSERT', 'DOPROF'])
82     env.Prepend(CCFLAGS = ' -g -O0')
83 robwdcock 186
84 robwdcock 209 Export(["env", "incdir", "esys_inc", "esys_lib", "boost_lib_name" ])
85 robwdcock 186
86 robwdcock 220 # C/C++ Libraries
87 phornby 221 env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
88     env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
89     env.SConscript(dirs = ['escript/src/Data'], build_dir='build/$PLATFORM/escript/Data', duplicate=0)
90     env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
91     env.SConscript(dirs = ['tools/mmio/src'], build_dir='build/$PLATFORM/tools/mmio', duplicate=0)
92     env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
93 robwdcock 240 env.SConscript(dirs = ['finley/src/finleyC'], build_dir='build/$PLATFORM/finley/finleyC', duplicate=0)
94     env.SConscript(dirs = ['finley/src/CPPAdapter'], build_dir='build/$PLATFORM/finley/CPPAdapter', duplicate=0)
95 robwdcock 218
96 robwdcock 229 if env['PLATFORM'] == "win32":
97     env.SConscript(dirs = ['win32/win32_utils'], build_dir='build/$PLATFORM/win32_utils', duplicate=0)
98    
99 robwdcock 218 # Unit Tests
100 phornby 221 env.SConscript(dirs = ['esysUtils/test/EsysException'], build_dir='build/$PLATFORM/esysUtils/test/EsysException', duplicate=0)
101     env.SConscript(dirs = ['escript/test'], build_dir='build/$PLATFORM/escript/test', duplicate=0)
102     env.SConscript(dirs = ['bruce/test'], build_dir='build/$PLATFORM/bruce/test', duplicate=0)
103     env.SConscript(dirs = ['finley/test'], build_dir='build/$PLATFORM/finley/test', duplicate=0)
104    
105 robwdcock 229 # Python
106 robwdcock 240 env.SConscript(dirs = ['esys/py_src'], build_dir='build/$PLATFORM/esys/py', duplicate=0)

  ViewVC Help
Powered by ViewVC 1.1.26