SConstruct (12015:469a2f126b4c) | SConstruct (12016:893091853afd) |
---|---|
1# -*- mode:python -*- 2 3# Copyright (c) 2013, 2015, 2016 ARM Limited 4# All rights reserved. 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating --- 1317 unchanged lines hidden (view full) --- 1326# 1327# This builder and wrapper method are used to set up a directory with 1328# switching headers. Those are headers which are in a generic location and 1329# that include more specific headers from a directory chosen at build time 1330# based on the current build settings. 1331# 1332################################################### 1333 | 1# -*- mode:python -*- 2 3# Copyright (c) 2013, 2015, 2016 ARM Limited 4# All rights reserved. 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating --- 1317 unchanged lines hidden (view full) --- 1326# 1327# This builder and wrapper method are used to set up a directory with 1328# switching headers. Those are headers which are in a generic location and 1329# that include more specific headers from a directory chosen at build time 1330# based on the current build settings. 1331# 1332################################################### 1333 |
1334main['ALL_GPU_ISA_LIST'] = all_gpu_isa_list 1335 | |
1336def build_switching_header(target, source, env): 1337 path = str(target[0]) 1338 subdir = str(source[0]) 1339 dp, fp = os.path.split(path) 1340 dp = os.path.relpath(os.path.realpath(dp), 1341 os.path.realpath(env['BUILDDIR'])) 1342 with open(path, 'w') as hdr: 1343 print >>hdr, '#include "%s/%s/%s"' % (dp, subdir, fp) --- 8 unchanged lines hidden (view full) --- 1352main.Append(BUILDERS = { 'SwitchingHeader': switching_header_builder }) 1353 1354def switching_headers(self, headers, source): 1355 for header in headers: 1356 self.SwitchingHeader(header, source) 1357 1358main.AddMethod(switching_headers, 'SwitchingHeaders') 1359 | 1334def build_switching_header(target, source, env): 1335 path = str(target[0]) 1336 subdir = str(source[0]) 1337 dp, fp = os.path.split(path) 1338 dp = os.path.relpath(os.path.realpath(dp), 1339 os.path.realpath(env['BUILDDIR'])) 1340 with open(path, 'w') as hdr: 1341 print >>hdr, '#include "%s/%s/%s"' % (dp, subdir, fp) --- 8 unchanged lines hidden (view full) --- 1350main.Append(BUILDERS = { 'SwitchingHeader': switching_header_builder }) 1351 1352def switching_headers(self, headers, source): 1353 for header in headers: 1354 self.SwitchingHeader(header, source) 1355 1356main.AddMethod(switching_headers, 'SwitchingHeaders') 1357 |
1360def make_gpu_switching_dir(dname, switch_headers, env): 1361 # Generate the header. target[0] is the full path of the output 1362 # header to generate. 'source' is a dummy variable, since we get the 1363 # list of ISAs from env['ALL_ISA_LIST']. 1364 def gen_switch_hdr(target, source, env): 1365 fname = str(target[0]) 1366 1367 isa = env['TARGET_GPU_ISA'].lower() 1368 1369 try: 1370 f = open(fname, 'w') 1371 print >>f, '#include "%s/%s/%s"' % (dname, isa, basename(fname)) 1372 f.close() 1373 except IOError: 1374 print "Failed to create %s" % fname 1375 raise 1376 1377 # Build SCons Action object. 'varlist' specifies env vars that this 1378 # action depends on; when env['ALL_ISA_LIST'] changes these actions 1379 # should get re-executed. 1380 switch_hdr_action = MakeAction(gen_switch_hdr, 1381 Transform("GENERATE"), varlist=['ALL_ISA_GPU_LIST']) 1382 1383 # Instantiate actions for each header 1384 for hdr in switch_headers: 1385 env.Command(hdr, [], switch_hdr_action) 1386 1387Export('make_gpu_switching_dir') 1388 | |
1389# all-isas -> all-deps -> all-environs -> all_targets 1390main.Alias('#all-isas', []) 1391main.Alias('#all-deps', '#all-isas') 1392 1393# Dummy target to ensure all environments are created before telling 1394# SCons what to actually make (the command line arguments). We attach 1395# them to the dependence graph after the environments are complete. 1396ORIG_BUILD_TARGETS = list(BUILD_TARGETS) # force a copy; gets closure to work. --- 162 unchanged lines hidden --- | 1358# all-isas -> all-deps -> all-environs -> all_targets 1359main.Alias('#all-isas', []) 1360main.Alias('#all-deps', '#all-isas') 1361 1362# Dummy target to ensure all environments are created before telling 1363# SCons what to actually make (the command line arguments). We attach 1364# them to the dependence graph after the environments are complete. 1365ORIG_BUILD_TARGETS = list(BUILD_TARGETS) # force a copy; gets closure to work. --- 162 unchanged lines hidden --- |