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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if output_file: | 243 if output_file: |
244 output_file = expand_special(self.ConvertVSMacros(output_file)) | 244 output_file = expand_special(self.ConvertVSMacros(output_file)) |
245 return output_file | 245 return output_file |
246 | 246 |
247 def GetCflags(self, config): | 247 def GetCflags(self, config): |
248 """Returns the flags that need to be added to .c and .cc compilations.""" | 248 """Returns the flags that need to be added to .c and .cc compilations.""" |
249 cflags = [] | 249 cflags = [] |
250 cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]]) | 250 cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]]) |
251 cl = self._GetWrapper(self, self.msvs_settings[config], | 251 cl = self._GetWrapper(self, self.msvs_settings[config], |
252 'VCCLCompilerTool', append=cflags) | 252 'VCCLCompilerTool', append=cflags) |
253 cl('Optimization', map={'0': 'd', '2': 's'}, prefix='/O') | 253 cl('Optimization', |
| 254 map={'0': 'd', '1': '1', '2': '2', '3': 'x'}, prefix='/O') |
254 cl('InlineFunctionExpansion', prefix='/Ob') | 255 cl('InlineFunctionExpansion', prefix='/Ob') |
255 cl('OmitFramePointers', map={'false': '-', 'true': ''}, prefix='/Oy') | 256 cl('OmitFramePointers', map={'false': '-', 'true': ''}, prefix='/Oy') |
256 cl('FavorSizeOrSpeed', map={'1': 's', '2': 't'}, prefix='/O') | 257 cl('FavorSizeOrSpeed', map={'1': 't', '2': 's'}, prefix='/O') |
257 cl('WholeProgramOptimization', map={'true': '/GL'}) | 258 cl('WholeProgramOptimization', map={'true': '/GL'}) |
258 cl('WarningLevel', prefix='/W') | 259 cl('WarningLevel', prefix='/W') |
259 cl('WarnAsError', map={'true': '/WX'}) | 260 cl('WarnAsError', map={'true': '/WX'}) |
260 cl('DebugInformationFormat', | 261 cl('DebugInformationFormat', |
261 map={'1': '7', '3': 'i', '4': 'I'}, prefix='/Z') | 262 map={'1': '7', '3': 'i', '4': 'I'}, prefix='/Z') |
262 cl('RuntimeTypeInfo', map={'true': '/GR', 'false': '/GR-'}) | 263 cl('RuntimeTypeInfo', map={'true': '/GR', 'false': '/GR-'}) |
263 cl('EnableFunctionLevelLinking', map={'true': '/Gy', 'false': '/Gy-'}) | 264 cl('EnableFunctionLevelLinking', map={'true': '/Gy', 'false': '/Gy-'}) |
264 cl('MinimalRebuild', map={'true': '/Gm'}) | 265 cl('MinimalRebuild', map={'true': '/Gm'}) |
265 cl('BufferSecurityCheck', map={'true': '/GS', 'false': '/GS-'}) | 266 cl('BufferSecurityCheck', map={'true': '/GS', 'false': '/GS-'}) |
266 cl('BasicRuntimeChecks', map={'1': 's', '2': 'u', '3': '1'}, prefix='/RTC') | 267 cl('BasicRuntimeChecks', map={'1': 's', '2': 'u', '3': '1'}, prefix='/RTC') |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 return vs.SetupScript() | 468 return vs.SetupScript() |
468 | 469 |
469 def ExpandMacros(string, expansions): | 470 def ExpandMacros(string, expansions): |
470 """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv | 471 """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv |
471 for the canonical way to retrieve a suitable dict.""" | 472 for the canonical way to retrieve a suitable dict.""" |
472 if '$' in string: | 473 if '$' in string: |
473 for old, new in expansions.iteritems(): | 474 for old, new in expansions.iteritems(): |
474 assert '$(' not in new, new | 475 assert '$(' not in new, new |
475 string = string.replace(old, new) | 476 string = string.replace(old, new) |
476 return string | 477 return string |
OLD | NEW |