| OLD | NEW |
| 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 json | 7 import json |
| 8 import multiprocessing | 8 import multiprocessing |
| 9 import os.path | 9 import os.path |
| 10 import re | 10 import re |
| (...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 cxx = 'c++' | 1675 cxx = 'c++' |
| 1676 ld = '$cc' | 1676 ld = '$cc' |
| 1677 ldxx = '$cxx' | 1677 ldxx = '$cxx' |
| 1678 ld_host = '$cc_host' | 1678 ld_host = '$cc_host' |
| 1679 ldxx_host = '$cxx_host' | 1679 ldxx_host = '$cxx_host' |
| 1680 | 1680 |
| 1681 cc_host = None | 1681 cc_host = None |
| 1682 cxx_host = None | 1682 cxx_host = None |
| 1683 cc_host_global_setting = None | 1683 cc_host_global_setting = None |
| 1684 cxx_host_global_setting = None | 1684 cxx_host_global_setting = None |
| 1685 clang_cl = None |
| 1685 | 1686 |
| 1686 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) | 1687 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) |
| 1687 make_global_settings = data[build_file].get('make_global_settings', []) | 1688 make_global_settings = data[build_file].get('make_global_settings', []) |
| 1688 build_to_root = gyp.common.InvertRelativePath(build_dir, | 1689 build_to_root = gyp.common.InvertRelativePath(build_dir, |
| 1689 options.toplevel_dir) | 1690 options.toplevel_dir) |
| 1690 wrappers = {} | 1691 wrappers = {} |
| 1691 for key, value in make_global_settings: | 1692 for key, value in make_global_settings: |
| 1692 if key == 'CC': | 1693 if key == 'CC': |
| 1693 cc = os.path.join(build_to_root, value) | 1694 cc = os.path.join(build_to_root, value) |
| 1695 if cc.endswith('clang-cl'): |
| 1696 clang_cl = cc |
| 1694 if key == 'CXX': | 1697 if key == 'CXX': |
| 1695 cxx = os.path.join(build_to_root, value) | 1698 cxx = os.path.join(build_to_root, value) |
| 1696 if key == 'CC.host': | 1699 if key == 'CC.host': |
| 1697 cc_host = os.path.join(build_to_root, value) | 1700 cc_host = os.path.join(build_to_root, value) |
| 1698 cc_host_global_setting = value | 1701 cc_host_global_setting = value |
| 1699 if key == 'CXX.host': | 1702 if key == 'CXX.host': |
| 1700 cxx_host = os.path.join(build_to_root, value) | 1703 cxx_host = os.path.join(build_to_root, value) |
| 1701 cxx_host_global_setting = value | 1704 cxx_host_global_setting = value |
| 1702 if key.endswith('_wrapper'): | 1705 if key.endswith('_wrapper'): |
| 1703 wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value) | 1706 wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value) |
| 1704 | 1707 |
| 1705 # Support wrappers from environment variables too. | 1708 # Support wrappers from environment variables too. |
| 1706 for key, value in os.environ.iteritems(): | 1709 for key, value in os.environ.iteritems(): |
| 1707 if key.lower().endswith('_wrapper'): | 1710 if key.lower().endswith('_wrapper'): |
| 1708 key_prefix = key[:-len('_wrapper')] | 1711 key_prefix = key[:-len('_wrapper')] |
| 1709 key_prefix = re.sub(r'\.HOST$', '.host', key_prefix) | 1712 key_prefix = re.sub(r'\.HOST$', '.host', key_prefix) |
| 1710 wrappers[key_prefix] = os.path.join(build_to_root, value) | 1713 wrappers[key_prefix] = os.path.join(build_to_root, value) |
| 1711 | 1714 |
| 1712 if flavor == 'win': | 1715 if flavor == 'win': |
| 1713 cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles( | 1716 cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles( |
| 1714 toplevel_build, generator_flags, OpenOutput) | 1717 toplevel_build, generator_flags, OpenOutput) |
| 1715 for arch, path in cl_paths.iteritems(): | 1718 for arch, path in cl_paths.iteritems(): |
| 1716 master_ninja.variable( | 1719 if clang_cl: |
| 1717 'cl_' + arch, CommandWithWrapper('CC', wrappers, | 1720 # If we have selected clang-cl, use that instead. |
| 1718 QuoteShellArgument(path, flavor))) | 1721 path = clang_cl |
| 1722 command = CommandWithWrapper('CC', wrappers, |
| 1723 QuoteShellArgument(path, 'win')) |
| 1724 if clang_cl: |
| 1725 # Use clang-cl to cross-compile for x86 or x86_64. |
| 1726 command += (' -m32' if arch == 'x86' else ' -m64') |
| 1727 master_ninja.variable('cl_' + arch, command) |
| 1719 | 1728 |
| 1720 cc = GetEnvironFallback(['CC_target', 'CC'], cc) | 1729 cc = GetEnvironFallback(['CC_target', 'CC'], cc) |
| 1721 master_ninja.variable('cc', CommandWithWrapper('CC', wrappers, cc)) | 1730 master_ninja.variable('cc', CommandWithWrapper('CC', wrappers, cc)) |
| 1722 cxx = GetEnvironFallback(['CXX_target', 'CXX'], cxx) | 1731 cxx = GetEnvironFallback(['CXX_target', 'CXX'], cxx) |
| 1723 master_ninja.variable('cxx', CommandWithWrapper('CXX', wrappers, cxx)) | 1732 master_ninja.variable('cxx', CommandWithWrapper('CXX', wrappers, cxx)) |
| 1724 | 1733 |
| 1725 if flavor == 'win': | 1734 if flavor == 'win': |
| 1726 master_ninja.variable('ld', ld) | 1735 master_ninja.variable('ld', ld) |
| 1727 master_ninja.variable('idl', 'midl.exe') | 1736 master_ninja.variable('idl', 'midl.exe') |
| 1728 master_ninja.variable('ar', 'lib.exe') | 1737 master_ninja.variable('ar', 'lib.exe') |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 arglists.append( | 2147 arglists.append( |
| 2139 (target_list, target_dicts, data, params, config_name)) | 2148 (target_list, target_dicts, data, params, config_name)) |
| 2140 pool.map(CallGenerateOutputForConfig, arglists) | 2149 pool.map(CallGenerateOutputForConfig, arglists) |
| 2141 except KeyboardInterrupt, e: | 2150 except KeyboardInterrupt, e: |
| 2142 pool.terminate() | 2151 pool.terminate() |
| 2143 raise e | 2152 raise e |
| 2144 else: | 2153 else: |
| 2145 for config_name in config_names: | 2154 for config_name in config_names: |
| 2146 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2155 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 2147 config_name) | 2156 config_name) |
| OLD | NEW |