forked from NVIDIA/thrust
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SConscript
63 lines (47 loc) · 1.88 KB
/
SConscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import sys
# enable python to find the module
module_path = Dir('.').srcnode().abspath
sys.path.append(module_path)
from build.perftest import compile_test
import os
Import('env')
my_env = env.Clone()
def cu_build_function(source, target, env):
compile_test(str(source[0]), str(target[0]))
# define a rule to build a .cu from a .test
cu_builder = Builder(action = cu_build_function,
suffix = '.cu',
src_suffix = '.test')
my_env.Append(BUILDERS = {'CUFile' : cu_builder})
# define a rule to build a report from an executable
report_builder = Builder(action = os.path.join('"' + str(my_env.Dir('.')), '$SOURCE" > $TARGET'),
suffix = '.xml',
src_suffix = my_env['PROGSUFFIX'])
my_env.Append(BUILDERS = {'Report' : report_builder})
my_env.Append(CPPPATH = [Dir('.').srcnode(), Dir('#/testing')])
cu_list = []
program_list = []
report_list = []
build_files = [os.path.join('build', f) for f in ['perftest.py', 'test_function_template.cxx']]
# describe dependency graph:
# report -> program -> .cu -> .test
for test in my_env.Glob('*.test'):
cu = my_env.CUFile(test)
my_env.Depends(cu, build_files)
cu_list.append(cu)
prog = my_env.Program(cu)
program_list.append(prog)
report = my_env.Report(prog)
report_list.append(report)
# make aliases for groups of targets
reports = my_env.Alias("reports", report_list)
programs = my_env.Alias("programs", program_list)
# when no build target is specified, by default we build the programs
my_env.Default(programs)
# output a help message
my_env.Help("""
Type: 'scons' to build all performance test programs.
Type: 'scons reports' to run all performance tests and output reports.
Type: 'scons <test name>' to build a single performance test program of interest.
Type: 'scons <test name>.xml' to run a single performance test of interest and output a report.
""")