-
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
Allow specifying rustflags per profile #7878
Comments
Hello everyone. I would like to work on this issue because I need this functionality in Cargo for my research. The thing is, I don't have much experience in contributing to open source. Is any kind of mentoring available? |
Any update on this issue? I found this very useful since for |
My new big reason for wanting this feature is the above linked issue bevyengine/bevy#791 Turning big frameworks like Bevy and Tokio into dylibs for development builds is a big compile time win. |
Lol. Any workaround available currently? Or do we have to wait for |
Well, not really, unless you consider manually setting For the dylib use case, bevy is providing another workaround: a dummy OFC, this is just for that use case. There are many other valuable use cases for setting rustflags per-profile (as described in the OP), and cargo should definitely support it. |
The moment you add |
I'm interested in this feature. I compile debug builds with |
A logical extension of this would be to allow per-package overrides of rustflags, and that would be immensely useful for Firefox. |
+1, also interested in this |
+1 for this. It makes total sense to have this feature and I'm currently missing it -- want development builds to compile as fast as possible, but release builds to be as optimized as possible |
+1 this would be really useful |
+1 this would be a really helpful feature |
This would also be nice for ruffle-rs/ruffle#5834, so |
Now that mold is 1.0, I would like to link with mold in debug builds and use the standard linker in releases. This feature would help with this |
@msdrigg you can always run |
feat: support rustflags per profile Fix for issue #7878
How should |
Instead of place |
It's better to add profile based For example, when
as for now, this flag was ignored. |
Is this feature any closer to stabilization? |
For the progress of it, please see the tracking issue #10271 and other issue of
Z-profile-rustflags
|
Related to #5777 but a separate issue:
Please allow specifying
rustflags
per profile.It would be very useful for setting certain flags only in debug or release (or even custom profiles).
E.g. I have a workspace with multiple crates, plus one backend bin crate and one frontend wasm crate, and I want to set
rustflags = ["-Ctarget-feature=+crt-static", "-Ctarget-cpu=haswell"]
only for the backend and only for release builds!Btw, when I just set
rustflags = ["-Ctarget-feature=+crt-static", "-Ctarget-cpu=haswell"]
in.cargo/config
now, (even though rustc ignores these flags when building my wasm frontend), cargo always recompiles all deps when switching between building the backend and frontend sub-crates. Even though for the frontend, everything is compiled for the wasm target anyway, so the compiled deps are never shared between frontend and backend crates! (Probably avoidable / another issue.)If it was possible to set rustflags per profile, together with profile-overrides it would be possible to avoid the unnecessary recompilation because I could set rustflags only for the backend and only for release builds, and in addition I could set other flags only for the frontend crate.
Also this would allow things like using the standard linker for release and lld for debug builds (to shorten linking time).
The text was updated successfully, but these errors were encountered: