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

build system-deps

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

7 stable releases

2.0.1 Nov 6, 2020
2.0.0 Oct 30, 2020
1.3.2 Jul 10, 2020
1.3.1 Jun 22, 2020

#8 in Build Utils

Download history 1845/week @ 2020-08-01 2057/week @ 2020-08-08 2481/week @ 2020-08-15 3027/week @ 2020-08-22 2990/week @ 2020-08-29 4183/week @ 2020-09-05 4149/week @ 2020-09-12 3246/week @ 2020-09-19 5085/week @ 2020-09-26 5541/week @ 2020-10-03 6988/week @ 2020-10-10 7690/week @ 2020-10-17 5353/week @ 2020-10-24 6575/week @ 2020-10-31 6762/week @ 2020-11-07 6190/week @ 2020-11-14

19,307 downloads per month
Used in 173 crates (39 directly)

MIT/Apache

62KB
1.5K SLoC

system-deps

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 = "1.3"

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.4–2MB
~39K SLoC