Closed U007D closed 1 year ago
If you are on nightly, you can use
https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#per-package-target
to move target
from config.toml
to cargo.toml
.
Would
[alias]
xtask = "run --package xtask --target your-host-target --"
work?
Thanks, @matklad. I looked into this feature earlier this week (I'd tried it but found it did not appear to be working for me). I will need to specify cross-compilation targets with as anxtask build
command parameter, so neither the .cargo/config.toml
nor the per-package-target
features will work for me. I'll pass the target information on the command line with my xtask build
implementation.
Great project! This is something I was after years ago but this is much better thought out than what I had in mind. Thanks again!
I am building a (cross-compiled) RISC-V
no_std
project usingcargo build
on x86_64. It uses a.cargo/Config.toml
in the crate root to specify a linker script (memory.lds
) and to set the compilation target:When I add
xtask
to this project (converting the project to a workspace),cargo
attempts to buildxtask
as a RISC-V target. When I move the above.cargo/Config.toml
out of the workspace root to the application root,cargo
"forgets" (appears to ignore.cargo/Config.toml
not in workspace root) to build my app as a RISC-V application, instead simply building it as a native application for my host CPU.Is
xtask
compatible withno_std
/foreign target projects?