mcgoo / vcpkg-rs

Build library for finding native libraries in vcpkg for Rust - Windows (msvc), Linux and macOS
https://docs.rs/vcpkg
Apache License 2.0
108 stars 22 forks source link

Support specifying `VCPKGRS_*` environmental variables from `Config` #19

Closed ryankurte closed 3 years ago

ryankurte commented 4 years ago

Hey there,

Would it be possible to configure the VCPKGRS_* environmental variables from the Config object exposed by the library, with the library setting overridden by the environment?

This would allow us to manage this for different targets in build.rs, aiming to simplify the build process for *-sys crate consumers.

Somewhat related issue: rust-embedded#481

Cheers,

Ryan

mcgoo commented 4 years ago

I'm open to the idea, for sure. I assume you are mainly wanting to select which vcpkg triplet to build with? At the moment I think there is no way to do that but I think it would not be a big deal to support it.

mcgoo commented 3 years ago

This is now supported from builds.rs as you suggested. It's typically better to use the environment variables because it can be a requirement that all external dependencies come from the same vcpkg installation and use the same triplet.

There is also a new tool cargo vcpkg that allows the triplet and required packages to be specified as metadata in Cargo.toml. If required it will create a vcpkg tree from scratch, so cargo vcpkg build && cargo build can be enough to get up and running.

(Please let me know if this doesn't address your need.)

ryankurte commented 3 years ago

awesome, thanks! i'll try it out next i'm playing with CI tooling