diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b847501..a0b99ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,6 +45,7 @@ jobs: - proj-sys-ubuntu - proj-macos - proj-sys-macos + - proj-windows - proj-sys-ubuntu-asan steps: - name: Mark the job as a success @@ -59,6 +60,7 @@ jobs: - proj-sys-ubuntu - proj-macos - proj-sys-macos + - proj-windows - proj-sys-ubuntu-asan steps: - name: Mark the job as a failure @@ -205,6 +207,21 @@ jobs: - run: brew install proj - run: cargo test + proj-windows: + name: proj windows + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + # Currently, Windows build doesn't work without the bundled features. + features: ["--features bundled_proj_sqlite"] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - run: choco install sqlite # Even if we bundle libsqlite, we still need the SQLite binary + - run: cargo build ${{ matrix.features }} + - run: cargo test ${{ matrix.features }} # Build PROJ from the bundled source to enable ASAN. In order to link against # the ASAN-enabled library, "-Z sanitizer=address" flag needs to be passed to # the Rust compiler. So, this job requires the nightly toolchain. diff --git a/Cargo.toml b/Cargo.toml index 4818217..0c799ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ members = ["proj-sys"] [features] default = ["geo-types"] bundled_proj = [ "proj-sys/bundled_proj" ] +bundled_proj_sqlite = [ "proj-sys/bundled_proj_sqlite" ] pkg_config = [ "proj-sys/pkg_config" ] network = ["ureq", "http", "proj-sys/network"] diff --git a/proj-sys/Cargo.toml b/proj-sys/Cargo.toml index f7eba0f..b193537 100644 --- a/proj-sys/Cargo.toml +++ b/proj-sys/Cargo.toml @@ -25,6 +25,7 @@ tar = "0.4.40" [features] nobuild = [] bundled_proj = [] +bundled_proj_sqlite = ["bundled_proj", "libsqlite3-sys/bundled"] # `pkg_config` feature is deprecated and does nothing pkg_config = [] network = ["tiff"] diff --git a/proj-sys/build.rs b/proj-sys/build.rs index ed51c4b..459753e 100644 --- a/proj-sys/build.rs +++ b/proj-sys/build.rs @@ -46,6 +46,12 @@ fn main() -> Result<(), Box> { })? }; + // Link Windows system libs, which are used in cargo test + if cfg!(target_env = "msvc") { + println!("cargo:rustc-link-lib=ole32"); + println!("cargo:rustc-link-lib=shell32"); + } + #[cfg(feature = "buildtime_bindgen")] generate_bindings(include_path)?; #[cfg(not(feature = "buildtime_bindgen"))] diff --git a/src/proj.rs b/src/proj.rs index e4d6a8f..8aab4ba 100644 --- a/src/proj.rs +++ b/src/proj.rs @@ -1779,8 +1779,8 @@ mod test { let t = stereo70 .project(MyPoint::new(500119.70352012233, 500027.77896348457), true) .unwrap(); - assert_relative_eq!(t.x(), 0.43633200013698786); - assert_relative_eq!(t.y(), 0.8028510000110507); + assert_relative_eq!(t.x(), 0.436332000136988, epsilon = 1e-15); + assert_relative_eq!(t.y(), 0.802851000011051, epsilon = 1e-15); } #[test] // Carry out an inverse projection to geodetic coordinates