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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 ldflags.append('/NXCOMPAT') | 359 ldflags.append('/NXCOMPAT') |
360 | 360 |
361 return ldflags | 361 return ldflags |
362 | 362 |
363 def IsUseLibraryDependencyInputs(self, config): | 363 def IsUseLibraryDependencyInputs(self, config): |
364 """Returns whether the target should be linked via Use Library Dependency | 364 """Returns whether the target should be linked via Use Library Dependency |
365 Inputs (using component .objs of a given .lib).""" | 365 Inputs (using component .objs of a given .lib).""" |
366 uldi = self._Setting(('VCLinkerTool', 'UseLibraryDependencyInputs'), config) | 366 uldi = self._Setting(('VCLinkerTool', 'UseLibraryDependencyInputs'), config) |
367 return uldi == 'true' | 367 return uldi == 'true' |
368 | 368 |
369 def GetRcflags(self, config): | 369 def GetRcflags(self, config, gyp_to_ninja_path): |
370 """Returns the flags that need to be added to invocations of the resource | 370 """Returns the flags that need to be added to invocations of the resource |
371 compiler.""" | 371 compiler.""" |
372 rcflags = [] | 372 rcflags = [] |
373 rc = self._GetWrapper(self, self.msvs_settings[config], | 373 rc = self._GetWrapper(self, self.msvs_settings[config], |
374 'VCResourceCompilerTool', append=rcflags) | 374 'VCResourceCompilerTool', append=rcflags) |
375 rc('AdditionalIncludeDirectories', prefix='/I') | 375 rc('AdditionalIncludeDirectories', map=gyp_to_ninja_path, prefix='/I') |
| 376 rcflags.append('/I' + gyp_to_ninja_path('.')) |
376 rc('PreprocessorDefinitions', prefix='/d') | 377 rc('PreprocessorDefinitions', prefix='/d') |
377 # /l arg must be in hex without leading '0x' | 378 # /l arg must be in hex without leading '0x' |
378 rc('Culture', prefix='/l', map=lambda x: hex(int(x))[2:]) | 379 rc('Culture', prefix='/l', map=lambda x: hex(int(x))[2:]) |
379 return rcflags | 380 return rcflags |
380 | 381 |
381 def BuildCygwinBashCommandLine(self, args, path_to_base): | 382 def BuildCygwinBashCommandLine(self, args, path_to_base): |
382 """Build a command line that runs args via cygwin bash. We assume that all | 383 """Build a command line that runs args via cygwin bash. We assume that all |
383 incoming paths are in Windows normpath'd form, so they need to be | 384 incoming paths are in Windows normpath'd form, so they need to be |
384 converted to posix style for the part of the command line that's passed to | 385 converted to posix style for the part of the command line that's passed to |
385 bash. We also have to do some Visual Studio macro emulation here because | 386 bash. We also have to do some Visual Studio macro emulation here because |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 return vs.SetupScript() | 469 return vs.SetupScript() |
469 | 470 |
470 def ExpandMacros(string, expansions): | 471 def ExpandMacros(string, expansions): |
471 """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv | 472 """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv |
472 for the canonical way to retrieve a suitable dict.""" | 473 for the canonical way to retrieve a suitable dict.""" |
473 if '$' in string: | 474 if '$' in string: |
474 for old, new in expansions.iteritems(): | 475 for old, new in expansions.iteritems(): |
475 assert '$(' not in new, new | 476 assert '$(' not in new, new |
476 string = string.replace(old, new) | 477 string = string.replace(old, new) |
477 return string | 478 return string |
OLD | NEW |