-
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
Per platform config for workspace #5220
Comments
Currently yeah this is a bit of a pain to do, you'll have to place the |
hi! I am also interested in this feature, what is the status here? |
Also interested |
👍 I also need this feature, but happy to contribute. @alexcrichton could you give me some directions how to implement this? |
Sorry it's been years since I last thought about this, if you're interested in taking a crack at this I think you'll need to start the design yourself from scratch. |
Just chiming in to say that this has proven to be quite frustrating for two classes of applications I've been working on:
For both of these scenarios, I'd like As a more concrete example, I have a workspace consisting of two members, I can work around this by annotating all of the code and dependencies in Kernel development is, admittedly, quite rare, but this has been significantly more annoying with WebAssembly, where you might have a wasm client and a host server (for a conventional web application), or more unorthodox configurations, such as what the Lunatic runtime enables. per-package-target helps with this, but it's not a complete solution, and it causes cargo to die on Windows (which I admit I should report elsewhere). Sorry if this sounds a little frustrated, but it's cropped up in multiple projects, and I suspect heterogeneous builds in the same workspace will only get more numerous with further wasm integration. My understanding is that this is also a bit of a sticking point for Embark: EmbarkStudios/rust-ecosystem#41 Any thoughts / pointers / suggestions on how to a) handle this today, in a reasonably sensible way and b) ways to handle this in the future would be much appreciated! |
I've been looking at this and I think I see a path forward. There are two different problems discussed so far in this issue.
Edit: extra noise removed where I missed the existing per-package-target work2. A workspace may contain crates which always need to target a particular architecture, even if this is a cross-compilation. We would like it if this could be specified so a plain `cargo build` will handle multiple output targets simultaneously across the various members.I'm going to suggest that (2) is quite hard - what would be the logical behaviour if you specified So what would (1) look like? I expect very similar to how it works in a [workspace]
members = ["foo", "bar"]
[target.'cfg(unix)']
members = ["baz"] Default members would be handled equally within both In code terms:
I'd be prepared to try coding something like this but I haven't worked on cargo before so any advance feedback would be helpful. 😀 |
Since, we don't need to build the server-aws-lambda crate on Mac/Windows platforms, to save build times (for Mac platforms) and to avoid build/test issues (for Windows platforms), we build the server-aws-lambda crate only on Linux platforms. Ideally, we could have included the server-aws-lambda crate in the workspace only on Linux platforms, but until rust-lang/cargo#5220 is fixed, we can't do that.
Since, we don't need to build the server-aws-lambda crate on Mac/Windows platforms, to save build times (for Mac platforms) and to avoid build/test issues (for Windows platforms), we build the server-aws-lambda crate only on Linux platforms. Ideally, we could have included the server-aws-lambda crate in the workspace only on Linux platforms, but until rust-lang/cargo#5220 is fixed, we can't do that.
Some Rust tools get hung up if the entire workspace cannot be compiled. refs rust-lang/cargo#5220
Some Rust tools get hung up if the entire workspace cannot be compiled. refs rust-lang/cargo#5220
Some Rust tools get hung up if the entire workspace cannot be compiled. refs rust-lang/cargo#5220
imo rather than conditionalizing workspace membership, we should have a package specify what targets it supports (#6179). |
Hi,
Is it possible to extend the workspace with more crates on per platform basis?
I've tried to add all of my stuff into workspace and then simply add
#![cfg(target_os = "windows")]
tomain.rs
of crates that are not meant to be built on certain platforms but that emits errors saying there is nomain
in the crate.The text was updated successfully, but these errors were encountered: