Skip to content

Support custom profiles #2007

Closed
Closed

Description

@Aatch

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.

Activity

  1. alexcrichton commented on Sep 29, 2015

    @alexcrichton
    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).

  2. carllerche commented on Sep 29, 2015

    @carllerche
    Contributor

    Yep 👍

  3. shepmaster commented on Oct 2, 2015

    @shepmaster
    Member

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

  4. whitequark commented on Jan 27, 2016

    @whitequark
    Contributor

    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.

  5. luser commented on Aug 1, 2017

    @luser
    Contributor

    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.

  6. added
    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
    on Sep 10, 2017
  7. da-x commented on Feb 15, 2018

    @da-x
    Member

    I have a draft implementation here if anyone is interested.

  8. Boscop commented on Apr 9, 2018

    @Boscop

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

  9. da-x commented on Apr 9, 2018

    @da-x
    Member

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

  10. johnthagen commented on Jan 31, 2019

    @johnthagen
    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.
  11. da-x commented on Apr 6, 2019

    @da-x
    Member

    RFC 2678 for this is opened.

  12. ehuss commented on Nov 15, 2019

    @ehuss
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-profilesArea: profilesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions