学习开源项目chromium之在windows下下载chromium代码并生成vs项目的sln文件

首先,参考官方的下载说明链接

#1 VS的要求:”Visual Studio Community Edition should work if its license is appropriate for you. You must install the “Desktop development with C++” component and the “MFC/ATL support” sub-components. “
因此,VS2019的社区版即可满足要求,不需要专业版及其以上的版本即可编译。仅需要在使用vs installer安装的时候勾选上使用C++进行桌面开发及其MFC的支持的子选项即可。

#2 Install depot_tools,即下载depot_tools,下载链接
“Add depot_tools to the start of your PATH (must be ahead of any installs of Python). Assuming you unzipped the bundle to C:\src\depot_tools, open:
Control Panel → System and Security → System → Advanced system settings”
添加depot_tools的解压路径至环境变量,例如解压的路径为C:\src\depot_tools,那么就在path里面添加即可。然后添加系统变量,其名为DEPOT_TOOLS_WIN_TOOLCHAIN并将值设定为0。
#3 打开CMD.exe,执行命令gclient
我的话,是在解压depot_tools的文件夹内,直接按住shift再按住右键,开启power shell窗口,执行gclient的命令,无任何参数。执行命令后的界面
#4 修改GIT的设置文件,在你文件的解压目录下有个git文件夹,里面有个config文件,用记事本打开,更改设置如下设置

[user]
	name = "Jay Kwok"
	email = "jay-kwok@chromium.org"
[core]
	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	autocrlf = false
	symlinks = false
[remote "origin"]
	url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
	fetch = +refs/heads/master:refs/remotes/origin/master
[branch "master"]
	remote = origin
	merge = refs/heads/master
	autosetuprebase = always

之后保存即可(name和email改成自己的)。
#5 打开cmd,cd到你的depot_tools的安装目录,输入mkdir chromium && cd chromium创建文件夹并cd。
然后fetch chromium,静静等待即可。在这里插入图片描述
(有条件的话建议挂梯子,因为源代码实在很大,有差不多21GB的内容。)
#6 “When fetch completes, it will have created a hidden .gclient file and a directory called src in the working directory. The remaining instructions assume you have switched to the src directory”
当下载完成后,会创建一个隐藏的.gclient的文件和一个src文件夹。
#在做这些工作之前,记得把你的VS的路径和WINDOWS 10 SDK的路径添加到你的系统变量里面,且WIN10 SDK记得装DEBUGGING TOOLS。
于是继续在当前cmd窗口输入cd src,然后用gn gen out/Default创立构建目录,对于每个新的构建目录,该命令仅需要运行一次。
然后gn gen --ide=vs out\Default

devenv out\Default\all.sln
即可输出VS项目文件。
VS文件位于构建目录下,即你的depot_tools文件目录的/chromium/src/build文件夹里面。

#7 参考链接:
Chromium官方指导链接

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值