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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 so they're not surprised when the VS build fails.""" | 841 so they're not surprised when the VS build fails.""" |
842 if int(generator_flags.get('msvs_error_on_missing_sources', 0)): | 842 if int(generator_flags.get('msvs_error_on_missing_sources', 0)): |
843 no_specials = filter(lambda x: '$' not in x, sources) | 843 no_specials = filter(lambda x: '$' not in x, sources) |
844 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] |
845 missing = filter(lambda x: not os.path.exists(x), relative) | 845 missing = filter(lambda x: not os.path.exists(x), relative) |
846 if missing: | 846 if missing: |
847 # 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 |
848 # path for a slightly less crazy looking output. | 848 # path for a slightly less crazy looking output. |
849 cleaned_up = [os.path.normpath(x) for x in missing] | 849 cleaned_up = [os.path.normpath(x) for x in missing] |
850 raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) | 850 raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) |
| 851 |
| 852 # Sets some values in default_variables, which are required for many |
| 853 # generators, run on Windows. |
| 854 def CalculateCommonVariables(default_variables, params): |
| 855 generator_flags = params.get('generator_flags', {}) |
| 856 |
| 857 # Set a variable so conditions can be based on msvs_version. |
| 858 msvs_version = gyp.msvs_emulation.GetVSVersion(generator_flags) |
| 859 default_variables['MSVS_VERSION'] = msvs_version.ShortName() |
| 860 |
| 861 # To determine processor word size on Windows, in addition to checking |
| 862 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current |
| 863 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which |
| 864 # contains the actual word size of the system when running thru WOW64). |
| 865 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or |
| 866 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): |
| 867 default_variables['MSVS_OS_BITS'] = 64 |
| 868 else: |
| 869 default_variables['MSVS_OS_BITS'] = 32 |
OLD | NEW |