/[escript]/trunk/bruce/test/Bruce/SConscript
ViewVC logotype

Contents of /trunk/bruce/test/Bruce/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 355 - (show annotations)
Wed Dec 14 05:05:31 2005 UTC (13 years, 4 months ago) by jgs
File size: 3057 byte(s)
add explicit target for building of unit tests

1 # Scons configuration file for Bruce unit tests
2
3 import os
4 import sys
5
6 #
7 # ensure correct versions of python and scons
8
9 EnsurePythonVersion(2,3)
10 EnsureSConsVersion(0,96)
11
12 #
13 # set appropriate defaults for configuration variables
14
15 esysroot = Dir('#../../..')
16 usegcc = 0
17 options = None
18 sys_libs = []
19
20 #
21 # import configuration variables passed in from
22 # calling SConscript (if any)
23
24 Import('*')
25
26 #
27 # retreive command-line arguments if any
28
29 if ARGUMENTS.get('usegcc',0):
30 usegcc = 1
31
32 if ARGUMENTS.get('options',0):
33 options = ARGUMENTS.get('options',0)
34
35 #
36 # determine platform
37
38 env = Environment(ENV = os.environ)
39 platform = env['PLATFORM']
40
41 #
42 # determine hostname
43
44 import socket
45 hostname = socket.gethostname()
46
47 #
48 # load configuration settings
49
50 options_dir = str(esysroot) + '/scons'
51 sys.path.append(options_dir)
52
53 from default_options import *
54
55 if hostname=='ess':
56 from ess_options import *
57
58 if usegcc==1:
59 from gcc_options import *
60
61 if options!=None:
62 exec "from " + options + " import *"
63
64 cxx_flags=cxx_flags_debug
65
66 #
67 # print out build configuration for this module
68
69 print "Build configuration for module: Bruce unit tests"
70 print " dodebug: 1"
71 print " usegcc: ", usegcc
72 print " cxx: ", cxx
73 print " platform: ", platform
74 print " hostname: ", hostname
75
76 #
77 # do the actual build
78
79 bruce_path = str(esysroot) + '/bruce/inc'
80 bruce_test_path = str(esysroot) + '/bruce/test/Bruce'
81 escript_path = str(esysroot) + '/escript/inc'
82 esysUtils_path = str(esysroot) + '/esysUtils/inc'
83 CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc'
84
85 esys_lib_path = str(esysroot) + '/lib'
86 esysUtils_lib_path = str(esysroot) + '/esysUtils/lib'
87 CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib'
88
89 bruce_lib = str(esys_lib_path) + '/libbrucecpp.so'
90
91 install_dir = str(esysroot) + '/bruce/test'
92
93 cpp_path = [bruce_path,
94 bruce_test_path,
95 escript_path,
96 esysUtils_path,
97 CppUnitTest_path,
98 python_path,
99 boost_path]
100
101 lib_path = [esys_lib_path,
102 esysUtils_lib_path,
103 CppUnitTest_lib_path,
104 python_lib_path,
105 boost_lib_path]
106
107 libs = ['brucecpp',
108 'escriptcpp',
109 'esysUtils',
110 'CppUnitTest',
111 str(python_lib),
112 str(boost_lib),
113 'dl',
114 'util']
115
116 libs.extend(sys_libs)
117
118 sources = ['BruceTestCase.cpp',
119 'BruceTest.cpp']
120
121 target = 'BruceTest.exe'
122
123 bruce_env = Environment(ENV = os.environ)
124
125 bruce_env.Replace(CXX = cxx)
126 bruce_env.Replace(CXXFLAGS = cxx_flags)
127 bruce_env.Replace(CPPPATH = cpp_path)
128 bruce_env.Replace(LIBPATH = lib_path)
129 bruce_env.Replace(LIBS = libs)
130
131 bruce_test_exe = bruce_env.Program(target, sources)
132
133 Depends(bruce_test_exe, bruce_lib)
134
135 Alias("build_tests", bruce_env.Install(install_dir, bruce_test_exe))
136
137 import scons_extensions
138 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)
139 bruce_env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
140 #bruce_env.RunUnitTest(target)

  ViewVC Help
Powered by ViewVC 1.1.26