#pkg-config #build-dependencies #manifest #metadata #build-depends

build system-deps

Discover and configure system dependencies from declarative dependencies in Cargo.toml

10 stable releases

3.0.0 Feb 10, 2021
2.0.3 Jan 14, 2021
2.0.2 Dec 8, 2020
2.0.1 Nov 6, 2020
1.3.1 Jun 22, 2020

#4 in Build Utils

Download history 6416/week @ 2020-11-13 6657/week @ 2020-11-20 7096/week @ 2020-11-27 8058/week @ 2020-12-04 7270/week @ 2020-12-11 6367/week @ 2020-12-18 5031/week @ 2020-12-25 7468/week @ 2021-01-01 10381/week @ 2021-01-08 8831/week @ 2021-01-15 9296/week @ 2021-01-22 12077/week @ 2021-01-29 13151/week @ 2021-02-05 14684/week @ 2021-02-12 14571/week @ 2021-02-19 11080/week @ 2021-02-26

34,699 downloads per month
Used in 224 crates (46 directly)

MIT/Apache

74KB
1.5K SLoC

system-deps codecov CI

system-deps lets you write system dependencies in Cargo.toml metadata, rather than programmatically in build.rs. This makes those dependencies declarative, so other tools can read them as well.

For now only pkg-config dependencies are supported but we are planning to expand it at some point.

Users can override dependency flags using environment variables if needed. system-deps also allows -sys crates to optionally internally build and static link the required system library.

system-deps has been started as a fork of the metadeps project.

Documentation

See the crate documentation.

Usage

In your Cargo.toml:

[build-dependencies]
system-deps = "2.0"

Then, to declare a dependency on testlib >= 1.2 add the following section:

[package.metadata.system-deps]
testlib = "1.2"

Finally, in your build.rs, add:

fn main() {
    system_deps::Config::new().probe().unwrap();
}

See the crate documentation for more advanced features.

Dependencies

~1.7–2.4MB
~47K SLoC