From 0430cd69ee47ecd1b9ab87e74602b8ab19fd9de8 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Mon, 29 Jan 2024 08:45:39 +0100 Subject: [PATCH] Add bundling support on windows We need to always build release builds there (to prevent linker errors due to mixing up debug and release runtimes) and we need an additional flag to prevent the static library to expect some proj.dll file to exist --- proj-sys/build.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/proj-sys/build.rs b/proj-sys/build.rs index 96c44945..76d61d24 100644 --- a/proj-sys/build.rs +++ b/proj-sys/build.rs @@ -121,6 +121,15 @@ fn build_from_source() -> Result> config.define("ENABLE_TIFF", "OFF"); } + if cfg!(target_env = "msvc") { + // rust links the release MVSC runtime + // also for debug builds. If we let + // cmake choose debug/release builds + // based on the underlying cargo build + // version that results in linker errors + config.profile("Release"); + } + let proj = config.build(); // Tell cargo to tell rustc to link libproj, and where to find it // libproj will be built in $OUT_DIR/lib