Skip to content

Commit

Permalink
Merge pull request #23 from mcgoo/vcpkg_include_deps
Browse files Browse the repository at this point in the history
use vcpkg with automatic dependency following
  • Loading branch information
weiznich authored Jul 9, 2022
2 parents c82aa22 + 8cc93b3 commit 43efc80
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ name = "pq_sys"
pkg-config = { version = "0.3.0", optional = true }

[target.'cfg(target_env = "msvc")'.build-dependencies]
vcpkg = "0.2"
vcpkg = "0.2.6"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ where `{TARGET}` gets replaced by the Target environment variable set for cross-
* Second, if the environment variable `PQ_LIB_DIR` is set, it will use its value
* If the environment variable isn't set, it tries to use pkg-config to locate it.
All the config options, such as `PKG_CONFIG_ALLOW_CROSS`, `PKG_CONFIG_ALL_STATIC`
etc., of the crate [pkg-config](http://alexcrichton.com/pkg-config-rs/pkg_config/index.html)
etc., of the crate [pkg-config](https://docs.rs/pkg-config/)
apply.
* For MSVC ABI builds the build script will attempt use the library from a
* Then, for MSVC ABI builds the build script will attempt use the library from a
[vcpkg](https://github.com/Microsoft/vcpkg) installation if there is one available.
You may need to set VCPKG_ROOT (or run `vcpkg integrate install`) and run
`vcpkg install libpq:x64-windows`.
You may need to set VCPKG_ROOT (or run `vcpkg integrate install`), set VCPKGRS_DYNAMIC=1, and run
`vcpkg install libpq:x64-windows`. See the documentation for the [vcpkg](https://docs.rs/vcpkg/) crate for more.
* If it still can't locate the library, it will invoke the Postgres command
`pg_config --libdir`

Expand Down
9 changes: 1 addition & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,7 @@ fn configured_by_pkg_config() -> bool {

#[cfg(target_env = "msvc")]
fn configured_by_vcpkg() -> bool {
vcpkg::probe_package("libpq").map(|_| {

// found libpq which depends on openssl
vcpkg::Config::new()
.lib_name("libeay32")
.lib_name("ssleay32")
.probe("openssl").ok();

vcpkg::find_package("libpq").map(|_| {
println!("cargo:rustc-link-lib=crypt32");
println!("cargo:rustc-link-lib=gdi32");
println!("cargo:rustc-link-lib=user32");
Expand Down

0 comments on commit 43efc80

Please sign in to comment.