什么是构建依赖性?

发布于 2025-02-12 20:52:28 字数 364 浏览 0 评论 0原文

cargo noreferrer“ >::

您可以依靠其他基于货物的板条箱用于构建脚本。依赖项是通过构建依赖性

的部分声明的

我很难理解这到底意味着什么,以及正常依赖项build依赖性之间的区别

"Build dependencies" explained in the cargo book:

You can depend on other Cargo-based crates for use in your build scripts. Dependencies are declared through the build-dependencies section of the manifest

I have difficulty in understanding what exactly this means and what's the difference between the normal dependencies and build-dependencies.

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

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

发布评论

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

评论(1

暮凉 2025-02-19 20:52:28

它们有点不同:

  • 依赖项:您可以在通常的src目录下使用它们,该目录通常是您为主程序编写源代码
  • build依赖性:您可以在build.rs中使用它们 ,该用于准备一些外部(即系统范围的共享库)或调用外部命令(即在构建程序之前,C或C ++编译器)。 build.rs称为“ nofollow noreferrer”>“构建脚本。”

They're a bit different:

  • dependencies: You can use them under the usual src directory which is normally you write your source code for the main program
  • build-dependencies: You can use them only in build.rs on project root, which is used to prepare some external (i.e. system-wide shared library) dependencies or invoke external command (i.e. the C or C++ compiler) before the program being built. The build.rs is called "build script."
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文