Skip to content

[S2Geography] New recipe#9450

Open
asinghvi17 wants to merge 26 commits intoJuliaPackaging:masterfrom
asinghvi17:as/s2geography
Open

[S2Geography] New recipe#9450
asinghvi17 wants to merge 26 commits intoJuliaPackaging:masterfrom
asinghvi17:as/s2geography

Conversation

@asinghvi17
Copy link
Copy Markdown
Contributor

@asinghvi17 asinghvi17 commented Sep 18, 2024

https://github.com/paleolimbot/S2Geography is a wrapper around S2Geometry that provides a GEOS-like C++ API around the S2 objects which often don't act like geospatial objects.

This PR is now ready to go.

Comment thread S/S2Geography/build_tarballs.jl Outdated
Comment thread S/S2Geography/build_tarballs.jl Outdated
Comment thread S/S2Geography/bundled/msvc_to_win32_target.patch Outdated
Comment thread S/S2Geography/build_tarballs.jl Outdated
Comment thread S/S2Geography/build_tarballs.jl Outdated
Comment thread S/S2Geography/build_tarballs.jl Outdated
asinghvi17 and others added 2 commits September 18, 2024 06:53
Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com>
@fingolfin
Copy link
Copy Markdown
Member

@asinghvi17 hi there, are you still interested in completing this?

@asinghvi17 asinghvi17 marked this pull request as ready for review November 24, 2025 21:51
@asinghvi17
Copy link
Copy Markdown
Contributor Author

Hey @fingolfin, thanks for the ping! I marked this as ready for review and am re-running CI now.

@asinghvi17 asinghvi17 closed this Nov 24, 2025
@asinghvi17 asinghvi17 reopened this Nov 24, 2025
@fingolfin
Copy link
Copy Markdown
Member

@asinghvi17 that won't work, you'll have to rebase this on latest master, or merge latest master into it

@asinghvi17
Copy link
Copy Markdown
Contributor Author

asinghvi17 commented Nov 24, 2025

Somehow it doesn't let me merge online, so I will do that locally tomorrow

@fingolfin
Copy link
Copy Markdown
Member

I merged master for you so CI can run

Comment thread S/S2Geography/build_tarballs.jl Outdated
@fingolfin fingolfin changed the title [WIP] New recipe: S2Geography [S2Geography] New recipe Nov 24, 2025
Comment thread S/S2Geography/build_tarballs.jl Outdated
asinghvi17 and others added 5 commits February 25, 2026 17:40
Co-authored-by: Max Horn <max@quendi.de>
- Bump source to tag 0.3.0 (geoarrow now built into main library)
- Remove libs2geography_geoarrow product (no longer a separate target)
- Add nanoarrow_jll dependency (new requirement in v0.3.0)
- Update msvc_to_win32_target.patch for v0.3.0 CMakeLists.txt

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…chContent

- Add CMAKE_INSTALL_PREFIX and CMAKE_TOOLCHAIN_FILE so the library
  installs to the correct destdir and cross-compiles properly
- Set FETCHCONTENT_FULLY_DISCONNECTED=ON to use system nanoarrow JLL
  instead of downloading a separate copy

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Inject find_package(nanoarrow) and create an alias target so the
upstream CMakeLists.txt skips its FetchContent download and uses
the nanoarrow_jll instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
asinghvi17 and others added 4 commits February 25, 2026 19:33
CMake cannot create an ALIAS of an ALIAS target. Use the real
nanoarrow::nanoarrow_shared target instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The /J flag (make char unsigned) is MSVC-specific. When cross-compiling
for Windows with MinGW/GCC, this flag is not recognized. Keep
_USE_MATH_DEFINES and NOMINMAX for all WIN32, but guard /J behind
an MSVC check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bump preferred_gcc_version to v10 to fix MinGW std::filesystem bugs
  in GCC 8's headers
- Filter out all freebsd (OpenSSL sysroot mismatch) and riscv64
  (s2geometry not found) platforms

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Merge MSVC/WIN32 patch and nanoarrow sed hack into a single
  cmake_fixes.patch
- Remove stale TODO comment and duplicate platforms declaration
- Delete old msvc_to_win32_target.patch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
asinghvi17 and others added 2 commits February 25, 2026 20:36
Instead of patching the nanoarrow FetchContent block out of
CMakeLists.txt, use CMAKE_PROJECT_s2geography_INCLUDE to inject
find_package(nanoarrow) after project(). This creates the nanoarrow
target before the FetchContent block runs, so it's skipped naturally.

The patch now only contains the WIN32/MSVC fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The CMAKE_PROJECT_INCLUDE approach found nanoarrow from the wrong
sysroot on some platforms (static instead of shared). The combined
patch is more reliable since it runs at the right point in cmake
processing with the correct find paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@asinghvi17
Copy link
Copy Markdown
Contributor Author

asinghvi17 commented Feb 26, 2026

According to Claude:

The bundled cmake_fixes.patch makes two changes to upstream's CMakeLists.txt:

  1. Nanoarrow: Replaces the FetchContent download with find_package(nanoarrow) so it uses the system nanoarrow from nanoarrow_jll. An alias target is needed because upstream checks if(NOT TARGET nanoarrow) (plain name) but find_package only creates nanoarrow::nanoarrow_shared.

  2. WIN32/MSVC: Widens if(MSVC) to if(WIN32) so _USE_MATH_DEFINES and NOMINMAX are set when cross-compiling with MinGW, but keeps the MSVC-only /J flag guarded behind if(MSVC).

Match paleolimbot/s2geography#70: try find_package(nanoarrow) first,
fall back to FetchContent if not found. This keeps the FetchContent
block intact as a fallback rather than deleting it.

Once the upstream PR is merged, the nanoarrow hunk of this patch
can be dropped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@asinghvi17
Copy link
Copy Markdown
Contributor Author

Updated to s2geography v0.3.0 (from v0.1.2). Summary of changes:

  • Source: bumped to tag 0.3.0 (c4d4e5f)
  • Products: removed libs2geography_geoarrow (geoarrow is now compiled into the main libs2geography)
  • Dependencies: added nanoarrow_jll (new dep in v0.3.0)
  • GCC: bumped to v10 (GCC 8's MinGW std::filesystem headers are broken)
  • Platforms: filtered out freebsd (OpenSSL sysroot mismatch) and riscv64 (s2geometry not found)

The nanoarrow portion of cmake_fixes.patch matches an upstream PR (paleolimbot/s2geography#70) — once merged, that hunk can be dropped.

asinghvi17 and others added 4 commits February 25, 2026 21:26
Test whether MinGW builds work without the MSVC->WIN32 change.
MinGW typically defines M_PI without _USE_MATH_DEFINES and may
not need NOMINMAX.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MinGW does not define M_PI without _USE_MATH_DEFINES, confirmed
by CI failure. The WIN32 patch is necessary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cleaner approach: try find_package inside the existing guard, close
it, then let the FetchContent block run under its own guard. This
way the find_package only runs if nanoarrow isn't already available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update s2geography to 04a31a89 which includes the CMake fixes
from paleolimbot/s2geography#70 and JuliaPackaging#71, so the patch is no
longer needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@imciner2
Copy link
Copy Markdown
Member

imciner2 commented Mar 2, 2026

@fingolfin any last comments? The recipe looks fine to me now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants