-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set target using config file #2335
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks for the PR! This implementation all looks good to me, I'm just not sure if we want to implement it just yet. I'll bring this up with the @rust-lang/tools team to see if others have opinions as well. While that happens, can you be sure to update the documentation as well to reflect that this option exists? |
Makes sense to me. |
Would you mind pointing me at the documentation that needs to be updated? This pull request already updates |
Oh oops sorry I overlooked that by accident, |
Thanks again @fpgaminer! |
Fixed #2332. This PR adds `build.target` to the Cargo config file, which behaves in the same way as passing `--target` to Cargo. Example `.cargo/config`: ``` [build] target = "thumbv6m-none-eabi" ``` Similar to how `--jobs` overrides `build.jobs`, `--target` will override `build.target`. I added documentation to `config.md`, and a test to `test_cargo_cross_compile.rs`. I couldn't get cross compile working on my machine for `cargo test`. Hopefully travis passes it. This is my first PR against Cargo; sorry if I missed any procedures.
☀️ Test successful - cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
Can we set this as a crate specific parameter? |
Looks like this is not going in? Any alternative (similar) option progressing or already added? |
@andrewdavidmackenzie I'm not sure what you mean. This was added a few years ago. Are you having some kind of issue? If so, it would be probably be best to open a new issue. |
Well, Alex commented: I didn't see any merge for it and when I tried it I got an "unused key" warning from cargo. I'm on mobile now, but will check again later. |
Is this intended only for binary builds in Cargo? I can't find any mention of it in the Cargo manifest book: When I try what's described in this issue: Here is my Cargo.toml of a library with functions I want compiled to wasm:
When I build it cargo tells me:
|
The value goes into the config file |
OK, I understand now. I guess it makes more sense there than in the manifest? |
Fixed #2332.
This PR adds
build.target
to the Cargo config file, which behaves in the same way as passing--target
to Cargo. Example.cargo/config
:Similar to how
--jobs
overridesbuild.jobs
,--target
will overridebuild.target
.I added documentation to
config.md
, and a test totest_cargo_cross_compile.rs
. I couldn't get cross compile working on my machine forcargo test
. Hopefully travis passes it.This is my first PR against Cargo; sorry if I missed any procedures.