Chromium Code Reviews| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 self.msvs_cygwin_dirs = spec.get('msvs_cygwin_dirs', ['.']) | 143 self.msvs_cygwin_dirs = spec.get('msvs_cygwin_dirs', ['.']) |
| 144 | 144 |
| 145 def GetVSMacroEnv(self, base_to_build=None): | 145 def GetVSMacroEnv(self, base_to_build=None): |
| 146 """Get a dict of variables mapping internal VS macro names to their gyp | 146 """Get a dict of variables mapping internal VS macro names to their gyp |
| 147 equivalents.""" | 147 equivalents.""" |
| 148 replacements = { | 148 replacements = { |
| 149 '$(VSInstallDir)': self.vs_version.Path(), | 149 '$(VSInstallDir)': self.vs_version.Path(), |
| 150 '$(VCInstallDir)': os.path.join(self.vs_version.Path(), 'VC'), | 150 '$(VCInstallDir)': os.path.join(self.vs_version.Path(), 'VC'), |
| 151 '$(OutDir)\\': base_to_build + '\\' if base_to_build else '', | 151 '$(OutDir)\\': base_to_build + '\\' if base_to_build else '', |
| 152 '$(IntDir)': '$!INTERMEDIATE_DIR', | 152 '$(IntDir)': '$!INTERMEDIATE_DIR', |
| 153 '$(InputPath)': '${source}', | |
| 153 '$(InputName)': '${root}', | 154 '$(InputName)': '${root}', |
| 154 '$(ProjectName)': self.spec['target_name'], | 155 '$(ProjectName)': self.spec['target_name'], |
| 156 '$(PlatformName)': 'Win32', # TODO(scottmg): Support for x64 toolchain. | |
|
Nico
2012/04/30 23:33:27
I need to do this for mac too. Maybe we should tal
scottmg
2012/04/30 23:42:27
Sure, I think it's a long way off before Chromium
| |
| 155 } | 157 } |
| 156 # Chromium uses DXSDK_DIR in include/lib paths, but it may or may not be | 158 # Chromium uses DXSDK_DIR in include/lib paths, but it may or may not be |
| 157 # set. This happens when the SDK is sync'd via src-internal, rather than | 159 # set. This happens when the SDK is sync'd via src-internal, rather than |
| 158 # by typical end-user installation of the SDK. If it's not set, we don't | 160 # by typical end-user installation of the SDK. If it's not set, we don't |
| 159 # want to leave the unexpanded variable in the path, so simply strip it. | 161 # want to leave the unexpanded variable in the path, so simply strip it. |
| 160 replacements['$(DXSDK_DIR)'] = self.dxsdk_dir if self.dxsdk_dir else '' | 162 replacements['$(DXSDK_DIR)'] = self.dxsdk_dir if self.dxsdk_dir else '' |
| 161 return replacements | 163 return replacements |
| 162 | 164 |
| 163 def ConvertVSMacros(self, s, base_to_build=None): | 165 def ConvertVSMacros(self, s, base_to_build=None): |
| 164 """Convert from VS macro names to something equivalent.""" | 166 """Convert from VS macro names to something equivalent.""" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 vs.Path(), r'Common7\Tools\vsvars32.bat')) | 470 vs.Path(), r'Common7\Tools\vsvars32.bat')) |
| 469 | 471 |
| 470 def ExpandMacros(string, expansions): | 472 def ExpandMacros(string, expansions): |
| 471 """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv | 473 """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv |
| 472 for the canonical way to retrieve a suitable dict.""" | 474 for the canonical way to retrieve a suitable dict.""" |
| 473 if '$' in string: | 475 if '$' in string: |
| 474 for old, new in expansions.iteritems(): | 476 for old, new in expansions.iteritems(): |
| 475 assert '$(' not in new, new | 477 assert '$(' not in new, new |
| 476 string = string.replace(old, new) | 478 string = string.replace(old, new) |
| 477 return string | 479 return string |
| OLD | NEW |