Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for static pkg-config Windows build #492

Merged
merged 3 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

- Defers the gdal_i.lib missing message until after the pkg-config check and outputs pkg-config metadata in case of a static build.

- <https://github.com/georust/gdal/pull/492>

- Added `RasterBand::write_block`.

- <https://github.com/georust/gdal/pull/490>
Expand Down
12 changes: 7 additions & 5 deletions gdal-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ fn main() {
}
}
if !found {
if cfg!(target_env = "msvc") {
panic!("windows-msvc requires gdal_i.lib to be present in either $GDAL_LIB_DIR or $GDAL_HOME\\lib.");
}

// otherwise, look for a gdalxxx.dll in $GDAL_HOME/bin
// works in windows-gnu
if let Some(ref home_dir) = home_dir {
Expand Down Expand Up @@ -189,7 +185,9 @@ fn main() {
println!("cargo:rustc-link-lib={link_type}={lib_name}");
println!("cargo:rustc-link-search={}", lib_dir.to_str().unwrap());

need_metadata = false;
if !prefer_static {
need_metadata = false;
}
}

let mut include_paths = Vec::new();
Expand All @@ -202,6 +200,10 @@ fn main() {
.cargo_metadata(need_metadata)
.probe("gdal");

if !found && cfg!(target_env = "msvc") && gdal_pkg_config.is_err() {
panic!("windows-msvc requires gdal_i.lib to be present in either $GDAL_LIB_DIR or $GDAL_HOME\\lib.");
}

if let Ok(gdal) = &gdal_pkg_config {
for dir in &gdal.include_paths {
include_paths.push(dir.to_str().unwrap().to_string());
Expand Down