欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

Chromium实战(一)-

时间:2023-07-20
一、准备环境

windows 10 

二、 构建chromium 1、下载 VS2019

Visual 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 --includeRecommended

3. 添加 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 Studio2019Communityset http_proxy=http://localhost:7890set https_proxy=http://localhost:7890

该三条指令都为临时变量,关掉命令行后都会失效。 

这里需要使用代理否则无法进行后面的下载安装,代理的端口由自身使用的端口确定。

6. 安装 depot tools

在命令行中输入:

gclient

等待下载完毕,并安装

7、配置 git

git config --global user.name "用户名"git config --global user.email "邮箱"git config --global core.autocrlf falsegit config --global core.filemode falsegit config --global branch.autosetuprebase always

这里必须需要一个 git 账号,输入用户名和邮箱

8、下载 chromium

在命令行中输入:

mkdir chromium && cd chromiumfetch --no-history chromium

9、构建 chromium

命令行中输入:

cd srcgn gen --ide=vs outDefaultgn args out/Default

出现一个文本文件,在里面添加以下参数

is_component_build = trueenable_nacl = falsetarget_cpu = "x86"blink_symbol_level = 0v8_symbol_level = 0symbol_level = 0

 最后在命令行中输入:

set NINJA_SUMMARIZE_BUILD=1autoninja -C outDefault chrome

输入以上参数和命令可以加快构建速度,否则会构建很久。

10、打开 outDefault 中的 all.sln 项目解决方案

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。