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

build system-deps

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

20 stable releases (5 major)

6.0.3 Oct 19, 2022
6.0.2 Feb 15, 2022
6.0.1 Jan 31, 2022
6.0.0 Nov 17, 2021
1.3.2 Jul 10, 2020

#8 in Build Utils

Download history 40621/week @ 2022-10-14 41607/week @ 2022-10-21 39899/week @ 2022-10-28 47909/week @ 2022-11-04 46057/week @ 2022-11-11 38560/week @ 2022-11-18 41554/week @ 2022-11-25 44406/week @ 2022-12-02 50322/week @ 2022-12-09 42927/week @ 2022-12-16 34410/week @ 2022-12-23 37033/week @ 2022-12-30 48565/week @ 2023-01-06 44913/week @ 2023-01-13 46091/week @ 2023-01-20 43104/week @ 2023-01-27

189,307 downloads per month
Used in 714 crates (115 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

~725KB
~16K SLoC