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

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

Issue 25757002: Refactor calculation of variables, common to many generators. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | « pylib/gyp/generator/eclipse.py ('k') | 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 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 global generator_extra_sources_for_rules 1438 global generator_extra_sources_for_rules
1439 generator_extra_sources_for_rules = getattr(xcode_generator, 1439 generator_extra_sources_for_rules = getattr(xcode_generator,
1440 'generator_extra_sources_for_rules', []) 1440 'generator_extra_sources_for_rules', [])
1441 elif flavor == 'win': 1441 elif flavor == 'win':
1442 default_variables.setdefault('OS', 'win') 1442 default_variables.setdefault('OS', 'win')
1443 default_variables['EXECUTABLE_SUFFIX'] = '.exe' 1443 default_variables['EXECUTABLE_SUFFIX'] = '.exe'
1444 default_variables['STATIC_LIB_PREFIX'] = '' 1444 default_variables['STATIC_LIB_PREFIX'] = ''
1445 default_variables['STATIC_LIB_SUFFIX'] = '.lib' 1445 default_variables['STATIC_LIB_SUFFIX'] = '.lib'
1446 default_variables['SHARED_LIB_PREFIX'] = '' 1446 default_variables['SHARED_LIB_PREFIX'] = ''
1447 default_variables['SHARED_LIB_SUFFIX'] = '.dll' 1447 default_variables['SHARED_LIB_SUFFIX'] = '.dll'
1448 generator_flags = params.get('generator_flags', {})
1449 1448
1450 # Copy additional generator configuration data from VS, which is shared 1449 # Copy additional generator configuration data from VS, which is shared
1451 # by the Windows Ninja generator. 1450 # by the Windows Ninja generator.
1452 import gyp.generator.msvs as msvs_generator 1451 import gyp.generator.msvs as msvs_generator
1453 generator_additional_non_configuration_keys = getattr(msvs_generator, 1452 generator_additional_non_configuration_keys = getattr(msvs_generator,
1454 'generator_additional_non_configuration_keys', []) 1453 'generator_additional_non_configuration_keys', [])
1455 generator_additional_path_sections = getattr(msvs_generator, 1454 generator_additional_path_sections = getattr(msvs_generator,
1456 'generator_additional_path_sections', []) 1455 'generator_additional_path_sections', [])
1457 1456
1458 # Set a variable so conditions can be based on msvs_version. 1457 gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)
1459 msvs_version = gyp.msvs_emulation.GetVSVersion(generator_flags)
1460 default_variables['MSVS_VERSION'] = msvs_version.ShortName()
1461
1462 # To determine processor word size on Windows, in addition to checking
1463 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current
1464 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which
1465 # contains the actual word size of the system when running thru WOW64).
1466 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or
1467 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')):
1468 default_variables['MSVS_OS_BITS'] = 64
1469 else:
1470 default_variables['MSVS_OS_BITS'] = 32
1471 else: 1458 else:
1472 operating_system = flavor 1459 operating_system = flavor
1473 if flavor == 'android': 1460 if flavor == 'android':
1474 operating_system = 'linux' # Keep this legacy behavior for now. 1461 operating_system = 'linux' # Keep this legacy behavior for now.
1475 default_variables.setdefault('OS', operating_system) 1462 default_variables.setdefault('OS', operating_system)
1476 default_variables.setdefault('SHARED_LIB_SUFFIX', '.so') 1463 default_variables.setdefault('SHARED_LIB_SUFFIX', '.so')
1477 default_variables.setdefault('SHARED_LIB_DIR', 1464 default_variables.setdefault('SHARED_LIB_DIR',
1478 os.path.join('$!PRODUCT_DIR', 'lib')) 1465 os.path.join('$!PRODUCT_DIR', 'lib'))
1479 default_variables.setdefault('LIB_DIR', 1466 default_variables.setdefault('LIB_DIR',
1480 os.path.join('$!PRODUCT_DIR', 'obj')) 1467 os.path.join('$!PRODUCT_DIR', 'obj'))
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 arglists.append( 2120 arglists.append(
2134 (target_list, target_dicts, data, params, config_name)) 2121 (target_list, target_dicts, data, params, config_name))
2135 pool.map(CallGenerateOutputForConfig, arglists) 2122 pool.map(CallGenerateOutputForConfig, arglists)
2136 except KeyboardInterrupt, e: 2123 except KeyboardInterrupt, e:
2137 pool.terminate() 2124 pool.terminate()
2138 raise e 2125 raise e
2139 else: 2126 else:
2140 for config_name in config_names: 2127 for config_name in config_names:
2141 GenerateOutputForConfig(target_list, target_dicts, data, params, 2128 GenerateOutputForConfig(target_list, target_dicts, data, params,
2142 config_name) 2129 config_name)
OLDNEW
« no previous file with comments | « pylib/gyp/generator/eclipse.py ('k') | pylib/gyp/msvs_emulation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698