忙乎了一个多星期,终于搞定了,把整个过程写下来,方便以后遇到问题解决
一、环境
(1)64位操作系统,Win 7+;(2)vs2013 update4;
(3)Windows 8.1 SDK (若没有在 tools目录下sdksetup.exe);
二、准备工作
(1)设置系统区域为英语(美国)。(控制面板-区域-管理-更改系统区域设置-英语(美国),电脑重启后生效
(2)创建工作目录,路径不能包含空格及特殊字符。例如e:\cef
(3)编译工作包(tools/depot_tools.zip),解压至工作目录(e:\cef)。
(4)编译脚本(tools/automate-git.py)放在工作目录(e:\cef)下。
(5)在工作目录下创建源码目录。例如e:\cef\source
(6)depot_tools的目录添加到环境变量path中,最好放在前面点,可能和已经安装好的python git svn冲突
完整目录结构:
e:/
cef/
automate-git.py
depot_tools/
source/
三、下载和编译
在下载编译前需要设置代理,不然无法下载,可能遇到错误
设置代理:
例如:
set http_proxy=http://127.0.0.1:1080
set https_proxy=https://127.0.0.1:1080
git config --global http.proxy 127.0.0.1:1080
git config --global https.proxy 127.0.0.1:1080
如果代理是有账号和密码的请在网上搜索如何设置
设置代理后,需要修改depot_tools\bootstrap\win\get_file.js
出现下载超时错误如下
installing python 2.7.6...
Fetching from https://src.chromium.org/svn/trunk/tools/third_party/python276_bin
.zip
[-] XMLHTTP 80072ee2: Cannot make HTTP request (操作超时
... Failed to checkout python automatically.
You should get the "prebaked" version at https://src.chromium.org/svn/trunk/tool
s/third_party/
需要修改depot_tools\bootstrap\win\get_file.js如下:
function Download(url, path, verbose) {
if (verbose) {
WScript.StdOut.Write(" * GET " + url + "...");
}
try {
xml_http = new ActiveXObject("MSXML2.ServerXMLHTTP");
} catch (e) {
WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +
": Cannot create Active-X object (" + e.description) + ").";
WScript.Quit(1);
}
try {
xml_http.open("GET", url, false);
} catch (e) {
WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +
": invalid URL.");
WScript.Quit(1);
}