How can I set default build target for Cargo?

后端 未结 2 2128
余生分开走
余生分开走 2021-02-18 18:38

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 --relea         


        
相关标签:
2条回答
  • 2021-02-18 19:20

    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"
    
    0 讨论(0)
  • 2021-02-18 19:31

    As listed in the Cargo documentation, you can create a .cargo/config and specify the target:

    [build]
    target = "my-custom-target"
    
    0 讨论(0)
提交回复
热议问题