Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: build/toolchain/win/setup_toolchain.py

Issue 2738993003: Allow building with VS 2017 when VS 2013/2015 are in path (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 # vcvarsall.bat for VS 2017 fails if run after running vcvarsall.bat from
131 # VS 2013 or VS 2015. Fix this by clearing the vsinstalldir environment
132 # variable.
133 if 'VSINSTALLDIR' in os.environ:
134 del os.environ['VSINSTALLDIR']
130 other_path = os.path.normpath(os.path.join( 135 other_path = os.path.normpath(os.path.join(
131 os.environ['GYP_MSVS_OVERRIDE_PATH'], 136 os.environ['GYP_MSVS_OVERRIDE_PATH'],
132 'VC/Auxiliary/Build/vcvarsall.bat')) 137 'VC/Auxiliary/Build/vcvarsall.bat'))
133 if not os.path.exists(other_path): 138 if not os.path.exists(other_path):
134 raise Exception('%s is missing - make sure VC++ tools are installed.' % 139 raise Exception('%s is missing - make sure VC++ tools are installed.' %
135 script_path) 140 script_path)
136 script_path = other_path 141 script_path = other_path
137 args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64'] 142 args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64']
138 variables = _LoadEnvFromBat(args) 143 variables = _LoadEnvFromBat(args)
139 return _ExtractImportantEnvironment(variables) 144 return _ExtractImportantEnvironment(variables)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 205
201 assert vc_bin_dir 206 assert vc_bin_dir
202 print 'vc_bin_dir = ' + gn_helpers.ToGNString(vc_bin_dir) 207 print 'vc_bin_dir = ' + gn_helpers.ToGNString(vc_bin_dir)
203 assert include_I 208 assert include_I
204 print 'include_flags_I = ' + gn_helpers.ToGNString(include_I) 209 print 'include_flags_I = ' + gn_helpers.ToGNString(include_I)
205 assert include_imsvc 210 assert include_imsvc
206 print 'include_flags_imsvc = ' + gn_helpers.ToGNString(include_imsvc) 211 print 'include_flags_imsvc = ' + gn_helpers.ToGNString(include_imsvc)
207 212
208 if __name__ == '__main__': 213 if __name__ == '__main__':
209 main() 214 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698