#build-dependencies #windows #macos #linux

app cargo-vcpkg

A cargo subcommand to build a vcpkg tree from metadata entries in Cargo.toml for a top level crate and the crates that it depends on

7 releases

0.1.6 Jun 16, 2021
0.1.5 Jun 11, 2020
0.1.0 May 31, 2020

#39 in Cargo plugins

Download history 38/week @ 2021-04-06 197/week @ 2021-04-13 234/week @ 2021-04-20 72/week @ 2021-04-27 25/week @ 2021-05-04 49/week @ 2021-05-11 39/week @ 2021-05-18 19/week @ 2021-05-25 89/week @ 2021-06-01 56/week @ 2021-06-08 94/week @ 2021-06-15 97/week @ 2021-06-22 58/week @ 2021-06-29 25/week @ 2021-07-06 44/week @ 2021-07-13 48/week @ 2021-07-20

424 downloads per month

MIT/Apache

39KB
853 lines

cargo-vcpkg Windows macOS Linux

This is the version that cargo-vcpkg has been released from since 0.1.6. Previous versions were homed at mcgoo/vcpkg-rs. crates.io/vcpkg needs older Rust for compatibility with older projects, while cargo-vcpkg would like to track new versions for the latest features in Cargo.toml, hense the split of repos between components.

Changelog

This command cargo vcpkg will create a vcpkg tree and install the packages specified in Cargo.toml files in the crate being built and crates it depends on. Crates that use the vcpkg crate will be able to find libraries automatically.

Example

[package.metadata.vcpkg]
git = "https://github.com/microsoft/vcpkg"
rev = "4c1db68"
dependencies = ["pkg1", "pkg2"]
$ cargo install cargo-vcpkg
$ cargo vcpkg build
    Fetching vcpkg
    Checkout rev/tag/branch 4c1db68
   Compiling pkg1, pkg2
    Finished in 1.93s
$ cargo build
[...]

Per target configuration

It is also possible to install different sets of packages per target, and override the vcpkg triplet to install.

[package.metadata.vcpkg]
git = "https://github.com/microsoft/vcpkg"
rev = "4c1db68"
dependencies = ["sdl2"]

[package.metadata.vcpkg.target]
x86_64-apple-darwin = { dependencies = ["sdl2", "sdl2-gfx" ] }
x86_64-unknown-linux-gnu = { dependencies = ["sdl2", "opencv"] }
x86_64-pc-windows-msvc = { triplet = "x64-windows-static", dependencies = ["sdl2", "zeromq"] }

Development dependencies

Setting the dev-dependencies key allows building libraries that are required by binaries in this crate. Only the packages in the dependencies key will be installed if cargo vcpkg is run on a crate that depends on this crate.

[package.metadata.vcpkg]
git = "https://github.com/microsoft/vcpkg"
rev = "4c1db68"
dependencies = ["sdl2"]
dev-dependencies = ["sdl2-image"]

[package.metadata.vcpkg.target]
x86_64-apple-darwin = { dev-dependencies = ["sdl2-gfx" ] }

Installation

Install by running

cargo install cargo-vcpkg

License

See LICENSE-APACHE, and LICENSE-MIT for details.

Dependencies

~4.5MB
~87K SLoC