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 """ | 5 """ |
6 This module helps emulate Visual Studio 2008 behavior on top of other | 6 This module helps emulate Visual Studio 2008 behavior on top of other |
7 build systems, primarily ninja. | 7 build systems, primarily ninja. |
8 """ | 8 """ |
9 | 9 |
10 import os | 10 import os |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 return int(rule.get('msvs_cygwin_shell', | 753 return int(rule.get('msvs_cygwin_shell', |
754 self.spec.get('msvs_cygwin_shell', 1))) != 0 | 754 self.spec.get('msvs_cygwin_shell', 1))) != 0 |
755 | 755 |
756 def _HasExplicitRuleForExtension(self, spec, extension): | 756 def _HasExplicitRuleForExtension(self, spec, extension): |
757 """Determine if there's an explicit rule for a particular extension.""" | 757 """Determine if there's an explicit rule for a particular extension.""" |
758 for rule in spec.get('rules', []): | 758 for rule in spec.get('rules', []): |
759 if rule['extension'] == extension: | 759 if rule['extension'] == extension: |
760 return True | 760 return True |
761 return False | 761 return False |
762 | 762 |
763 def HasExplicitIdlRules(self, spec): | 763 def _HasExplicitIdlActions(self, spec): |
764 """Determine if there's an explicit rule for idl files. When there isn't we | 764 """Determine if an action should not run midl for .idl files.""" |
765 need to generate implicit rules to build MIDL .idl files.""" | 765 return any([action.get('explicit_idl_action', 0) |
766 return self._HasExplicitRuleForExtension(spec, 'idl') | 766 for action in spec.get('actions', [])]) |
| 767 |
| 768 def HasExplicitIdlRulesOrActions(self, spec): |
| 769 """Determine if there's an explicit rule or action for idl files. When |
| 770 there isn't we need to generate implicit rules to build MIDL .idl files.""" |
| 771 return (self._HasExplicitRuleForExtension(spec, 'idl') or |
| 772 self._HasExplicitIdlActions(spec)) |
767 | 773 |
768 def HasExplicitAsmRules(self, spec): | 774 def HasExplicitAsmRules(self, spec): |
769 """Determine if there's an explicit rule for asm files. When there isn't we | 775 """Determine if there's an explicit rule for asm files. When there isn't we |
770 need to generate implicit rules to assemble .asm files.""" | 776 need to generate implicit rules to assemble .asm files.""" |
771 return self._HasExplicitRuleForExtension(spec, 'asm') | 777 return self._HasExplicitRuleForExtension(spec, 'asm') |
772 | 778 |
773 def GetIdlBuildData(self, source, config): | 779 def GetIdlBuildData(self, source, config): |
774 """Determine the implicit outputs for an idl file. Returns output | 780 """Determine the implicit outputs for an idl file. Returns output |
775 directory, outputs, and variables and flags that are required.""" | 781 directory, outputs, and variables and flags that are required.""" |
776 config = self._TargetConfig(config) | 782 config = self._TargetConfig(config) |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 | 1016 |
1011 # To determine processor word size on Windows, in addition to checking | 1017 # To determine processor word size on Windows, in addition to checking |
1012 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current | 1018 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current |
1013 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which | 1019 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which |
1014 # contains the actual word size of the system when running thru WOW64). | 1020 # contains the actual word size of the system when running thru WOW64). |
1015 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or | 1021 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or |
1016 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): | 1022 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): |
1017 default_variables['MSVS_OS_BITS'] = 64 | 1023 default_variables['MSVS_OS_BITS'] = 64 |
1018 else: | 1024 else: |
1019 default_variables['MSVS_OS_BITS'] = 32 | 1025 default_variables['MSVS_OS_BITS'] = 32 |
OLD | NEW |