Skip to content

Using the same dependency twice but with different features. #674

Closed

Description

It would be useful to be able to depend on the same package twice, but using different features, that is, being able to write something like:

[dependencies.some_library]
git = "fixme"
features = [ "feature1" ]

[dependencies.some_library]
git = "fixme"
features = [ "feature2" ]

However, this will cause some naming problems as the two libraries will have the same name. To prevent this, we could add a name entry to the depencency to rename it:

[dependencies.some_library]
git = "fixme"
name = "some_library_1"
features = [ "feature1" ]

[dependencies.some_library]
git = "fixme"
name = "some_library_2"
features = [ "feature2" ]

Or perhaps we could let the user specify the features when he does an extern crate:

extern crate "some_library" with feature1 as some_library_1
extern crate "some_library" with feature2 as some_library_2

and the dependency on cargo would not specify any feature as they will be inferred by the extern crate:

[dependencies.some_library]
git = "fixme"

My use-case for this is to allow the user to use the 3df32 feature of ncollide (for 3d collision detection) together with the 2df32 feature (for 2d collision detection) in the same application.

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

Metadata

Assignees

No one assigned

    Labels

    A-featuresArea: features — conditional compilation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions