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 libs = [lib[2:] if lib.startswith('-l') else lib for lib in libraries] | 205 return [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] | |
207 | 206 |
208 def _GetAndMunge(self, field, path, default, prefix, append, map): | 207 def _GetAndMunge(self, field, path, default, prefix, append, map): |
209 """Retrieve a value from |field| at |path| or return |default|. If | 208 """Retrieve a value from |field| at |path| or return |default|. If |
210 |append| is specified, and the item is found, it will be appended to that | 209 |append| is specified, and the item is found, it will be appended to that |
211 object instead of returned. If |map| is specified, results will be | 210 object instead of returned. If |map| is specified, results will be |
212 remapped through |map| before being returned or appended.""" | 211 remapped through |map| before being returned or appended.""" |
213 result = _GenericRetrieve(field, default, path) | 212 result = _GenericRetrieve(field, default, path) |
214 result = _DoRemapping(result, map) | 213 result = _DoRemapping(result, map) |
215 result = _AddPrefix(result, prefix) | 214 result = _AddPrefix(result, prefix) |
216 return _AppendOrReturn(append, result) | 215 return _AppendOrReturn(append, result) |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 so they're not surprised when the VS build fails.""" | 841 so they're not surprised when the VS build fails.""" |
843 if int(generator_flags.get('msvs_error_on_missing_sources', 0)): | 842 if int(generator_flags.get('msvs_error_on_missing_sources', 0)): |
844 no_specials = filter(lambda x: '$' not in x, sources) | 843 no_specials = filter(lambda x: '$' not in x, sources) |
845 relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] | 844 relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] |
846 missing = filter(lambda x: not os.path.exists(x), relative) | 845 missing = filter(lambda x: not os.path.exists(x), relative) |
847 if missing: | 846 if missing: |
848 # They'll look like out\Release\..\..\stuff\things.cc, so normalize the | 847 # They'll look like out\Release\..\..\stuff\things.cc, so normalize the |
849 # path for a slightly less crazy looking output. | 848 # path for a slightly less crazy looking output. |
850 cleaned_up = [os.path.normpath(x) for x in missing] | 849 cleaned_up = [os.path.normpath(x) for x in missing] |
851 raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) | 850 raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) |
OLD | NEW |