OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 self.is_standalone_static_library = bool( | 371 self.is_standalone_static_library = bool( |
372 spec.get('standalone_static_library', 0)) | 372 spec.get('standalone_static_library', 0)) |
373 | 373 |
374 self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) | 374 self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) |
375 self.xcode_settings = self.msvs_settings = None | 375 self.xcode_settings = self.msvs_settings = None |
376 if self.flavor == 'mac': | 376 if self.flavor == 'mac': |
377 self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) | 377 self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) |
378 if self.flavor == 'win': | 378 if self.flavor == 'win': |
379 self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, | 379 self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, |
380 generator_flags) | 380 generator_flags) |
381 target_platform = self.msvs_settings.GetTargetPlatform(config_name) | 381 arch = self.msvs_settings.GetArch(config_name) |
382 self.ninja.variable('arch', self.win_env[target_platform]) | 382 self.ninja.variable('arch', self.win_env[arch]) |
383 | 383 |
384 # Compute predepends for all rules. | 384 # Compute predepends for all rules. |
385 # actions_depends is the dependencies this target depends on before running | 385 # actions_depends is the dependencies this target depends on before running |
386 # any of its action/rule/copy steps. | 386 # any of its action/rule/copy steps. |
387 # compile_depends is the dependencies this target depends on before running | 387 # compile_depends is the dependencies this target depends on before running |
388 # any of its compile steps. | 388 # any of its compile steps. |
389 actions_depends = [] | 389 actions_depends = [] |
390 compile_depends = [] | 390 compile_depends = [] |
391 # TODO(evan): it is rather confusing which things are lists and which | 391 # TODO(evan): it is rather confusing which things are lists and which |
392 # are strings. Fix these. | 392 # are strings. Fix these. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 gyp.msvs_emulation.VerifyMissingSources( | 428 gyp.msvs_emulation.VerifyMissingSources( |
429 sources, self.abs_build_dir, generator_flags, self.GypPathToNinja) | 429 sources, self.abs_build_dir, generator_flags, self.GypPathToNinja) |
430 pch = gyp.msvs_emulation.PrecompiledHeader( | 430 pch = gyp.msvs_emulation.PrecompiledHeader( |
431 self.msvs_settings, config_name, self.GypPathToNinja) | 431 self.msvs_settings, config_name, self.GypPathToNinja) |
432 else: | 432 else: |
433 pch = gyp.xcode_emulation.MacPrefixHeader( | 433 pch = gyp.xcode_emulation.MacPrefixHeader( |
434 self.xcode_settings, self.GypPathToNinja, | 434 self.xcode_settings, self.GypPathToNinja, |
435 lambda path, lang: self.GypPathToUniqueOutput(path + '-' + lang)) | 435 lambda path, lang: self.GypPathToUniqueOutput(path + '-' + lang)) |
436 link_deps = self.WriteSources( | 436 link_deps = self.WriteSources( |
437 config_name, config, sources, compile_depends_stamp, pch, | 437 config_name, config, sources, compile_depends_stamp, pch, |
438 case_sensitive_filesystem) | 438 case_sensitive_filesystem, spec) |
439 # Some actions/rules output 'sources' that are already object files. | 439 # Some actions/rules output 'sources' that are already object files. |
440 link_deps += [self.GypPathToNinja(f) | 440 link_deps += [self.GypPathToNinja(f) |
441 for f in sources if f.endswith(self.obj_ext)] | 441 for f in sources if f.endswith(self.obj_ext)] |
442 | 442 |
443 if self.flavor == 'win' and self.target.type == 'static_library': | 443 if self.flavor == 'win' and self.target.type == 'static_library': |
444 self.target.component_objs = link_deps | 444 self.target.component_objs = link_deps |
445 | 445 |
446 # Write out a link step, if needed. | 446 # Write out a link step, if needed. |
447 output = None | 447 output = None |
448 if link_deps or self.target.actions_stamp or actions_depends: | 448 if link_deps or self.target.actions_stamp or actions_depends: |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 | 714 |
715 env = self.GetSortedXcodeEnv(additional_settings=extra_env) | 715 env = self.GetSortedXcodeEnv(additional_settings=extra_env) |
716 env = self.ComputeExportEnvString(env) | 716 env = self.ComputeExportEnvString(env) |
717 | 717 |
718 self.ninja.build(out, 'mac_tool', info_plist, | 718 self.ninja.build(out, 'mac_tool', info_plist, |
719 variables=[('mactool_cmd', 'copy-info-plist'), | 719 variables=[('mactool_cmd', 'copy-info-plist'), |
720 ('env', env)]) | 720 ('env', env)]) |
721 bundle_depends.append(out) | 721 bundle_depends.append(out) |
722 | 722 |
723 def WriteSources(self, config_name, config, sources, predepends, | 723 def WriteSources(self, config_name, config, sources, predepends, |
724 precompiled_header, case_sensitive_filesystem): | 724 precompiled_header, case_sensitive_filesystem, spec): |
725 """Write build rules to compile all of |sources|.""" | 725 """Write build rules to compile all of |sources|.""" |
726 if self.toolset == 'host': | 726 if self.toolset == 'host': |
727 self.ninja.variable('ar', '$ar_host') | 727 self.ninja.variable('ar', '$ar_host') |
728 self.ninja.variable('cc', '$cc_host') | 728 self.ninja.variable('cc', '$cc_host') |
729 self.ninja.variable('cxx', '$cxx_host') | 729 self.ninja.variable('cxx', '$cxx_host') |
730 self.ninja.variable('ld', '$ld_host') | 730 self.ninja.variable('ld', '$ld_host') |
731 | 731 |
732 extra_defines = [] | 732 extra_defines = [] |
733 if self.flavor == 'mac': | 733 if self.flavor == 'mac': |
734 cflags = self.xcode_settings.GetCflags(config_name) | 734 cflags = self.xcode_settings.GetCflags(config_name) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 filename, ext = os.path.splitext(source) | 791 filename, ext = os.path.splitext(source) |
792 ext = ext[1:] | 792 ext = ext[1:] |
793 obj_ext = self.obj_ext | 793 obj_ext = self.obj_ext |
794 if ext in ('cc', 'cpp', 'cxx'): | 794 if ext in ('cc', 'cpp', 'cxx'): |
795 command = 'cxx' | 795 command = 'cxx' |
796 elif ext == 'c' or (ext == 'S' and self.flavor != 'win'): | 796 elif ext == 'c' or (ext == 'S' and self.flavor != 'win'): |
797 command = 'cc' | 797 command = 'cc' |
798 elif ext == 's' and self.flavor != 'win': # Doesn't generate .o.d files. | 798 elif ext == 's' and self.flavor != 'win': # Doesn't generate .o.d files. |
799 command = 'cc_s' | 799 command = 'cc_s' |
800 elif (self.flavor == 'win' and ext == 'asm' and | 800 elif (self.flavor == 'win' and ext == 'asm' and |
801 self.msvs_settings.GetTargetPlatform(config_name) == 'Win32'): | 801 self.msvs_settings.GetArch(config_name) == 'x86' and |
| 802 not self.msvs_settings.HasExplicitAsmRules(spec)): |
802 # Asm files only get auto assembled for x86 (not x64). | 803 # Asm files only get auto assembled for x86 (not x64). |
803 command = 'asm' | 804 command = 'asm' |
804 # Add the _asm suffix as msvs is capable of handling .cc and | 805 # Add the _asm suffix as msvs is capable of handling .cc and |
805 # .asm files of the same name without collision. | 806 # .asm files of the same name without collision. |
806 obj_ext = '_asm.obj' | 807 obj_ext = '_asm.obj' |
807 elif self.flavor == 'mac' and ext == 'm': | 808 elif self.flavor == 'mac' and ext == 'm': |
808 command = 'objc' | 809 command = 'objc' |
809 elif self.flavor == 'mac' and ext == 'mm': | 810 elif self.flavor == 'mac' and ext == 'mm': |
810 command = 'objcxx' | 811 command = 'objcxx' |
811 elif self.flavor == 'win' and ext == 'rc': | 812 elif self.flavor == 'win' and ext == 'rc': |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 arglists.append( | 1790 arglists.append( |
1790 (target_list, target_dicts, data, params, config_name)) | 1791 (target_list, target_dicts, data, params, config_name)) |
1791 pool.map(CallGenerateOutputForConfig, arglists) | 1792 pool.map(CallGenerateOutputForConfig, arglists) |
1792 except KeyboardInterrupt, e: | 1793 except KeyboardInterrupt, e: |
1793 pool.terminate() | 1794 pool.terminate() |
1794 raise e | 1795 raise e |
1795 else: | 1796 else: |
1796 for config_name in config_names: | 1797 for config_name in config_names: |
1797 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1798 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1798 config_name) | 1799 config_name) |
OLD | NEW |