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

Support custom profiles #2007

Closed
Aatch opened this issue Sep 29, 2015 · 11 comments
Closed

Support custom profiles #2007

Aatch opened this issue Sep 29, 2015 · 11 comments
Labels
A-profiles Area: profiles C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@Aatch
Copy link

Aatch commented Sep 29, 2015

There are 5 profiles used for various purposes, and while each is configurable, you can't make your own profile. This would be useful for defining special profiles for a specific project. I personally would find a profiling profile useful to be able to enable both debugging and optimisations.

I propose supporting custom profiles, selected using --profile. The current profiles would just be predefined ones and I don't see why they couldn't be selected as well. A set of default values for the profile options will also need to be decided upon.

@alexcrichton
Copy link
Member

I do think that this was one of the original intentions of profiles (cc @wycats, @carllerche), but there's also certainly a case to be made that if there are sets of options frequently used that Cargo should bake in those profiles! (and a profiling profile does seem like something that may commonly arise).

@carllerche
Copy link
Member

Yep 👍

@shepmaster
Copy link
Member

I'd definitely love to have a profile profile, and having custom profiles seems like a nice pluggable way to do it.

@whitequark
Copy link
Member

I would really like to have a relwithdebinfo profile, like CMake does:

[profile.relwithdebinfo]
opt-level = 3
debug = true
rpath = false
lto = false
debug-assertions = false
codegen-units = 1

... which is really a superset of profiling, but also useful for shipping -dbg packages, etc.

@luser
Copy link
Contributor

luser commented Aug 1, 2017

We're in a situation with Firefox where we'd like to ship our release binaries with LTO, but we want to disable it by default for local developer builds to save on build time. Unfortunately there's no straightforward way to do that. Being able to define a custom profile would be really useful here.

@carols10cents carols10cents added A-profiles Area: profiles C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` labels Sep 10, 2017
@da-x
Copy link
Member

da-x commented Feb 15, 2018

I have a draft implementation here if anyone is interested.

@Boscop
Copy link

Boscop commented Apr 9, 2018

I'm also interested in this.. I need 2 dev profiles, one with opt-level = 0 and one with opt-level = 1.

@da-x
Copy link
Member

da-x commented Apr 9, 2018

I have updated my implementation and opened a pull request. #5326

@johnthagen
Copy link
Contributor

It would be nice to be able to have a fully optimized "release/publish" profile: rust-lang/rust#47745 (comment)

# The publish profile, used for `cargo build --publish`.
[profile.publish]
# (...) everything else the same as profile.release except:
lto = true        # Enable full link-time optimization.
codegen-units = 1 # Use only 1 codegen-unit to enable full optimizations.

@da-x
Copy link
Member

da-x commented Apr 6, 2019

RFC 2678 for this is opened.

@ehuss
Copy link
Contributor

ehuss commented Nov 15, 2019

This has been implemented, closing in favor of the tracking issue #6988.

@ehuss ehuss closed this as completed Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-profiles Area: profiles 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