Skip to content
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

Multi-target build #8156

Closed
Mygod opened this issue Apr 24, 2020 · 2 comments
Closed

Multi-target build #8156

Mygod opened this issue Apr 24, 2020 · 2 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@Mygod
Copy link

Mygod commented Apr 24, 2020

Describe the problem you are trying to solve

When building rust code for an Android app, it is common to build for multiple targets, e.g. (ARM, x86) ⊗ (32 bits, 64 bits). While cargo build is already parallel in some sense, LTO (or last step compilation in general) is single threaded and can take a long time to run. It makes sense to use up the CPU resources for building other targets.

Describe the solution you'd like

Multi-target build with --target=armv7-linux-androideabi --target=aarch64-linux-android ....

Notes

See also plugin: https://github.com/mozilla/rust-android-gradle

@Mygod Mygod added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Apr 24, 2020
@alexcrichton
Copy link
Member

Thanks for the report! This is actually a refactoring I've wanted to do for some time now, so I've mustered up the motivation and pushed up #8167 to implement this.

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Apr 28, 2020
This commit refactors the internals of Cargo to no longer have a
singular `--target` flag (and singular `requested_target` kind throught)
but to instead have a list. The semantics of multiple `--target` flags
is to build the selected targets for each of the input `--target` flag
inputs.

For now this is gated behind `-Zmultitarget` as an unstable features,
since I'm not entirely sure this is the interface we want. In general
it'd be great if we had a way to simply specify `Unit` structures of
what to build on the CLI, but we're in general very far away from that,
so I figured that this is probably sufficient at least for testing for
now.

cc rust-lang#8156
bors added a commit that referenced this issue Apr 29, 2020
Support multiple `--target` flags on the CLI

This commit refactors the internals of Cargo to no longer have a
singular `--target` flag (and singular `requested_target` kind throught)
but to instead have a list. The semantics of multiple `--target` flags
is to build the selected targets for each of the input `--target` flag
inputs.

For now this is gated behind `-Zmultitarget` as an unstable features,
since I'm not entirely sure this is the interface we want. In general
it'd be great if we had a way to simply specify `Unit` structures of
what to build on the CLI, but we're in general very far away from that,
so I figured that this is probably sufficient at least for testing for
now.

cc #8156
@ehuss
Copy link
Contributor

ehuss commented Apr 29, 2020

Closing in favor of tracking issue #8176.

@ehuss ehuss closed this as completed Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

3 participants