Bazel源源不断的构建

发布于 2025-01-31 09:02:43 字数 291 浏览 1 评论 0 原文

最近,我在学习GTEST时被介绍给“ Bazel”构建系统。显然我是一个 这件事的初学者。到目前为止,一切进展顺利,我非常感谢巴泽尔的简单性。我的问题是:

如何在源目录之外构建Bazel项目? (我的工作空间文件所在的位置)。

在“构建过程”中,巴泽尔在“ bazel-bin”和其他目录中生成了“ bazel-*”形式的目录。我希望这些目录位于特定的文件夹中,而不仅仅是在主要的根源目录中杂乱无章,我的工作区文件还位于主源目录中。我希望所有这些文件都位于“构建”之类的目录中,该目录本身位于根源目录中。

I was recently introduced to 'Bazel' build system while learning gtest. Apparently I am a
beginner in this thing. So far it is going well, I really appreciate bazel's simplicity. My question is:

How to build a bazel project outside the source directory? (Where my WORKSPACE file resides).

In the build process bazel generates directories like "bazel-bin" and other directories in "bazel-*" form. I want these directories to be in a specific folder and not just cluttered around in the main root source directory, My WORKSPACE file resided in the main source directory. I would like all these files to be in a directory like "build" which itself resides in the root source directory.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故乡的云 2025-02-07 09:02:43

创建一个带有以下内容的 .bazelrc 文件:

build --symlink_prefix=/ # Out of source build

这避免了Bazel特定的符号链接是在我们的源代码中创建的。如果您已经这样的Symlink Dirs Do Bazel Clean 删除它们,然后创建 .bazelrc 文件。

还考虑 - Symlink-Prefix 标志。

Create a .bazelrc file with the following content:

build --symlink_prefix=/ # Out of source build

This avoids that Bazel specific symlinks are created in our source dir. If you have already such symlink dirs do a bazel clean to get rid of them and then create the .bazelrc file.

Consider also the Bazel Documentation about the --symlink-prefix flag.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文