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

Optional dependencies #427

Closed
mahkoh opened this issue Aug 23, 2014 · 5 comments
Closed

Optional dependencies #427

mahkoh opened this issue Aug 23, 2014 · 5 comments

Comments

@mahkoh
Copy link

mahkoh commented Aug 23, 2014

Consider the case of a music player that supports multiple codecs. To compile such a program, the build system has to find out which libraries are currently available on the system and has to compile only those parts that use the available libraries. For rust this includes passing --cfg arguments to the compiler.

This is true not only for binaries but also for libraries that might use bindgen to create bindings from the header files.

Since checking for dependencies might take some time, this step should not be executed with cargo build every time.

@alexcrichton
Copy link
Member

This is certainly planned! We're going to support this through the planned feature of profiles and features.

@huonw
Copy link
Member

huonw commented Aug 25, 2014

cc #385

@alexcrichton
Copy link
Member

I believe that this will be entirely covered by the features mentioned in #385, so I'm going to close this in favor of that issue for now. Once #385 is implemented, if it doesn't solve this, then we can definitely reopen!

@mahkoh
Copy link
Author

mahkoh commented Aug 31, 2014

Not sure how this addresses the problem at all.

To compile such a program, the build system has to find out which libraries are currently available on the system

What I read in #385 sounds like I'll have to write a classical configure file that creates a make file that calls cargo with the correct flags.

@alexcrichton
Copy link
Member

Due to cargo's nature of encouraging repeatable builds, this will likely manifest itself with features in that you explicitly opt in to building a feature and then the build will go awry if a system dependency was not discovered. Otherwise I suspect that syntax extensions will serve the purpose of determining whether a dependency is available locally or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants