Skip to content

Commit 545be1a

Browse files
committed
Integrate performance/SConscript into the new build.
1 parent bc4b1d6 commit 545be1a

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

SConstruct

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,4 +340,5 @@ Export('env')
340340
SConscript('SConscript')
341341
SConscript('examples/SConscript')
342342
SConscript('testing/SConscript')
343+
SConscript('performance/SConscript')
343344

performance/SConstruct renamed to performance/SConscript

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
import os
2-
import glob
3-
42
from build.perftest import compile_test
53

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()
126

137
def cu_build_function(source, target, env):
148
compile_test(str(source[0]), str(target[0]))
@@ -17,15 +11,15 @@ def cu_build_function(source, target, env):
1711
cu_builder = Builder(action = cu_build_function,
1812
suffix = '.cu',
1913
src_suffix = '.test')
20-
env.Append(BUILDERS = {'CUFile' : cu_builder})
14+
my_env.Append(BUILDERS = {'CUFile' : cu_builder})
2115

2216
# 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'),
2418
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})
2721

28-
env.Append(CPPPATH = ['.', '../testing/'])
22+
my_env.Append(CPPPATH = [Dir('.'), Dir('../testing/')])
2923

3024
cu_list = []
3125
program_list = []
@@ -35,29 +29,26 @@ build_files = [os.path.join('build', f) for f in ['perftest.py', 'test_function_
3529

3630
# describe dependency graph:
3731
# 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)
4135
cu_list.append(cu)
4236

43-
prog = env.Program(cu)
37+
prog = my_env.Program(cu)
4438
program_list.append(prog)
4539

46-
report = env.Report(prog)
40+
report = my_env.Report(prog)
4741
report_list.append(report)
4842

49-
# add .linkinfo files to the clean list
50-
env.Clean(prog, str(test).replace("test", "linkinfo"))
51-
5243
# 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)
5546

5647
# when no build target is specified, by default we build the programs
57-
env.Default(programs)
48+
my_env.Default(programs)
5849

5950
# output a help message
60-
env.Help("""
51+
my_env.Help("""
6152
Type: 'scons' to build all performance test programs.
6253
Type: 'scons reports' to run all performance tests and output reports.
6354
Type: 'scons <test name>' to build a single performance test program of interest.

0 commit comments

Comments
 (0)