我正在创建一个应用程序,它允许插件添加/修改功能。目前这是一个CLI应用程序,具有多个数据后端的插件。每个插件都被实现为cargo工作区中的不同项目。我应该如何配置cargo或软件包清单,将库项目构建到子目录中,其中包含构建的输出目录?
我正在创建一个应用程序,它允许插件添加/修改功能。目前这是一个CLI应用程序,具有多个数据后端的插件。每个插件都被实现为cargo工作区中的不同项目。我应该如何配置cargo或软件包清单,将库项目构建到子目录中,其中包含构建的输出目录?
对 @Fabian 的答案进行小修正,我们需要将以下配置添加到你的 .cargo/config.toml
文件夹中,该文件夹位于你的 Rust 项目所在的文件夹内或你的主文件夹内。
[build]
target-dir = "/some/directory/rust-builds"
您还可以添加其他配置,这些配置在此处提到 - https://doc.rust-lang.org/cargo/reference/config.html
Cargo.toml
文件中:[build]
target-dir = "/desired/path" # path of where to place all generated artifacts
来源: https://doc.rust-lang.org/cargo/reference/config.html
同时阅读:https://doc.rust-lang.org/cargo/commands/cargo-build.html#output-options