最近,我在学习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.
发布评论
评论(1)
创建一个带有以下内容的
.bazelrc
文件:这避免了Bazel特定的符号链接是在我们的源代码中创建的。如果您已经这样的Symlink Dirs Do
Bazel Clean
删除它们,然后创建.bazelrc
文件。还考虑 - Symlink-Prefix 标志。
Create a
.bazelrc
file with the following content: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.