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

Side by Side Diff: build/vs_toolchain.py

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « build/toolchain/win/BUILD.gn ('k') | build/whitespace_file.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import json 5 import json
6 import os 6 import os
7 import pipes 7 import pipes
8 import shutil 8 import shutil
9 import subprocess 9 import subprocess
10 import sys 10 import sys
11 11
12 12
13 script_dir = os.path.dirname(os.path.realpath(__file__)) 13 script_dir = os.path.dirname(os.path.realpath(__file__))
14 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) 14 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
15 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 15 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
16 sys.path.insert(1, os.path.join(chrome_src, 'tools')) 16 sys.path.insert(1, os.path.join(chrome_src, 'tools'))
17 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) 17 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
18 json_data_file = os.path.join(script_dir, 'win_toolchain.json') 18 json_data_file = os.path.join(script_dir, 'win_toolchain.json')
19 19
20 20
21 import gyp
22
23
21 def SetEnvironmentAndGetRuntimeDllDirs(): 24 def SetEnvironmentAndGetRuntimeDllDirs():
22 """Sets up os.environ to use the depot_tools VS toolchain with gyp, and 25 """Sets up os.environ to use the depot_tools VS toolchain with gyp, and
23 returns the location of the VS runtime DLLs so they can be copied into 26 returns the location of the VS runtime DLLs so they can be copied into
24 the output directory after gyp generation. 27 the output directory after gyp generation.
25 """ 28 """
26 vs2013_runtime_dll_dirs = None 29 vs2013_runtime_dll_dirs = None
27 depot_tools_win_toolchain = \ 30 depot_tools_win_toolchain = \
28 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) 31 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
29 if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain: 32 if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain:
30 if not os.path.exists(json_data_file): 33 if not os.path.exists(json_data_file):
31 Update() 34 Update()
32 with open(json_data_file, 'r') as tempf: 35 with open(json_data_file, 'r') as tempf:
33 toolchain_data = json.load(tempf) 36 toolchain_data = json.load(tempf)
34 37
35 toolchain = toolchain_data['path'] 38 toolchain = toolchain_data['path']
36 version = toolchain_data['version'] 39 version = toolchain_data['version']
37 version_is_pro = version[-1] != 'e' 40 version_is_pro = version[-1] != 'e'
38 win8sdk = toolchain_data['win8sdk'] 41 win8sdk = toolchain_data['win8sdk']
39 wdk = toolchain_data['wdk'] 42 wdk = toolchain_data['wdk']
40 # TODO(scottmg): The order unfortunately matters in these. They should be 43 # TODO(scottmg): The order unfortunately matters in these. They should be
41 # split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call 44 # split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call
42 # below). http://crbug.com/345992 45 # below). http://crbug.com/345992
43 vs2013_runtime_dll_dirs = toolchain_data['runtime_dirs'] 46 vs2013_runtime_dll_dirs = toolchain_data['runtime_dirs']
44 47
45 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain 48 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain
46 os.environ['GYP_MSVS_VERSION'] = version 49 os.environ['GYP_MSVS_VERSION'] = version
50 # We need to make sure windows_sdk_path is set to the automated
51 # toolchain values in GYP_DEFINES, but don't want to override any
52 # otheroptions.express
53 # values there.
54 gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES'))
55 gyp_defines_dict['windows_sdk_path'] = win8sdk
56 os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v)))
57 for k, v in gyp_defines_dict.iteritems())
47 os.environ['WINDOWSSDKDIR'] = win8sdk 58 os.environ['WINDOWSSDKDIR'] = win8sdk
48 os.environ['WDK_DIR'] = wdk 59 os.environ['WDK_DIR'] = wdk
49 # Include the VS runtime in the PATH in case it's not machine-installed. 60 # Include the VS runtime in the PATH in case it's not machine-installed.
50 runtime_path = ';'.join(vs2013_runtime_dll_dirs) 61 runtime_path = ';'.join(vs2013_runtime_dll_dirs)
51 os.environ['PATH'] = runtime_path + ';' + os.environ['PATH'] 62 os.environ['PATH'] = runtime_path + ';' + os.environ['PATH']
52 return vs2013_runtime_dll_dirs 63 return vs2013_runtime_dll_dirs
53 64
54 65
55 def CopyVsRuntimeDlls(output_dir, runtime_dirs): 66 def CopyVsRuntimeDlls(output_dir, runtime_dirs):
56 """Copies the VS runtime DLLs from the given |runtime_dirs| to the output 67 """Copies the VS runtime DLLs from the given |runtime_dirs| to the output
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 # CopyVsRuntimeDlls via import, currently). 192 # CopyVsRuntimeDlls via import, currently).
182 } 193 }
183 if len(sys.argv) < 2 or sys.argv[1] not in commands: 194 if len(sys.argv) < 2 or sys.argv[1] not in commands:
184 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) 195 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands)
185 return 1 196 return 1
186 return commands[sys.argv[1]]() 197 return commands[sys.argv[1]]()
187 198
188 199
189 if __name__ == '__main__': 200 if __name__ == '__main__':
190 sys.exit(main()) 201 sys.exit(main())
OLDNEW
« no previous file with comments | « build/toolchain/win/BUILD.gn ('k') | build/whitespace_file.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698