I want to complie rust code with language option:
#[cfg(lang = "en")]
use xxx;
#[cfg(lang = "fr")]
use yyy;
and how to run cargo and passing argument ?
cargo release --feature "lang=en" // error!
You can use #[cfg(en)] and pass --cfg en to rustc.
But, if you use cargo, then you can append to your .cargo/cargo.toml (must create this file if you don't have) this:
[build]
rustflags = ["--cfg", "en"]
You can also make script to build and run a project that generates this file and invokes cargo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With