32 stable releases (6 major)

7.0.3 Sep 22, 2024
7.0.1 Jun 18, 2024
6.2.2 Mar 19, 2024
6.2.0 Oct 31, 2023
1.3.2 Jul 10, 2020

#6 in Build Utils

Download history 144606/week @ 2024-07-27 147366/week @ 2024-08-03 161717/week @ 2024-08-10 143176/week @ 2024-08-17 158618/week @ 2024-08-24 173996/week @ 2024-08-31 156367/week @ 2024-09-07 142232/week @ 2024-09-14 162929/week @ 2024-09-21 166728/week @ 2024-09-28 161558/week @ 2024-10-05 171277/week @ 2024-10-12 164500/week @ 2024-10-19 169555/week @ 2024-10-26 175968/week @ 2024-11-02 135004/week @ 2024-11-09

672,988 downloads per month
Used in 1,556 crates (151 directly)

MIT/Apache

120KB
2.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

~3MB
~61K SLoC