georust / proj

Rust bindings for the latest stable release of PROJ
https://docs.rs/proj
Apache License 2.0
137 stars 43 forks source link

How to build for windows? #158

Closed bbirchnz closed 1 year ago

bbirchnz commented 1 year ago

Hi, could anyone point me to a minimum working guide for building and running this on windows? I'm not familiar with pkg-config but have built Proj using the instructions on https://proj.org/install.html#build-requirements, note that its installed into c:/OSGeo4W, created pc files (with guessed contents), added that path to PKG_CONFIG_PATH. This got georust/proj to build, but I believe its probably just tricked its way through cmake, as when I try and run a test I get hard exits with code 3221225595 (I believe this is something to do with DLL misconfigured).

I don't know if there is anywhere I can drop the proj.dll into the cargo build directories?

lnicola commented 1 year ago

Does enabling the bundled_proj feature help? It will give you another libproj (built from source), which may or may not be fine for your use case.

Otherwise I can't really help, but looking at https://github.com/georust/proj/blob/main/proj-sys/build.rs, there doesn't seem to be much in the way of manually specifying library paths.

urschrei commented 1 year ago

This may also help: https://github.com/georust/proj/pull/79#issuecomment-1308751602

bbirchnz commented 1 year ago

Thanks! #79 got a good easy build, and I redirected PKG_CONFIG_PATH. doing pkg-config --list-all now lists all the libs as you'd expect (proj, libtiff, curl etc).

Unfortunately, trying to run rust tests fails with missing DLLs - (exit code: 0xc0000135, STATUS_DLL_NOT_FOUND).

This is building proj with or without "pkg_config". Building with bundled_proj fails, still says it can't find sqlite3 or libtiff. Is cmake looking elsewhere?

Edit: grabbing all the DLL out of vcpkg/bin and dumping them alongside the compiled rust exe worked. Thanks for your help