Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: pylib/gyp/generator/ninja.py

Issue 13950005: Fully qualify path to cl.exe for ninja windows, and support *_wrapper from environment (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pylib/gyp/msvs_emulation.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 Google Inc. All rights reserved. 1 # Copyright (c) 2013 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import hashlib 6 import hashlib
7 import multiprocessing 7 import multiprocessing
8 import os.path 8 import os.path
9 import re 9 import re
10 import signal 10 import signal
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 363
364 self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) 364 self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec)
365 self.xcode_settings = self.msvs_settings = None 365 self.xcode_settings = self.msvs_settings = None
366 if self.flavor == 'mac': 366 if self.flavor == 'mac':
367 self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) 367 self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec)
368 if self.flavor == 'win': 368 if self.flavor == 'win':
369 self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, 369 self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec,
370 generator_flags) 370 generator_flags)
371 arch = self.msvs_settings.GetArch(config_name) 371 arch = self.msvs_settings.GetArch(config_name)
372 self.ninja.variable('arch', self.win_env[arch]) 372 self.ninja.variable('arch', self.win_env[arch])
373 self.ninja.variable('cc', '$cl_' + arch)
374 self.ninja.variable('cxx', '$cl_' + arch)
373 375
374 # Compute predepends for all rules. 376 # Compute predepends for all rules.
375 # actions_depends is the dependencies this target depends on before running 377 # actions_depends is the dependencies this target depends on before running
376 # any of its action/rule/copy steps. 378 # any of its action/rule/copy steps.
377 # compile_depends is the dependencies this target depends on before running 379 # compile_depends is the dependencies this target depends on before running
378 # any of its compile steps. 380 # any of its compile steps.
379 actions_depends = [] 381 actions_depends = []
380 compile_depends = [] 382 compile_depends = []
381 # TODO(evan): it is rather confusing which things are lists and which 383 # TODO(evan): it is rather confusing which things are lists and which
382 # are strings. Fix these. 384 # are strings. Fix these.
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 gyp.common.CopyTool(flavor, toplevel_build) 1362 gyp.common.CopyTool(flavor, toplevel_build)
1361 1363
1362 # Grab make settings for CC/CXX. 1364 # Grab make settings for CC/CXX.
1363 # The rules are 1365 # The rules are
1364 # - The priority from low to high is gcc/g++, the 'make_global_settings' in 1366 # - The priority from low to high is gcc/g++, the 'make_global_settings' in
1365 # gyp, the environment variable. 1367 # gyp, the environment variable.
1366 # - If there is no 'make_global_settings' for CC.host/CXX.host or 1368 # - If there is no 'make_global_settings' for CC.host/CXX.host or
1367 # 'CC_host'/'CXX_host' enviroment variable, cc_host/cxx_host should be set 1369 # 'CC_host'/'CXX_host' enviroment variable, cc_host/cxx_host should be set
1368 # to cc/cxx. 1370 # to cc/cxx.
1369 if flavor == 'win': 1371 if flavor == 'win':
1370 cc = 'cl.exe' 1372 cc = 'UNKNOWN' # Must be overridden by local arch choice.
1371 cxx = 'cl.exe' 1373 cxx = 'UNKNOWN'
1372 ld = 'link.exe' 1374 ld = 'link.exe'
1373 gyp.msvs_emulation.GenerateEnvironmentFiles(
1374 toplevel_build, generator_flags, OpenOutput)
1375 ld_host = '$ld' 1375 ld_host = '$ld'
1376 else: 1376 else:
1377 cc = 'gcc' 1377 cc = 'gcc'
1378 cxx = 'g++' 1378 cxx = 'g++'
1379 ld = '$cxx' 1379 ld = '$cxx'
1380 ld_host = '$cxx_host' 1380 ld_host = '$cxx_host'
1381 1381
1382 cc_host = None 1382 cc_host = None
1383 cxx_host = None 1383 cxx_host = None
1384 cc_host_global_setting = None 1384 cc_host_global_setting = None
(...skipping 20 matching lines...) Expand all
1405 cc_host = os.path.join(build_to_root, value) 1405 cc_host = os.path.join(build_to_root, value)
1406 cc_host_global_setting = value 1406 cc_host_global_setting = value
1407 if key == 'CXX.host': 1407 if key == 'CXX.host':
1408 cxx_host = os.path.join(build_to_root, value) 1408 cxx_host = os.path.join(build_to_root, value)
1409 cxx_host_global_setting = value 1409 cxx_host_global_setting = value
1410 if key == 'LD.host': 1410 if key == 'LD.host':
1411 ld_host = os.path.join(build_to_root, value) 1411 ld_host = os.path.join(build_to_root, value)
1412 if key.endswith('_wrapper'): 1412 if key.endswith('_wrapper'):
1413 wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value) 1413 wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value)
1414 1414
1415 # Support wrappers from environment variables too.
1416 for key, value in os.environ.iteritems():
1417 if key.endswith('_wrapper'):
Reid Kleckner 2013/05/08 18:55:42 This doesn't seem to work for me, because Python s
scottmg 2013/05/08 19:23:33 Sorry. Are you using cygwin Python perhaps?
1418 wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value)
1419
1420 cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles(
1421 toplevel_build, generator_flags, OpenOutput)
1422 for arch, path in cl_paths.iteritems():
1423 master_ninja.variable('cl_' + arch,
1424 CommandWithWrapper('CC', wrappers, path))
1425
1415 cc = GetEnvironFallback(['CC_target', 'CC'], cc) 1426 cc = GetEnvironFallback(['CC_target', 'CC'], cc)
1416 master_ninja.variable('cc', CommandWithWrapper('CC', wrappers, cc)) 1427 master_ninja.variable('cc', CommandWithWrapper('CC', wrappers, cc))
1417 cxx = GetEnvironFallback(['CXX_target', 'CXX'], cxx) 1428 cxx = GetEnvironFallback(['CXX_target', 'CXX'], cxx)
1418 master_ninja.variable('cxx', CommandWithWrapper('CXX', wrappers, cxx)) 1429 master_ninja.variable('cxx', CommandWithWrapper('CXX', wrappers, cxx))
1419 ld = GetEnvironFallback(['LD_target', 'LD'], ld) 1430 ld = GetEnvironFallback(['LD_target', 'LD'], ld)
1420 1431
1421 if not cc_host: 1432 if not cc_host:
1422 cc_host = cc 1433 cc_host = cc
1423 if not cxx_host: 1434 if not cxx_host:
1424 cxx_host = cxx 1435 cxx_host = cxx
1425 1436
1426 if flavor == 'win': 1437 if flavor == 'win':
1427 master_ninja.variable('ld', ld) 1438 master_ninja.variable('ld', ld)
1428 master_ninja.variable('idl', 'midl.exe') 1439 master_ninja.variable('idl', 'midl.exe')
1429 master_ninja.variable('ar', 'lib.exe') 1440 master_ninja.variable('ar', 'lib.exe')
1430 master_ninja.variable('rc', 'rc.exe') 1441 master_ninja.variable('rc', 'rc.exe')
1431 master_ninja.variable('asm', 'ml.exe') 1442 master_ninja.variable('asm', 'ml.exe')
1432 master_ninja.variable('mt', 'mt.exe') 1443 master_ninja.variable('mt', 'mt.exe')
1433 master_ninja.variable('use_dep_database', '1')
1434 else: 1444 else:
1435 master_ninja.variable('ld', CommandWithWrapper('LINK', wrappers, ld)) 1445 master_ninja.variable('ld', CommandWithWrapper('LINK', wrappers, ld))
1436 master_ninja.variable('ar', GetEnvironFallback(['AR_target', 'AR'], 'ar')) 1446 master_ninja.variable('ar', GetEnvironFallback(['AR_target', 'AR'], 'ar'))
1437 1447
1438 master_ninja.variable('ar_host', GetEnvironFallback(['AR_host'], 'ar')) 1448 master_ninja.variable('ar_host', GetEnvironFallback(['AR_host'], 'ar'))
1439 cc_host = GetEnvironFallback(['CC_host'], cc_host) 1449 cc_host = GetEnvironFallback(['CC_host'], cc_host)
1440 cxx_host = GetEnvironFallback(['CXX_host'], cxx_host) 1450 cxx_host = GetEnvironFallback(['CXX_host'], cxx_host)
1441 ld_host = GetEnvironFallback(['LD_host'], ld_host) 1451 ld_host = GetEnvironFallback(['LD_host'], ld_host)
1442 1452
1443 # The environment variable could be used in 'make_global_settings', like 1453 # The environment variable could be used in 'make_global_settings', like
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 arglists.append( 1821 arglists.append(
1812 (target_list, target_dicts, data, params, config_name)) 1822 (target_list, target_dicts, data, params, config_name))
1813 pool.map(CallGenerateOutputForConfig, arglists) 1823 pool.map(CallGenerateOutputForConfig, arglists)
1814 except KeyboardInterrupt, e: 1824 except KeyboardInterrupt, e:
1815 pool.terminate() 1825 pool.terminate()
1816 raise e 1826 raise e
1817 else: 1827 else:
1818 for config_name in config_names: 1828 for config_name in config_names:
1819 GenerateOutputForConfig(target_list, target_dicts, data, params, 1829 GenerateOutputForConfig(target_list, target_dicts, data, params,
1820 config_name) 1830 config_name)
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/msvs_emulation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698