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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 config = self._TargetConfig(config) | 310 config = self._TargetConfig(config) |
311 type = self.spec['type'] | 311 type = self.spec['type'] |
312 root = 'VCLibrarianTool' if type == 'static_library' else 'VCLinkerTool' | 312 root = 'VCLibrarianTool' if type == 'static_library' else 'VCLinkerTool' |
313 # TODO(scottmg): Handle OutputDirectory without OutputFile. | 313 # TODO(scottmg): Handle OutputDirectory without OutputFile. |
314 output_file = self._Setting((root, 'OutputFile'), config) | 314 output_file = self._Setting((root, 'OutputFile'), config) |
315 if output_file: | 315 if output_file: |
316 output_file = expand_special(self.ConvertVSMacros( | 316 output_file = expand_special(self.ConvertVSMacros( |
317 output_file, config=config)) | 317 output_file, config=config)) |
318 return output_file | 318 return output_file |
319 | 319 |
320 def GetPDBName(self, config, expand_special): | 320 def GetPDBName(self, config, expand_special, default=None): |
321 """Gets the explicitly overridden pdb name for a target or returns None | 321 """Gets the explicitly overridden pdb name for a target or returns |
322 if it's not overridden.""" | 322 default=None if it's not overridden, or if no pdb will be generated.""" |
323 config = self._TargetConfig(config) | 323 config = self._TargetConfig(config) |
324 output_file = self._Setting(('VCLinkerTool', 'ProgramDatabaseFile'), config) | 324 output_file = self._Setting(('VCLinkerTool', 'ProgramDatabaseFile'), config) |
325 if output_file: | 325 generate_debug_info = self._Setting( |
326 output_file = expand_special(self.ConvertVSMacros( | 326 ('VCLinkerTool', 'GenerateDebugInformation'), config) |
327 output_file, config=config)) | 327 if generate_debug_info: |
328 return output_file | 328 if output_file: |
329 return expand_special(self.ConvertVSMacros(output_file, config=config)) | |
Nico
2014/01/08 21:44:13
This won't match the /PDB: flag passed to the link
| |
330 else: | |
331 return default | |
332 else: | |
333 return None | |
329 | 334 |
330 def GetCflags(self, config): | 335 def GetCflags(self, config): |
331 """Returns the flags that need to be added to .c and .cc compilations.""" | 336 """Returns the flags that need to be added to .c and .cc compilations.""" |
332 config = self._TargetConfig(config) | 337 config = self._TargetConfig(config) |
333 cflags = [] | 338 cflags = [] |
334 cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]]) | 339 cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]]) |
335 cl = self._GetWrapper(self, self.msvs_settings[config], | 340 cl = self._GetWrapper(self, self.msvs_settings[config], |
336 'VCCLCompilerTool', append=cflags) | 341 'VCCLCompilerTool', append=cflags) |
337 cl('Optimization', | 342 cl('Optimization', |
338 map={'0': 'd', '1': '1', '2': '2', '3': 'x'}, prefix='/O', default='2') | 343 map={'0': 'd', '1': '1', '2': '2', '3': 'x'}, prefix='/O', default='2') |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
945 | 950 |
946 # To determine processor word size on Windows, in addition to checking | 951 # To determine processor word size on Windows, in addition to checking |
947 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current | 952 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current |
948 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which | 953 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which |
949 # contains the actual word size of the system when running thru WOW64). | 954 # contains the actual word size of the system when running thru WOW64). |
950 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or | 955 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or |
951 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): | 956 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): |
952 default_variables['MSVS_OS_BITS'] = 64 | 957 default_variables['MSVS_OS_BITS'] = 64 |
953 else: | 958 else: |
954 default_variables['MSVS_OS_BITS'] = 32 | 959 default_variables['MSVS_OS_BITS'] = 32 |
OLD | NEW |