Open mcandre opened 1 year ago
I suspect you mean cross build
here?
Instead,
cargo build
defaults to the host as a target.Ideally,
cargo build
would automatically iterate over all configured targets.
I wouldn't myself want this to be done automatically, but we could make cross-util
do this. I can also see a value in having cross-util
have a way to output json over all configured targets.
However, there is an issue. What should we do in this case?
# Cross.toml
[build]
env.passthrough = ["MY_VAR"]
[target.x86_64-unknown-linux-musl]
env.passthrough = ["MY_VAR=musl"]
Should your suggested functionality build for --target x86_64-unknown-linux-musl
only or all targets available (since build
sets variables for all targets)
I guess my question is, what is a configured target?
this is related to https://github.com/cross-rs/cross/issues/1062
Update: Wote a proof of concept script in Rust to go ahead and loop through most rustup targets and trigger individual cross target build commands.
https://github.com/mcandre/crit
The targets don't even have to be explicitly configured for the most part; they just need to exist in rustup.
A few rustup targets are deliberately skipped by crit by default, due to lack of std implementation, or lack of working, published community cross images.
This would also be possible in principle with a hairy shell script. But a Rust implementation is more portable and reliable.
Checklist
Describe your request
When I configure multiple targets, such as with Cargo.toml, then I expect a convenient way to loop over them automatically in succession.
Instead,
cargo build
defaults to the host as a target.Ideally,
cargo build
would automatically iterate over all configured targets.If for some reason this is not to be done automatically, then I would love to see a CLI flag to have
cross
loop over the targets.Describe why this would be a good inclusion for
cross
Some users are reporting shell based looping. This has several problems:
For these reasons, and general UX, I would love for cross itself to implement target iteration.
Doesn't have to be parallel building, either. Could be a simple Rust for loop.