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

build system-deps

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

19 stable releases (5 major)

6.0.2 Feb 15, 2022
6.0.0 Nov 17, 2021
5.0.0 Sep 21, 2021
4.0.0 Aug 31, 2021
1.3.2 Jul 10, 2020

#4 in Build Utils

Download history 26993/week @ 2022-01-28 28912/week @ 2022-02-04 30925/week @ 2022-02-11 32542/week @ 2022-02-18 28931/week @ 2022-02-25 29188/week @ 2022-03-04 28048/week @ 2022-03-11 30049/week @ 2022-03-18 30994/week @ 2022-03-25 33167/week @ 2022-04-01 31952/week @ 2022-04-08 27969/week @ 2022-04-15 33384/week @ 2022-04-22 34238/week @ 2022-04-29 39366/week @ 2022-05-06 34586/week @ 2022-05-13

146,800 downloads per month
Used in 508 crates (91 directly)

MIT/Apache

94KB
2K 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

~1MB
~18K SLoC