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

Contents of /branches/RW_WIN32/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 332 - (show annotations)
Wed Dec 7 07:50:18 2005 UTC (13 years, 3 months ago) by phornby
File size: 4722 byte(s)
Split the include and lib dirs for python & boost.
Added the altix support to SConstruct & tidied the options handling a bit.


1 import scons_ext
2
3 opts = Options('custom.py')
4 opts.AddOptions(
5 BoolOption('RELEASE', 'Set to build for release', False),
6 PathOption('PYTHON_INC','Path to python includes','/usr/include/python2.3'),
7 PathOption('PYTHON_LIB','Path to python includes','/usr/lib'),
8 PathOption('BOOST_INC','Path to boost includes','/usr/include'),
9 PathOption('BOOST_LIB','Path to boost includes','/usr/lib'),
10
11 # CC and CXX overrides of default environments
12 ('CC_PATH','override CC',False),
13 ('CXX_PATH','override CXX',False)
14 )
15
16 env = Environment(tools = ['default'],options = opts)
17
18 if env['CC_PATH'] :
19 env['CC'] = env['CC_PATH']
20
21 if env['CXX_PATH'] :
22 env['CXX'] = env['CXX_PATH']
23
24 Help(opts.GenerateHelpText(env))
25
26 py_builder = Builder(action = scons_ext.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
27 env.Append(BUILDERS = {'PyCompile' : py_builder});
28
29 if env['PLATFORM'] == "win32":
30 runUnitTest_builder = Builder(action = scons_ext.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
31 else:
32 runUnitTest_builder = Builder(action = scons_ext.runUnitTest, suffix = '.passed', single_source=True)
33 env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
34
35 runPyUnitTest_builder = Builder(action = scons_ext.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
36 env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
37
38
39 print "PLATFORM is:", env['PLATFORM']
40
41 EnsurePythonVersion(2,3)
42
43 # Third-Party libraries
44 python_inc = env['PYTHON_INC']
45 python_lib = env['PYTHON_LIB']
46 boost_inc = env['BOOST_INC']
47 boost_lib = env['BOOST_LIB']
48
49 # Where to install (and find) esys includes and libraries
50 # Note: #/ means relative to the top of source tree
51 esys_inc = '#/include'
52 esys_lib = '#/lib'
53
54 env.Default(esys_lib)
55 env.Alias('py_test')
56
57 incdir = [ boost_inc, python_inc, esys_inc ]
58 libdir = [ boost_lib, python_lib, esys_lib ]
59
60 env.Append(CPPPATH=incdir)
61 env.Append(LIBPATH=libdir)
62
63 if not env['RELEASE'] :
64 env.Append(CPPDEFINES = ['DOASSERT' 'DOPROF'])
65
66 if env['CC'].find('cl.exe') >= 0 :
67 env.Append(CCFLAGS = ' /GR /EHsc /TP /wd4068')
68 env.Append(CPPDEFINES = ['MSVC', 'WIN32'])
69 if env['RELEASE'] :
70 print "RELEASE build"
71 else:
72 print "DEBUG build"
73 env.Append(CCFLAGS = ' /Od /MDd /RTC1')
74 env.Append(CPPDEFINES = ['_DEBUG'])
75 boost_lib_name = 'boost_python-vc71-mt-sgd'
76
77 elif env['CC'].find('gcc') >= 0 :
78 env.Append(CC = ' -std=c99')
79 env.Append(CCFLAGS = ' -c -fpic -W -Wall -Wno-unknown-pragmas')
80 boost_lib_name = 'boost_python'
81 if env['RELEASE'] :
82 print "RELEASE build"
83 env.Prepend(CCFLAGS = ' -O3')
84 else:
85 print "DEBUG build"
86 env.Prepend(CCFLAGS = ' -g -O0')
87
88 elif env['CC'].find('icc') >= 0 :
89 env.Append(CC = ' -c99')
90 env.Append(CXX = ' -ansi')
91 env.Append(CCFLAGS = ' -openmp -openmp_report0 -mp1 -tpp2 -ansi_alias -no-gcc -fpic -w1')
92 env.Append(CPPDEFINES = ['SCSL'])
93 boost_lib_name = 'boost_python'
94 if env['RELEASE'] :
95 print "RELEASE build"
96 env.Prepend(CCFLAGS = ' -O3 -IPF_fma -ftz')
97 else:
98 print "DEBUG build"
99 env.Prepend(CCFLAGS = ' -g -O0')
100
101 Export(["env", "incdir", "esys_inc", "esys_lib", "boost_lib_name" ])
102
103 # C/C++ Libraries
104 env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
105 env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
106 env.SConscript(dirs = ['escript/src/Data'], build_dir='build/$PLATFORM/escript/Data', duplicate=0)
107 env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
108 env.SConscript(dirs = ['tools/mmio/src'], build_dir='build/$PLATFORM/tools/mmio', duplicate=0)
109 env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
110 env.SConscript(dirs = ['finley/src/finleyC'], build_dir='build/$PLATFORM/finley/finleyC', duplicate=0)
111 env.SConscript(dirs = ['finley/src/CPPAdapter'], build_dir='build/$PLATFORM/finley/CPPAdapter', duplicate=0)
112
113 if env['PLATFORM'] == "win32":
114 env.SConscript(dirs = ['win32/win32_utils'], build_dir='build/$PLATFORM/win32_utils', duplicate=0)
115
116 # Unit Tests
117 env.SConscript(dirs = ['esysUtils/test/EsysException'], build_dir='build/$PLATFORM/esysUtils/test/EsysException', duplicate=0)
118 env.SConscript(dirs = ['escript/test'], build_dir='build/$PLATFORM/escript/test', duplicate=0)
119 env.SConscript(dirs = ['bruce/test'], build_dir='build/$PLATFORM/bruce/test', duplicate=0)
120 env.SConscript(dirs = ['finley/test'], build_dir='build/$PLATFORM/finley/test', duplicate=0)
121
122 # Python
123 env.SConscript(dirs = ['esys/py_src'], build_dir='build/$PLATFORM/esys/py', duplicate=0)

  ViewVC Help
Powered by ViewVC 1.1.26