windows 10
二、 构建chromium 1. 下载 VS2019Visual Studio 2019 version 16.11 Release Notes | Microsoft Docs
这里选择的 Community 社区版本,全部都是默认安装位置
2. VS安装完毕后,打开命令行安装需要的插件在命令行中输入:
"C:Program Files (x86)Microsoft Visual StudioInstallervs_installer.exe" modify --installpath "C:Program Files (x86)Microsoft Visual Studio2019Community" --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended3. 添加 Debugging Tools For Windows
打开控制面板 → 程序 → 程序和功能 → 选择“Windows Software Development Kit” → 更改 → change → 勾选上“Debugging Tools For Windows” → change
等待下载安装完毕
4. 下载 depot tools,并设置环境变量https://storage.googleapis.com/chrome-infra/depot_tools.zip 下载并解压(我这里放在了 C:src 中)
添加环境变量:
在系统变量中的 path 添加 C:srcdepot_tools
在系统变量中添加 DEPOT_TOOLS_WIN_TOOLCHAIN 变量值设置为0
5. 设置VS临时环境变量,并设置代理在命令行中输入:
set vs2019_install=C:Program Files (x86)Microsoft Visual Studio2019Community set http_proxy=http://localhost:7890 set https_proxy=http://localhost:7890
该三条指令都为临时变量,关掉命令行后都会失效。
这里需要使用代理否则无法进行后面的下载安装,代理的端口由自身使用的端口确定。
6. 安装 depot tools在命令行中输入:
gclient
等待下载完毕,并安装
7. 配置 gitgit config --global user.name "用户名" git config --global user.email "邮箱" git config --global core.autocrlf false git config --global core.filemode false git config --global branch.autosetuprebase always
这里必须需要一个 git 账号,输入用户名和邮箱
8. 下载 chromium在命令行中输入:
mkdir chromium && cd chromium fetch --no-history chromium9. 构建 chromium
命令行中输入:
cd src gn gen --ide=vs outDefault gn args out/Default
出现一个文本文件,在里面添加以下参数
is_component_build = true enable_nacl = false target_cpu = "x86" blink_symbol_level = 0 v8_symbol_level = 0 symbol_level = 0
最后在命令行中输入:
set NINJA_SUMMARIZE_BUILD=1 autoninja -C outDefault chrome
输入以上参数和命令可以加快构建速度,否则会构建很久。
10. 打开 outDefault 中的 all.sln 项目解决方案


