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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 replacements['$(WDK_DIR)'] = self.wdk_dir if self.wdk_dir else '' | 195 replacements['$(WDK_DIR)'] = self.wdk_dir if self.wdk_dir else '' |
196 return replacements | 196 return replacements |
197 | 197 |
198 def ConvertVSMacros(self, s, base_to_build=None, config=None): | 198 def ConvertVSMacros(self, s, base_to_build=None, config=None): |
199 """Convert from VS macro names to something equivalent.""" | 199 """Convert from VS macro names to something equivalent.""" |
200 env = self.GetVSMacroEnv(base_to_build, config=config) | 200 env = self.GetVSMacroEnv(base_to_build, config=config) |
201 return ExpandMacros(s, env) | 201 return ExpandMacros(s, env) |
202 | 202 |
203 def AdjustLibraries(self, libraries): | 203 def AdjustLibraries(self, libraries): |
204 """Strip -l from library if it's specified with that.""" | 204 """Strip -l from library if it's specified with that.""" |
205 return [lib[2:] if lib.startswith('-l') else lib for lib in libraries] | 205 libs = [lib[2:] if lib.startswith('-l') else lib for lib in libraries] |
| 206 return [lib + '.lib' if not lib.endswith('.lib') else lib for lib in libs] |
206 | 207 |
207 def _GetAndMunge(self, field, path, default, prefix, append, map): | 208 def _GetAndMunge(self, field, path, default, prefix, append, map): |
208 """Retrieve a value from |field| at |path| or return |default|. If | 209 """Retrieve a value from |field| at |path| or return |default|. If |
209 |append| is specified, and the item is found, it will be appended to that | 210 |append| is specified, and the item is found, it will be appended to that |
210 object instead of returned. If |map| is specified, results will be | 211 object instead of returned. If |map| is specified, results will be |
211 remapped through |map| before being returned or appended.""" | 212 remapped through |map| before being returned or appended.""" |
212 result = _GenericRetrieve(field, default, path) | 213 result = _GenericRetrieve(field, default, path) |
213 result = _DoRemapping(result, map) | 214 result = _DoRemapping(result, map) |
214 result = _AddPrefix(result, prefix) | 215 result = _AddPrefix(result, prefix) |
215 return _AppendOrReturn(append, result) | 216 return _AppendOrReturn(append, result) |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 | 861 |
861 # To determine processor word size on Windows, in addition to checking | 862 # To determine processor word size on Windows, in addition to checking |
862 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current | 863 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current |
863 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which | 864 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which |
864 # contains the actual word size of the system when running thru WOW64). | 865 # contains the actual word size of the system when running thru WOW64). |
865 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or | 866 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or |
866 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): | 867 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): |
867 default_variables['MSVS_OS_BITS'] = 64 | 868 default_variables['MSVS_OS_BITS'] = 64 |
868 else: | 869 else: |
869 default_variables['MSVS_OS_BITS'] = 32 | 870 default_variables['MSVS_OS_BITS'] = 32 |
OLD | NEW |