Skip to content

Commit 58bf268

Browse files
committed
Build all targets in a directory specific to the build configuration.
Invoke each subsidiary SConscript with a variant_dir argument. Simplify the top-level .gitignore given the new build targets directory.
1 parent 545be1a commit 58bf268

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

.gitignore

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1+
targets/
12
*.pyc
23
*.bak
3-
*.o
4-
*.so
54
*.swp
6-
*.linkinfo
75
*.sconsign.dblite
86
*.pgm
97
*~
10-
nvcc_options_file.txt
11-
print_sm_version
12-
tester

SConstruct

+12-6
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,17 @@ env.Append(LIBPATH = lib_paths())
334334

335335
env.Append(LIBS = libs(env.subst('$CXX'), env['host_backend'], env['device_backend']))
336336

337-
# make the build environment available to SConscripts
338-
Export('env')
337+
# make the build environment available to all subsidiary SConscripts
338+
env.Export('env')
339339

340-
SConscript('SConscript')
341-
SConscript('examples/SConscript')
342-
SConscript('testing/SConscript')
343-
SConscript('performance/SConscript')
340+
# assemble the name of this configuration's targets directory
341+
targets_dir = 'targets/{0}_host_{1}_device_{2}'.format(env['host_backend'], env['device_backend'], env['mode'])
342+
343+
# invoke each SConscript with a variant directory
344+
env.SConscript('examples/SConscript', variant_dir = 'examples/' + targets_dir, duplicate = 0)
345+
env.SConscript('testing/SConscript', variant_dir = 'testing/' + targets_dir, duplicate = 0)
346+
env.SConscript('performance/SConscript', variant_dir = 'performance/' + targets_dir, duplicate = 0)
347+
348+
# the top-level SConscript doesn't need a variant directory as it just builds zipfiles
349+
env.SConscript('SConscript')
344350

performance/SConscript

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import os
1+
import sys
2+
3+
# enable python to find the module
4+
module_path = Dir('#/performance').abspath
5+
sys.path.append(module_path)
26
from build.perftest import compile_test
37

8+
import os
9+
410
Import('env')
511
my_env = env.Clone()
612

@@ -19,7 +25,7 @@ report_builder = Builder(action = os.path.join('"' + str(my_env.Dir('.')), '$SOU
1925
src_suffix = my_env['PROGSUFFIX'])
2026
my_env.Append(BUILDERS = {'Report' : report_builder})
2127

22-
my_env.Append(CPPPATH = [Dir('.'), Dir('../testing/')])
28+
my_env.Append(CPPPATH = [Dir('#/performance'), Dir('#/testing')])
2329

2430
cu_list = []
2531
program_list = []

testing/SConscript

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if my_env.subst('$CXX') == 'cl':
1919
my_env.Append(CPPFLAGS = '/bigobj')
2020

2121
# #include the current directory
22-
my_env.Append(CPPPATH = Dir('.'))
22+
my_env.Append(CPPPATH = Dir('#/testing'))
2323

2424
# find all .cus & .cpps
2525
sources = []

0 commit comments

Comments
 (0)