如何使用 Google Chromium GN 构建目标?

leg*_*gel 8 chromium selenium-chromedriver gn

我正在尝试使用GN从源代码构建ChromeDriver的可执行目标,我使用Depot Tools 将其安装在我的 PATH 目录中,但是当我运行时出现此错误:gn BUILD.gn

gn.py: Could not find checkout in any parent of the current path.
This must be run inside a checkout.
Run Code Online (Sandbox Code Playgroud)

如果我没有正确设置,我不确定是否需要检查整个 Chromium 目录?

更新

我已经在gn_tool的帮助下下载了 gn 的工作二进制文件。

我仍然不确定我应该为“构建 chromedriver 目标”运行什么命令,因为现在我尝试的每个命令似乎都给我这个错误:

ERROR Can't find source root. I could not find a ".gn" file in the current directory or any parent,and the --root command-line argument was not specified.
Run Code Online (Sandbox Code Playgroud)

...即使在我运行 gn 的目录中有一个 BUILD.gn 文件...

Ase*_*esh 8

看起来缺少一些依赖项。您可以通过运行来提取依赖项

gclient sync
Run Code Online (Sandbox Code Playgroud)

它应该下载 Chrome 驱动程序编译所需的依赖项。然后运行以下命令开始编译Chrome驱动程序:

gn gen out/YourBuildFolder
ninja -C out/YourBuildFolder chromedriver
Run Code Online (Sandbox Code Playgroud)

上面的gn gen...命令基本上将通过复制依赖项并准备必要的文件来为 ninja 构建系统准备构建文件夹以进行编译。命令ninja -C...将实际开始编译文件

希望有效。谢谢