diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 957174a6..70c01b93 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,6 @@ jobs: - "--features \"network bundled_proj\"" - "--features \"network geo-types\"" - "--features \"bundled_proj geo-types\"" - - "--features \"bundled_proj bundled_proj_tiff \"" - "--features \"network bundled_proj geo-types\"" container: image: ${{ matrix.container_image }} diff --git a/Cargo.toml b/Cargo.toml index 842eafde..da5ec463 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,9 +26,8 @@ members = ["proj-sys"] [features] default = ["geo-types"] bundled_proj = [ "proj-sys/bundled_proj" ] -bundled_proj_tiff = [ "proj-sys/bundled_proj_tiff" ] pkg_config = [ "proj-sys/pkg_config" ] -network = ["bundled_proj_tiff", "reqwest"] +network = ["reqwest"] [dev-dependencies] approx = "0.3" diff --git a/proj-sys/CHANGES.md b/proj-sys/CHANGES.md index a58068a8..ad095a8b 100644 --- a/proj-sys/CHANGES.md +++ b/proj-sys/CHANGES.md @@ -1,3 +1,11 @@ +# UNRELEASED + +- BREAKING: Remove `bundled_proj_tiff` feature and assume system libproj has + the default enabled tiff support. Otherwise, the current setup would + unnecessarily build libproj from source in some cases, e.g. the geo crate's + proj network integration would compile libproj from source. + - + # 0.20.1 - Fix docs to refer to correct libproj version diff --git a/proj-sys/Cargo.toml b/proj-sys/Cargo.toml index fcfdb1e6..aace89d8 100644 --- a/proj-sys/Cargo.toml +++ b/proj-sys/Cargo.toml @@ -24,7 +24,6 @@ nobuild = [] bundled_proj = [] # `pkg_config` feature is deprecated and does nothing pkg_config = [] -bundled_proj_tiff = ["bundled_proj"] [package.metadata.docs.rs] features = [ "nobuild" ] # This feature will be enabled during the docs.rs build diff --git a/proj-sys/build.rs b/proj-sys/build.rs index 4a081e24..05af87ce 100644 --- a/proj-sys/build.rs +++ b/proj-sys/build.rs @@ -1,9 +1,5 @@ -use bindgen; -use cmake; use flate2::read::GzDecoder; use std::fs::File; - -use pkg_config; use std::env; use std::path::PathBuf; use tar::Archive; @@ -22,7 +18,7 @@ fn main() -> Result<(), Box> { pkg_config::Config::new() .atleast_version(MINIMUM_PROJ_VERSION) .probe("proj") - .and_then(|pk| { + .map(|pk| { eprintln!("found acceptable libproj already installed at: {:?}", pk.link_paths[0]); if let Ok(val) = &env::var("_PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC") { if val != "0" { @@ -35,7 +31,7 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-search=native={:?}", pk.link_paths[0]); println!("cargo:rustc-link-lib=proj"); - Ok(pk.include_paths[0].clone()) + pk.include_paths[0].clone() }) .or_else(|err| { eprintln!("pkg-config unable to find existing libproj installation: {}", err); @@ -95,17 +91,15 @@ fn build_from_source() -> Result> config.define("BUILD_PROJINFO", "OFF"); config.define("BUILD_PROJSYNC", "OFF"); config.define("ENABLE_CURL", "OFF"); - let tiff_support = cfg!(feature = "bundled_proj_tiff"); - config.define("ENABLE_TIFF", if tiff_support { "ON" } else { "OFF" }); 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 - + //proj likes to create proj_d when configured as debug and on MSVC, so link to that one if it exists if proj.join("lib").join("proj_d.lib").exists() { - println!("cargo:rustc-link-lib=static=proj_d"); + println!("cargo:rustc-link-lib=static=proj_d"); } else { - println!("cargo:rustc-link-lib=static=proj"); + println!("cargo:rustc-link-lib=static=proj"); } println!( "cargo:rustc-link-search=native={}", @@ -121,9 +115,7 @@ fn build_from_source() -> Result> ); // The PROJ library needs SQLite and the C++ standard library. println!("cargo:rustc-link-lib=dylib=sqlite3"); - if tiff_support { - println!("cargo:rustc-link-lib=dylib=tiff"); - } + println!("cargo:rustc-link-lib=dylib=tiff"); if cfg!(target_os = "linux") { println!("cargo:rustc-link-lib=dylib=stdc++"); } else if cfg!(target_os = "macos") { diff --git a/src/proj.rs b/src/proj.rs index be8ee2c8..7a4ff4d5 100644 --- a/src/proj.rs +++ b/src/proj.rs @@ -555,6 +555,9 @@ impl Proj { } }; + // comparing against float point sentinel values is a reasonable usage of exact + // floating point comparison + #[allow(clippy::float_cmp)] let area = if west != -1000.0 && south != -1000.0 && east != -1000.0 && north != -1000.0 { Some(Area { @@ -908,8 +911,6 @@ impl Drop for ProjBuilder { #[cfg(test)] mod test { - use crate::proj; - use super::*; #[derive(Debug)]