1
1
import os
2
- import glob
3
-
4
2
from build .perftest import compile_test
5
3
6
- # try to import an environment first
7
- try :
8
- Import ('env' )
9
- except :
10
- exec open ("../build/build-env.py" )
11
- env = Environment ()
4
+ Import ('env' )
5
+ my_env = env .Clone ()
12
6
13
7
def cu_build_function (source , target , env ):
14
8
compile_test (str (source [0 ]), str (target [0 ]))
@@ -17,15 +11,15 @@ def cu_build_function(source, target, env):
17
11
cu_builder = Builder (action = cu_build_function ,
18
12
suffix = '.cu' ,
19
13
src_suffix = '.test' )
20
- env .Append (BUILDERS = {'CUFile' : cu_builder })
14
+ my_env .Append (BUILDERS = {'CUFile' : cu_builder })
21
15
22
16
# define a rule to build a report from an executable
23
- report_builder = Builder (action = os .path .join ('"' + env . GetLaunchDir ( ), '$SOURCE" > $TARGET' ),
17
+ report_builder = Builder (action = os .path .join ('"' + str ( my_env . Dir ( '.' ) ), '$SOURCE" > $TARGET' ),
24
18
suffix = '.xml' ,
25
- src_suffix = env ['PROGSUFFIX' ])
26
- env .Append (BUILDERS = {'Report' : report_builder })
19
+ src_suffix = my_env ['PROGSUFFIX' ])
20
+ my_env .Append (BUILDERS = {'Report' : report_builder })
27
21
28
- env .Append (CPPPATH = ['.' , '../testing/' ])
22
+ my_env .Append (CPPPATH = [Dir ( '.' ), Dir ( '../testing/' ) ])
29
23
30
24
cu_list = []
31
25
program_list = []
@@ -35,29 +29,26 @@ build_files = [os.path.join('build', f) for f in ['perftest.py', 'test_function_
35
29
36
30
# describe dependency graph:
37
31
# report -> program -> .cu -> .test
38
- for test in glob . glob ( " *.test" ):
39
- cu = env .CUFile (test )
40
- env .Depends (cu , build_files )
32
+ for test in my_env . Glob ( ' *.test' ):
33
+ cu = my_env .CUFile (test )
34
+ my_env .Depends (cu , build_files )
41
35
cu_list .append (cu )
42
36
43
- prog = env .Program (cu )
37
+ prog = my_env .Program (cu )
44
38
program_list .append (prog )
45
39
46
- report = env .Report (prog )
40
+ report = my_env .Report (prog )
47
41
report_list .append (report )
48
42
49
- # add .linkinfo files to the clean list
50
- env .Clean (prog , str (test ).replace ("test" , "linkinfo" ))
51
-
52
43
# make aliases for groups of targets
53
- reports = env .Alias ("reports" , report_list )
54
- programs = env .Alias ("programs" , program_list )
44
+ reports = my_env .Alias ("reports" , report_list )
45
+ programs = my_env .Alias ("programs" , program_list )
55
46
56
47
# when no build target is specified, by default we build the programs
57
- env .Default (programs )
48
+ my_env .Default (programs )
58
49
59
50
# output a help message
60
- env .Help ("""
51
+ my_env .Help ("""
61
52
Type: 'scons' to build all performance test programs.
62
53
Type: 'scons reports' to run all performance tests and output reports.
63
54
Type: 'scons <test name>' to build a single performance test program of interest.
0 commit comments