1 |
# Scons configuration file for DataConstant 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 |
|
19 |
# |
20 |
# import configuration variables passed in from |
21 |
# calling SConscript (if any) |
22 |
|
23 |
Import('*') |
24 |
|
25 |
# |
26 |
# retreive command-line arguments if any |
27 |
|
28 |
if ARGUMENTS.get('usegcc',0): |
29 |
usegcc = 1 |
30 |
|
31 |
if ARGUMENTS.get('options',0): |
32 |
options = ARGUMENTS.get('options',0) |
33 |
|
34 |
# |
35 |
# determine platform |
36 |
|
37 |
env = Environment(ENV = os.environ) |
38 |
platform = env['PLATFORM'] |
39 |
|
40 |
# |
41 |
# determine hostname |
42 |
|
43 |
hostname = os.environ['HOSTNAME'] |
44 |
|
45 |
# |
46 |
# load configuration settings |
47 |
|
48 |
options_dir = str(esysroot) + '/scons' |
49 |
sys.path.append(options_dir) |
50 |
|
51 |
if hostname=='ess': |
52 |
from ess_options import * |
53 |
|
54 |
if usegcc==1: |
55 |
from gcc_options import * |
56 |
|
57 |
if options!=None: |
58 |
exec "from " + options + " import *" |
59 |
|
60 |
cxx_flags=cxx_flags_debug |
61 |
|
62 |
# |
63 |
# print out build configuration for this module |
64 |
|
65 |
print "########################################################" |
66 |
print "Build configuration for module: DataConstant unit tests" |
67 |
print " dodebug: 1" |
68 |
print " usegcc: ", usegcc |
69 |
print " cxx: ", cxx |
70 |
print " platform: ", platform |
71 |
print " hostname: ", hostname |
72 |
print "########################################################" |
73 |
|
74 |
# |
75 |
# do the actual build |
76 |
|
77 |
dataconstant_test_path = str(esysroot) + '/escript/test/DataConstant' |
78 |
escript_path = str(esysroot) + '/escript/inc' |
79 |
esysUtils_path = str(esysroot) + '/esysUtils/inc' |
80 |
CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc' |
81 |
|
82 |
esys_lib_path = str(esysroot) + '/lib' |
83 |
esysUtils_lib_path = str(esysroot) + '/esysUtils/lib' |
84 |
CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib' |
85 |
|
86 |
cpp_path = [dataconstant_test_path, |
87 |
escript_path, |
88 |
esysUtils_path, |
89 |
CppUnitTest_path, |
90 |
python_path, |
91 |
boost_path] |
92 |
|
93 |
lib_path = [esys_lib_path, |
94 |
esysUtils_lib_path, |
95 |
CppUnitTest_lib_path, |
96 |
python_lib_path, |
97 |
boost_lib_path] |
98 |
|
99 |
libs = ['escriptcpp', |
100 |
'esysUtils', |
101 |
'CppUnitTest', |
102 |
str(python_lib), |
103 |
str(boost_lib), |
104 |
'dl', |
105 |
'util', |
106 |
'guide', |
107 |
'irc'] |
108 |
|
109 |
sources = ['DataConstantTestCase.cpp', |
110 |
'DataConstantTest.cpp'] |
111 |
|
112 |
target = 'DataConstantTest.exe' |
113 |
|
114 |
dataconstant_env = Environment(ENV = os.environ) |
115 |
|
116 |
dataconstant_env.Replace(CXX = cxx) |
117 |
dataconstant_env.Replace(CXXFLAGS = cxx_flags) |
118 |
dataconstant_env.Replace(CPPPATH = cpp_path) |
119 |
dataconstant_env.Replace(LIBPATH = lib_path) |
120 |
dataconstant_env.Replace(LIBS = libs) |
121 |
|
122 |
dataconstant_test_exe = dataconstant_env.Program(target, sources) |