From 58bf26889536595d2fc86260013019b4856e08f6 Mon Sep 17 00:00:00 2001 From: Jared Hoberock Date: Fri, 23 Mar 2012 14:34:50 -0700 Subject: [PATCH] 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. --- .gitignore | 7 +------ SConstruct | 18 ++++++++++++------ performance/SConscript | 10 ++++++++-- testing/SConscript | 2 +- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 0dd2ab963..23c24885c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,7 @@ +targets/ *.pyc *.bak -*.o -*.so *.swp -*.linkinfo *.sconsign.dblite *.pgm *~ -nvcc_options_file.txt -print_sm_version -tester diff --git a/SConstruct b/SConstruct index 1bf1906d2..f6625565f 100644 --- a/SConstruct +++ b/SConstruct @@ -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') diff --git a/performance/SConscript b/performance/SConscript index d342ad2e6..4fd775ca1 100644 --- a/performance/SConscript +++ b/performance/SConscript @@ -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() @@ -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 = [] diff --git a/testing/SConscript b/testing/SConscript index 1f88e1225..241ee4c1b 100644 --- a/testing/SConscript +++ b/testing/SConscript @@ -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 = []