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

Contents of /branches/RW_WIN32/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 229 - (show annotations)
Fri Nov 25 06:17:13 2005 UTC (14 years, 11 months ago) by robwdcock
File size: 4002 byte(s)
+ Added Options capability
+ All py files are now compiled and installed into lib directory hierarchy
+ scons now reads custom options from custom.py. Examples are in the scons_custom_templates directory, just copy to top level build dir and rename to custom.py
+ scons_ext.py now has some helper functions for building pyc from python and running unit tests (but only when some dependency changes).


1 import scons_ext
2
3 opts = Options('custom.py')
4 opts.AddOptions(
5 BoolOption('RELEASE', 'Set to build for release', 0),
6 PathOption('PYTHON_HOME','Path to python home','/usr/lib/python2.3'),
7 PathOption('BOOST_HOME','Path to boost home','/usr/include/boost')
8 )
9
10 env = Environment(tools = ['default'],options = opts)
11
12 Help(opts.GenerateHelpText(env))
13
14 py_builder = Builder(action = scons_ext.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
15 env.Append(BUILDERS = {'PyCompile' : py_builder});
16
17 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
24 print "PLATFORM is:", env['PLATFORM']
25
26 EnsurePythonVersion(2,3)
27
28 #TODO: How do I convert these to options?
29 #TODO: Is there a more compact way of setting up the include paths?
30
31 # Third-Party libraries
32 boost_home = env['BOOST_HOME']
33 python_home = env['PYTHON_HOME']
34
35 # Where to install (and find) esys includes and libraries
36 # Note: #/ means relative to the top of source tree
37 esys_inc = '#/include'
38 esys_lib = '#/lib'
39
40 # Derived paths
41 if env['PLATFORM'] == "win32":
42 python_inc = python_home + '/include'
43 python_lib = python_home + '/libs'
44 boost_inc = boost_home
45 boost_lib = boost_home + '/windows_binary/lib'
46 elif env['PLATFORM'] == "posix":
47 python_inc = '/usr/include/python2.3'
48 python_lib = '/usr/lib'
49 boost_inc = '/usr/include'
50 boost_lib = '/usr/lib'
51
52 incdir = [ boost_inc, python_inc, esys_inc ]
53 libdir = [ boost_lib, python_lib, esys_lib ]
54
55 env.Append(CPPPATH=incdir)
56 env.Append(LIBPATH=libdir)
57
58
59 if env['PLATFORM'] == "win32":
60 env.Append(CCFLAGS = ' /GR /EHsc /TP /wd4068')
61 env.Append(CPPDEFINES = ['MSVC', 'WIN32'])
62 if False :
63 print "RELEASE build"
64 else:
65 print "DEBUG build"
66 env.Append(CPPDEFINES = ['DOASSERT'])
67 env.Append(CCFLAGS = ' /Od /MDd /RTC1')
68 env.Append(CPPDEFINES = ['_DEBUG'])
69 boost_lib_name = 'boost_python-vc71-mt-sgd'
70 elif env['PLATFORM'] == "posix":
71 env.Append(CC = ' -std=c99')
72 env.Append(CCFLAGS = ' -c -fpic -W -Wall -Wno-unknown-pragmas')
73 boost_lib_name = 'boost_python'
74 if False :
75 print "RELEASE build"
76 else:
77 print "DEBUG build"
78 env.Append(CPPDEFINES = ['DOASSERT', 'DOPROF'])
79 env.Prepend(CCFLAGS = ' -g -O0')
80
81 Export(["env", "incdir", "esys_inc", "esys_lib", "boost_lib_name" ])
82
83 # C/C++ Libraries
84 env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
85 env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
86 env.SConscript(dirs = ['escript/src/Data'], build_dir='build/$PLATFORM/escript/Data', duplicate=0)
87 env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
88 env.SConscript(dirs = ['tools/mmio/src'], build_dir='build/$PLATFORM/tools/mmio', duplicate=0)
89 env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
90 env.SConscript(dirs = ['finley/src/finleyC'], build_dir='build/$PLATFORM/finleyC', duplicate=0)
91 env.SConscript(dirs = ['finley/src/CPPAdapter'], build_dir='build/$PLATFORM/CPPAdapter', duplicate=0)
92
93 if env['PLATFORM'] == "win32":
94 env.SConscript(dirs = ['win32/win32_utils'], build_dir='build/$PLATFORM/win32_utils', duplicate=0)
95
96 # Unit Tests
97 env.SConscript(dirs = ['esysUtils/test/EsysException'], build_dir='build/$PLATFORM/esysUtils/test/EsysException', duplicate=0)
98 env.SConscript(dirs = ['escript/test'], build_dir='build/$PLATFORM/escript/test', duplicate=0)
99 env.SConscript(dirs = ['bruce/test'], build_dir='build/$PLATFORM/bruce/test', duplicate=0)
100 env.SConscript(dirs = ['finley/test'], build_dir='build/$PLATFORM/finley/test', duplicate=0)
101
102 # Python
103 env.SConscript(dirs = ['esys/py_src'], build_dir='build/$PLATFORM/esys/py', duplicate=0)
104
105

  ViewVC Help
Powered by ViewVC 1.1.26