Skip to content

Commit

Permalink
Add bundling support on windows
Browse files Browse the repository at this point in the history
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
  • Loading branch information
weiznich committed Jan 30, 2024
1 parent ae91aba commit 52e4a37
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions proj-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
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
Expand Down

0 comments on commit 52e4a37

Please sign in to comment.