proj icon indicating copy to clipboard operation
proj copied to clipboard

add support of vcpkg with msvc toolchain

Open lapoigne opened this issue 3 years ago • 16 comments

I added the support of vcpkg libraries in proj-sys. This allow to build proj-sys on windows with msvc without pkg-config.

To use vcpkg libraries on your rust program, you need:

  • in .cargo/config file
[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
rustflags = ["-Ctarget-feature=+crt-static"]
  • in Cargo.toml file
[package.metadata.vcpkg]
git = "https://github.com/microsoft/vcpkg"
rev = "96a1f9c" # PROJ version 7.2.1 - https://github.com/microsoft/vcpkg/search?q=proj4&type=commits
install = ["proj:x64-windows-static"]

To build, run

cargo install cargo-vcpkg
cargo vcpkg build
cargo build

I'm new to rust, I hope this isn't to ugly in my implementation.

lapoigne avatar Mar 03 '21 08:03 lapoigne

AFAIK none of the main contributors are using windows, so it'd be good to test this setup in CI.

Do you have any experience with using windows containers in GH actions? Would you be willing to add a job to https://github.com/georust/proj/blob/master/.github/workflows/test.yml?

michaelkirk avatar Mar 09 '21 00:03 michaelkirk

Hi @lapoigne, apologies for the delay. As @michaelkirk says, we don't have anyone available to locally test this, but we're certainly interested in anything that improves the Windows experience for these crates.

urschrei avatar Mar 09 '21 01:03 urschrei

I will look closer to add CI for windows platform.

lapoigne avatar Mar 09 '21 07:03 lapoigne

I added windows in CI file. The 32bit platform is commented because we loose precision in floating number and the test fail. Maybe you just want remove this architecture. I edited some test because I get some insignificant change in some value like 1450880.2910605008 for 1450880.2910605003

lapoigne avatar Mar 12 '21 14:03 lapoigne

bors try

Sorry to let this sit for so long. Thanks for adding the ci integration, let's try it out.

michaelkirk avatar Apr 16 '21 21:04 michaelkirk

bors try

michaelkirk avatar Apr 19 '21 16:04 michaelkirk

try

Already running a review

bors[bot] avatar Apr 19 '21 16:04 bors[bot]

bors r-

michaelkirk avatar Apr 19 '21 16:04 michaelkirk

bors retry

michaelkirk avatar Apr 19 '21 17:04 michaelkirk

bors r+

one last try bors.

michaelkirk avatar Apr 19 '21 17:04 michaelkirk

Bors is crashing, I'm going to follow up with some bors peeps.

update: done here https://forum.bors.tech/t/bors-crashing-resource-not-accessible-by-integration/571/3

update 2: looking into similarly errors reported, it seems like "editing the workflow file" is a common source of crashes between bors and gh

michaelkirk avatar Apr 19 '21 17:04 michaelkirk

try

Build succeeded:

bors[bot] avatar Apr 19 '21 18:04 bors[bot]