From 2812f69337534e333d2d5775f3f2b86047a45623 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 30 Jan 2026 20:42:24 +0900 Subject: [PATCH 1/9] Enable libsqlite3-sys/bundled-windows feature when bundled --- proj-sys/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proj-sys/Cargo.toml b/proj-sys/Cargo.toml index f7eba0f..c2c8207 100644 --- a/proj-sys/Cargo.toml +++ b/proj-sys/Cargo.toml @@ -24,7 +24,7 @@ tar = "0.4.40" [features] nobuild = [] -bundled_proj = [] +bundled_proj = ["libsqlite3-sys/bundled-windows"] # `pkg_config` feature is deprecated and does nothing pkg_config = [] network = ["tiff"] From f6a49c2b29f41bc0c5ff45354b55c576a6d7d257 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 30 Jan 2026 20:58:03 +0900 Subject: [PATCH 2/9] Add bundled_proj_sqlite feature --- proj-sys/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proj-sys/Cargo.toml b/proj-sys/Cargo.toml index c2c8207..b193537 100644 --- a/proj-sys/Cargo.toml +++ b/proj-sys/Cargo.toml @@ -24,7 +24,8 @@ tar = "0.4.40" [features] nobuild = [] -bundled_proj = ["libsqlite3-sys/bundled-windows"] +bundled_proj = [] +bundled_proj_sqlite = ["bundled_proj", "libsqlite3-sys/bundled"] # `pkg_config` feature is deprecated and does nothing pkg_config = [] network = ["tiff"] From e0168369d8893137148609ee9b87cb74a56a424b Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 30 Jan 2026 20:58:11 +0900 Subject: [PATCH 3/9] Add test --- .github/workflows/test.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c29e7e8..49018b9 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 steps: - name: Mark the job as a success run: exit 0 @@ -58,6 +59,7 @@ jobs: - proj-sys-ubuntu - proj-macos - proj-sys-macos + - proj-windows steps: - name: Mark the job as a failure run: exit 1 @@ -202,3 +204,18 @@ jobs: - run: brew install pkg-config - 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: cargo build ${{ matrix.features }} + - run: cargo test ${{ matrix.features }} From a0ac4f2c19f0abe22d8ffaa73776d419fce257af Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 30 Jan 2026 21:00:45 +0900 Subject: [PATCH 4/9] Expose bundled_proj_sqlite --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) 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"] From 6529cd07226363b644b81267d76bdbc400b3c68b Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 30 Jan 2026 21:07:03 +0900 Subject: [PATCH 5/9] Install SQLite binary --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 49018b9..15420ab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -217,5 +217,6 @@ jobs: 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 }} From fdce4b7de9b9426f9710c99e14263ed0e45c3d35 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 30 Jan 2026 21:23:11 +0900 Subject: [PATCH 6/9] Add build flags for Windlws system libraries. --- proj-sys/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) 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"))] From 1c9bc456f790bd67a5461d33df3d8b1f772ab055 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Sat, 31 Jan 2026 22:32:40 +0900 Subject: [PATCH 7/9] Fix a null-termination bug --- src/proj.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/proj.rs b/src/proj.rs index a141fb9..1bdb182 100644 --- a/src/proj.rs +++ b/src/proj.rs @@ -1357,9 +1357,14 @@ impl Proj { None }; - let opts_ptrs = options_str - .as_ref() - .map(|o| o.iter().map(|cs| cs.as_ptr()).collect::>()); + let opts_ptrs = options_str.as_ref().map(|o| { + // Each option is a CString (null-terminated string), but PROJ also expects + // the *array* of option pointers itself to be null-terminated (char* const*). + let mut ptrs: Vec<_> = o.iter().map(|cs| cs.as_ptr()).collect(); + // Add a trailing NULL pointer to terminate the list. + ptrs.push(ptr::null()); + ptrs + }); let wkt_type = match version.unwrap_or(WktVersion::Wkt2_2019) { WktVersion::Wkt2_2015 => PJ_WKT_TYPE_PJ_WKT2_2015, From 7e28bc4e8cd036ca38993490e265ebc371d47d78 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Sat, 31 Jan 2026 22:33:09 +0900 Subject: [PATCH 8/9] Loosen a test a bit --- src/proj.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/proj.rs b/src/proj.rs index 1bdb182..a668ea6 100644 --- a/src/proj.rs +++ b/src/proj.rs @@ -1769,8 +1769,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 From 852e79bcecf544d3e7b77c929286c26986eafbe4 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Sun, 1 Feb 2026 20:22:12 +0900 Subject: [PATCH 9/9] Revert "Fix a null-termination bug" This reverts commit 1c9bc456f790bd67a5461d33df3d8b1f772ab055. --- src/proj.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/proj.rs b/src/proj.rs index a668ea6..0a7298a 100644 --- a/src/proj.rs +++ b/src/proj.rs @@ -1357,14 +1357,9 @@ impl Proj { None }; - let opts_ptrs = options_str.as_ref().map(|o| { - // Each option is a CString (null-terminated string), but PROJ also expects - // the *array* of option pointers itself to be null-terminated (char* const*). - let mut ptrs: Vec<_> = o.iter().map(|cs| cs.as_ptr()).collect(); - // Add a trailing NULL pointer to terminate the list. - ptrs.push(ptr::null()); - ptrs - }); + let opts_ptrs = options_str + .as_ref() + .map(|o| o.iter().map(|cs| cs.as_ptr()).collect::>()); let wkt_type = match version.unwrap_or(WktVersion::Wkt2_2019) { WktVersion::Wkt2_2015 => PJ_WKT_TYPE_PJ_WKT2_2015,