如何为 Cargo 设置默认构建目标? [英] How can I set default build target for Cargo?
本文介绍了如何为 Cargo 设置默认构建目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用 this 在 Rust 中制作Hello World"教程,但构建命令有点冗长:
I tried to make 'Hello World' in Rust using this tutorial, but the build command is a bit verbose:
cargo +nightly build --target wasm32-unknown-unknown --release
是否可以为cargo build
设置默认目标?
Is it possible to set the default target for cargo build
?
推荐答案
你可以使用 货物配置文件 为你的项目指定一个默认的目标三元组.在您的项目根目录中,创建一个 .cargo
目录和一个 config
文件,其中包含以下内容:
You could use a Cargo configuration file to specify a default target-triple for your project. In your project's root, create a .cargo
directory and a config
file in it with the following contents:
[build]
target = "wasm32-unknown-unknown"
这篇关于如何为 Cargo 设置默认构建目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文