| 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 collections | 5 import collections |
| 6 import copy | 6 import copy |
| 7 import hashlib | 7 import hashlib |
| 8 import json | 8 import json |
| 9 import multiprocessing | 9 import multiprocessing |
| 10 import os.path | 10 import os.path |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 # Track if this target contains any C++ files, to decide if gcc or g++ | 378 # Track if this target contains any C++ files, to decide if gcc or g++ |
| 379 # should be used for linking. | 379 # should be used for linking. |
| 380 self.uses_cpp = False | 380 self.uses_cpp = False |
| 381 | 381 |
| 382 self.target_rpath = generator_flags.get('target_rpath', r'\$$ORIGIN/lib/') | 382 self.target_rpath = generator_flags.get('target_rpath', r'\$$ORIGIN/lib/') |
| 383 | 383 |
| 384 self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) | 384 self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) |
| 385 self.xcode_settings = self.msvs_settings = None | 385 self.xcode_settings = self.msvs_settings = None |
| 386 if self.flavor == 'mac': | 386 if self.flavor == 'mac': |
| 387 self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) | 387 self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) |
| 388 mac_toolchain_dir = generator_flags.get('mac_toolchain_dir', None) |
| 389 if mac_toolchain_dir: |
| 390 self.xcode_settings.mac_toolchain_dir = mac_toolchain_dir |
| 391 |
| 388 if self.flavor == 'win': | 392 if self.flavor == 'win': |
| 389 self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, | 393 self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, |
| 390 generator_flags) | 394 generator_flags) |
| 391 arch = self.msvs_settings.GetArch(config_name) | 395 arch = self.msvs_settings.GetArch(config_name) |
| 392 self.ninja.variable('arch', self.win_env[arch]) | 396 self.ninja.variable('arch', self.win_env[arch]) |
| 393 self.ninja.variable('cc', '$cl_' + arch) | 397 self.ninja.variable('cc', '$cl_' + arch) |
| 394 self.ninja.variable('cxx', '$cl_' + arch) | 398 self.ninja.variable('cxx', '$cl_' + arch) |
| 395 self.ninja.variable('cc_host', '$cl_' + arch) | 399 self.ninja.variable('cc_host', '$cl_' + arch) |
| 396 self.ninja.variable('cxx_host', '$cl_' + arch) | 400 self.ninja.variable('cxx_host', '$cl_' + arch) |
| 397 self.ninja.variable('asm', '$ml_' + arch) | 401 self.ninja.variable('asm', '$ml_' + arch) |
| (...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 # e.g. "out/Debug" | 1853 # e.g. "out/Debug" |
| 1850 build_dir = os.path.normpath( | 1854 build_dir = os.path.normpath( |
| 1851 os.path.join(ComputeOutputDir(params), config_name)) | 1855 os.path.join(ComputeOutputDir(params), config_name)) |
| 1852 | 1856 |
| 1853 toplevel_build = os.path.join(options.toplevel_dir, build_dir) | 1857 toplevel_build = os.path.join(options.toplevel_dir, build_dir) |
| 1854 | 1858 |
| 1855 master_ninja_file = OpenOutput(os.path.join(toplevel_build, 'build.ninja')) | 1859 master_ninja_file = OpenOutput(os.path.join(toplevel_build, 'build.ninja')) |
| 1856 master_ninja = ninja_syntax.Writer(master_ninja_file, width=120) | 1860 master_ninja = ninja_syntax.Writer(master_ninja_file, width=120) |
| 1857 | 1861 |
| 1858 # Put build-time support tools in out/{config_name}. | 1862 # Put build-time support tools in out/{config_name}. |
| 1859 gyp.common.CopyTool(flavor, toplevel_build) | 1863 gyp.common.CopyTool(flavor, toplevel_build, generator_flags) |
| 1860 | 1864 |
| 1861 # Grab make settings for CC/CXX. | 1865 # Grab make settings for CC/CXX. |
| 1862 # The rules are | 1866 # The rules are |
| 1863 # - The priority from low to high is gcc/g++, the 'make_global_settings' in | 1867 # - The priority from low to high is gcc/g++, the 'make_global_settings' in |
| 1864 # gyp, the environment variable. | 1868 # gyp, the environment variable. |
| 1865 # - If there is no 'make_global_settings' for CC.host/CXX.host or | 1869 # - If there is no 'make_global_settings' for CC.host/CXX.host or |
| 1866 # 'CC_host'/'CXX_host' enviroment variable, cc_host/cxx_host should be set | 1870 # 'CC_host'/'CXX_host' enviroment variable, cc_host/cxx_host should be set |
| 1867 # to cc/cxx. | 1871 # to cc/cxx. |
| 1868 if flavor == 'win': | 1872 if flavor == 'win': |
| 1869 ar = 'lib.exe' | 1873 ar = 'lib.exe' |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 if key.endswith('_wrapper'): | 1934 if key.endswith('_wrapper'): |
| 1931 wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value) | 1935 wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value) |
| 1932 | 1936 |
| 1933 # Support wrappers from environment variables too. | 1937 # Support wrappers from environment variables too. |
| 1934 for key, value in os.environ.iteritems(): | 1938 for key, value in os.environ.iteritems(): |
| 1935 if key.lower().endswith('_wrapper'): | 1939 if key.lower().endswith('_wrapper'): |
| 1936 key_prefix = key[:-len('_wrapper')] | 1940 key_prefix = key[:-len('_wrapper')] |
| 1937 key_prefix = re.sub(r'\.HOST$', '.host', key_prefix) | 1941 key_prefix = re.sub(r'\.HOST$', '.host', key_prefix) |
| 1938 wrappers[key_prefix] = os.path.join(build_to_root, value) | 1942 wrappers[key_prefix] = os.path.join(build_to_root, value) |
| 1939 | 1943 |
| 1944 mac_toolchain_dir = generator_flags.get('mac_toolchain_dir', None) |
| 1945 if mac_toolchain_dir: |
| 1946 wrappers['LINK'] = "export DEVELOPER_DIR='%s' &&" % mac_toolchain_dir |
| 1947 |
| 1940 if flavor == 'win': | 1948 if flavor == 'win': |
| 1941 configs = [target_dicts[qualified_target]['configurations'][config_name] | 1949 configs = [target_dicts[qualified_target]['configurations'][config_name] |
| 1942 for qualified_target in target_list] | 1950 for qualified_target in target_list] |
| 1943 shared_system_includes = None | 1951 shared_system_includes = None |
| 1944 if not generator_flags.get('ninja_use_custom_environment_files', 0): | 1952 if not generator_flags.get('ninja_use_custom_environment_files', 0): |
| 1945 shared_system_includes = \ | 1953 shared_system_includes = \ |
| 1946 gyp.msvs_emulation.ExtractSharedMSVSSystemIncludes( | 1954 gyp.msvs_emulation.ExtractSharedMSVSSystemIncludes( |
| 1947 configs, generator_flags) | 1955 configs, generator_flags) |
| 1948 cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles( | 1956 cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles( |
| 1949 toplevel_build, generator_flags, shared_system_includes, OpenOutput) | 1957 toplevel_build, generator_flags, shared_system_includes, OpenOutput) |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2458 arglists.append( | 2466 arglists.append( |
| 2459 (target_list, target_dicts, data, params, config_name)) | 2467 (target_list, target_dicts, data, params, config_name)) |
| 2460 pool.map(CallGenerateOutputForConfig, arglists) | 2468 pool.map(CallGenerateOutputForConfig, arglists) |
| 2461 except KeyboardInterrupt, e: | 2469 except KeyboardInterrupt, e: |
| 2462 pool.terminate() | 2470 pool.terminate() |
| 2463 raise e | 2471 raise e |
| 2464 else: | 2472 else: |
| 2465 for config_name in config_names: | 2473 for config_name in config_names: |
| 2466 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2474 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 2467 config_name) | 2475 config_name) |
| OLD | NEW |