OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 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 # Extracts a Windows VS2013 toolchain from various downloadable pieces. | 5 # Extracts a Windows VS2013 toolchain from various downloadable pieces. |
6 | 6 |
7 | 7 |
8 from toolchain import * | 8 from toolchain import * |
9 | 9 |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 ('Windows_SDK\\' | 68 ('Windows_SDK\\' |
69 r'Windows Software Development Kit for Metro style Apps-x86_en-us.msi', | 69 r'Windows Software Development Kit for Metro style Apps-x86_en-us.msi', |
70 False), | 70 False), |
71 ]) | 71 ]) |
72 return results | 72 return results |
73 | 73 |
74 | 74 |
75 def CopyToFinalLocation(extracted_dirs, target_dir): | 75 def CopyToFinalLocation(extracted_dirs, target_dir): |
76 sys.stdout.write('Copying to final location...\n') | 76 sys.stdout.write('Copying to final location...\n') |
77 mappings = { | 77 mappings = { |
78 'Program Files\\Microsoft Visual Studio 12.0\\': 'vs\\', | 78 'Program Files\\Microsoft Visual Studio 12.0\\': '.\\', |
79 'Windows Kits\\8.0\\': 'win8sdk\\', | 79 'Windows Kits\\8.0\\': 'win8sdk\\', |
80 'System64\\': 'sys64\\', | 80 'System64\\': 'sys64\\', |
81 'System\\': 'sys32\\', | 81 'System\\': 'sys32\\', |
82 } | 82 } |
83 matches = [] | 83 matches = [] |
84 for extracted_dir in extracted_dirs: | 84 for extracted_dir in extracted_dirs: |
85 for root, dirnames, filenames in os.walk(extracted_dir): | 85 for root, dirnames, filenames in os.walk(extracted_dir): |
86 for filename in filenames: | 86 for filename in filenames: |
87 matches.append((extracted_dir, os.path.join(root, filename))) | 87 matches.append((extracted_dir, os.path.join(root, filename))) |
88 | 88 |
(...skipping 16 matching lines...) Expand all Loading... |
105 | 105 |
106 def GenerateSetEnvCmd(target_dir, pro): | 106 def GenerateSetEnvCmd(target_dir, pro): |
107 """Generate a batch file that gyp expects to exist to set up the compiler | 107 """Generate a batch file that gyp expects to exist to set up the compiler |
108 environment. This is normally generated by a full install of the SDK, but we | 108 environment. This is normally generated by a full install of the SDK, but we |
109 do it here manually since we do not do a full install.""" | 109 do it here manually since we do not do a full install.""" |
110 with open(os.path.join( | 110 with open(os.path.join( |
111 target_dir, r'win8sdk\bin\SetEnv.cmd'), 'w') as file: | 111 target_dir, r'win8sdk\bin\SetEnv.cmd'), 'w') as file: |
112 file.write('@echo off\n') | 112 file.write('@echo off\n') |
113 file.write(':: Generated by tools\\win\\toolchain\\toolchain2013.py.\n') | 113 file.write(':: Generated by tools\\win\\toolchain\\toolchain2013.py.\n') |
114 # Common to x86 and x64 | 114 # Common to x86 and x64 |
115 file.write('set PATH=%~dp0..\\..\\vs\\Common7\\IDE;%PATH%\n') | 115 file.write('set PATH=%~dp0..\\..\\Common7\\IDE;%PATH%\n') |
116 file.write('set INCLUDE=%~dp0..\\..\\win8sdk\\Include\\um;' | 116 file.write('set INCLUDE=%~dp0..\\..\\win8sdk\\Include\\um;' |
117 '%~dp0..\\..\\win8sdk\\Include\\shared;' | 117 '%~dp0..\\..\\win8sdk\\Include\\shared;' |
118 '%~dp0..\\..\\vs\\VC\\include;' | 118 '%~dp0..\\..\\VC\\include;' |
119 '%~dp0..\\..\\vs\\VC\\atlmfc\\include\n') | 119 '%~dp0..\\..\\VC\\atlmfc\\include\n') |
120 file.write('if "%1"=="/x64" goto x64\n') | 120 file.write('if "%1"=="/x64" goto x64\n') |
121 | 121 |
122 # x86. If we're Pro, then use the amd64_x86 cross (we don't support x86 | 122 # x86. If we're Pro, then use the amd64_x86 cross (we don't support x86 |
123 # host at all). | 123 # host at all). |
124 if pro: | 124 if pro: |
125 file.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x86;' | 125 file.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x86;' |
126 '%~dp0..\\..\\vs\\VC\\bin\\amd64_x86;' | 126 '%~dp0..\\..\\VC\\bin\\amd64_x86;' |
127 '%~dp0..\\..\\vs\\VC\\bin\\amd64;' # Needed for mspdb120.dll. | 127 '%~dp0..\\..\\VC\\bin\\amd64;' # Needed for mspdb120.dll. |
128 '%PATH%\n') | 128 '%PATH%\n') |
129 else: | 129 else: |
130 file.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x86;' | 130 file.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x86;' |
131 '%~dp0..\\..\\vs\\VC\\bin;%PATH%\n') | 131 '%~dp0..\\..\\VC\\bin;%PATH%\n') |
132 file.write('set LIB=%~dp0..\\..\\vs\\VC\\lib;' | 132 file.write('set LIB=%~dp0..\\..\\VC\\lib;' |
133 '%~dp0..\\..\\win8sdk\\Lib\\win8\\um\\x86;' | 133 '%~dp0..\\..\\win8sdk\\Lib\\win8\\um\\x86;' |
134 '%~dp0..\\..\\vs\\VC\\atlmfc\\lib\n') | 134 '%~dp0..\\..\\VC\\atlmfc\\lib\n') |
135 file.write('goto done\n') | 135 file.write('goto done\n') |
136 | 136 |
137 # Express does not include a native 64 bit compiler, so we have to use | 137 # Express does not include a native 64 bit compiler, so we have to use |
138 # the x86->x64 cross. | 138 # the x86->x64 cross. |
139 if not pro: | 139 if not pro: |
140 # x86->x64 cross. | 140 # x86->x64 cross. |
141 file.write(':x64\n') | 141 file.write(':x64\n') |
142 file.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x64;' | 142 file.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x64;' |
143 '%~dp0..\\..\\vs\\VC\\bin\\x86_amd64;' | 143 '%~dp0..\\..\\VC\\bin\\x86_amd64;' |
144 '%PATH%\n') | 144 '%PATH%\n') |
145 else: | 145 else: |
146 # x64 native. | 146 # x64 native. |
147 file.write(':x64\n') | 147 file.write(':x64\n') |
148 file.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x64;' | 148 file.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x64;' |
149 '%~dp0..\\..\\vs\\VC\\bin\\amd64;' | 149 '%~dp0..\\..\\VC\\bin\\amd64;' |
150 '%PATH%\n') | 150 '%PATH%\n') |
151 file.write('set LIB=%~dp0..\\..\\vs\\VC\\lib\\amd64;' | 151 file.write('set LIB=%~dp0..\\..\\VC\\lib\\amd64;' |
152 '%~dp0..\\..\\win8sdk\\Lib\\win8\\um\\x64;' | 152 '%~dp0..\\..\\win8sdk\\Lib\\win8\\um\\x64;' |
153 '%~dp0..\\..\\vs\\VC\\atlmfc\\lib\\amd64\n') | 153 '%~dp0..\\..\\VC\\atlmfc\\lib\\amd64\n') |
154 file.write(':done\n') | 154 file.write(':done\n') |
155 | 155 |
156 | 156 |
157 def GenerateTopLevelEnv(target_dir, pro): | 157 def GenerateTopLevelEnv(target_dir, pro): |
158 """Generate a batch file that sets up various environment variables that let | 158 """Generate a batch file that sets up various environment variables that let |
159 the Chromium build files and gyp find SDKs and tools.""" | 159 the Chromium build files and gyp find SDKs and tools.""" |
160 with open(os.path.join(target_dir, r'env.bat'), 'w') as file: | 160 with open(os.path.join(target_dir, r'env.bat'), 'w') as file: |
161 file.write('@echo off\n') | 161 file.write('@echo off\n') |
162 file.write(':: Generated by tools\\win\\toolchain\\toolchain2013.py.\n') | 162 file.write(':: Generated by tools\\win\\toolchain\\toolchain2013.py.\n') |
163 file.write('set GYP_DEFINES=windows_sdk_path="%~dp0win8sdk" ' | 163 file.write('set GYP_DEFINES=windows_sdk_path="%~dp0win8sdk" ' |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 " gclient runhooks (or gclient sync if you haven't pulled deps yet)\n" | 220 " gclient runhooks (or gclient sync if you haven't pulled deps yet)\n" |
221 ' ninja -C out\Debug chrome\n\n' | 221 ' ninja -C out\Debug chrome\n\n' |
222 'Note that this script intentionally does not modify any global\n' | 222 'Note that this script intentionally does not modify any global\n' |
223 'settings like the registry, or system environment variables, so you\n' | 223 'settings like the registry, or system environment variables, so you\n' |
224 'will need to run the above env.bat whenever you start a new\n' | 224 'will need to run the above env.bat whenever you start a new\n' |
225 'shell.\n\n' % target_dir) | 225 'shell.\n\n' % target_dir) |
226 | 226 |
227 | 227 |
228 if __name__ == '__main__': | 228 if __name__ == '__main__': |
229 main() | 229 main() |
OLD | NEW |