Skip to content

Commit

Permalink
Build all targets in a directory specific to the build configuration.
Browse files Browse the repository at this point in the history
Invoke each subsidiary SConscript with a variant_dir argument.
Simplify the top-level .gitignore given the new build targets directory.
  • Loading branch information
jaredhoberock committed Mar 23, 2012
1 parent 545be1a commit 58bf268
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
targets/
*.pyc
*.bak
*.o
*.so
*.swp
*.linkinfo
*.sconsign.dblite
*.pgm
*~
nvcc_options_file.txt
print_sm_version
tester
18 changes: 12 additions & 6 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,17 @@ env.Append(LIBPATH = lib_paths())

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

# make the build environment available to SConscripts
Export('env')
# make the build environment available to all subsidiary SConscripts
env.Export('env')

SConscript('SConscript')
SConscript('examples/SConscript')
SConscript('testing/SConscript')
SConscript('performance/SConscript')
# assemble the name of this configuration's targets directory
targets_dir = 'targets/{0}_host_{1}_device_{2}'.format(env['host_backend'], env['device_backend'], env['mode'])

# invoke each SConscript with a variant directory
env.SConscript('examples/SConscript', variant_dir = 'examples/' + targets_dir, duplicate = 0)
env.SConscript('testing/SConscript', variant_dir = 'testing/' + targets_dir, duplicate = 0)
env.SConscript('performance/SConscript', variant_dir = 'performance/' + targets_dir, duplicate = 0)

# the top-level SConscript doesn't need a variant directory as it just builds zipfiles
env.SConscript('SConscript')

10 changes: 8 additions & 2 deletions performance/SConscript
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import os
import sys

# enable python to find the module
module_path = Dir('#/performance').abspath
sys.path.append(module_path)
from build.perftest import compile_test

import os

Import('env')
my_env = env.Clone()

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

my_env.Append(CPPPATH = [Dir('.'), Dir('../testing/')])
my_env.Append(CPPPATH = [Dir('#/performance'), Dir('#/testing')])

cu_list = []
program_list = []
Expand Down
2 changes: 1 addition & 1 deletion testing/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if my_env.subst('$CXX') == 'cl':
my_env.Append(CPPFLAGS = '/bigobj')

# #include the current directory
my_env.Append(CPPPATH = Dir('.'))
my_env.Append(CPPPATH = Dir('#/testing'))

# find all .cus & .cpps
sources = []
Expand Down

0 comments on commit 58bf268

Please sign in to comment.