OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. 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 # Copies the given "win tool" (which the toolchain uses to wrap compiler | 5 # Copies the given "win tool" (which the toolchain uses to wrap compiler |
6 # invocations) and the environment blocks for the 32-bit and 64-bit builds on | 6 # invocations) and the environment blocks for the 32-bit and 64-bit builds on |
7 # Windows to the build directory. | 7 # Windows to the build directory. |
8 # | 8 # |
9 # The arguments are the visual studio install location and the location of the | 9 # The arguments are the visual studio install location and the location of the |
10 # win tool. The script assumes that the root build directory is the current dir | 10 # win tool. The script assumes that the root build directory is the current dir |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 assert _ExtractImportantEnvironment(variables) == \ | 120 assert _ExtractImportantEnvironment(variables) == \ |
121 _ExtractImportantEnvironment(_LoadEnvFromBat([script, '/' + cpu])) | 121 _ExtractImportantEnvironment(_LoadEnvFromBat([script, '/' + cpu])) |
122 else: | 122 else: |
123 if 'GYP_MSVS_OVERRIDE_PATH' not in os.environ: | 123 if 'GYP_MSVS_OVERRIDE_PATH' not in os.environ: |
124 os.environ['GYP_MSVS_OVERRIDE_PATH'] = _DetectVisualStudioPath() | 124 os.environ['GYP_MSVS_OVERRIDE_PATH'] = _DetectVisualStudioPath() |
125 # We only support x64-hosted tools. | 125 # We only support x64-hosted tools. |
126 script_path = os.path.normpath(os.path.join( | 126 script_path = os.path.normpath(os.path.join( |
127 os.environ['GYP_MSVS_OVERRIDE_PATH'], | 127 os.environ['GYP_MSVS_OVERRIDE_PATH'], |
128 'VC/vcvarsall.bat')) | 128 'VC/vcvarsall.bat')) |
129 if not os.path.exists(script_path): | 129 if not os.path.exists(script_path): |
130 raise Exception('%s is missing - make sure VC++ tools are installed.' % | 130 other_path = os.path.normpath(os.path.join( |
131 script_path) | 131 os.environ['GYP_MSVS_OVERRIDE_PATH'], |
| 132 'VC/Auxiliary/Build/vcvarsall.bat')) |
| 133 if not os.path.exists(other_path): |
| 134 raise Exception('%s is missing - make sure VC++ tools are installed.' % |
| 135 script_path) |
| 136 script_path = other_path |
132 args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64'] | 137 args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64'] |
133 variables = _LoadEnvFromBat(args) | 138 variables = _LoadEnvFromBat(args) |
134 return _ExtractImportantEnvironment(variables) | 139 return _ExtractImportantEnvironment(variables) |
135 | 140 |
136 | 141 |
137 def _FormatAsEnvironmentBlock(envvar_dict): | 142 def _FormatAsEnvironmentBlock(envvar_dict): |
138 """Format as an 'environment block' directly suitable for CreateProcess. | 143 """Format as an 'environment block' directly suitable for CreateProcess. |
139 Briefly this is a list of key=value\0, terminated by an additional \0. See | 144 Briefly this is a list of key=value\0, terminated by an additional \0. See |
140 CreateProcess documentation for more details.""" | 145 CreateProcess documentation for more details.""" |
141 block = '' | 146 block = '' |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 with open('environment.winrt_' + cpu, 'wb') as f: | 198 with open('environment.winrt_' + cpu, 'wb') as f: |
194 f.write(env_block) | 199 f.write(env_block) |
195 | 200 |
196 assert vc_bin_dir | 201 assert vc_bin_dir |
197 print 'vc_bin_dir = ' + gn_helpers.ToGNString(vc_bin_dir) | 202 print 'vc_bin_dir = ' + gn_helpers.ToGNString(vc_bin_dir) |
198 assert include | 203 assert include |
199 print 'include_flags = ' + gn_helpers.ToGNString(include) | 204 print 'include_flags = ' + gn_helpers.ToGNString(include) |
200 | 205 |
201 if __name__ == '__main__': | 206 if __name__ == '__main__': |
202 main() | 207 main() |
OLD | NEW |