Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
54 changes: 54 additions & 0 deletions S/S2Geography/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using BinaryBuilder, Pkg

name = "S2Geography"
version = v"0.1.2"
sources = [
GitSource("https://github.com/paleolimbot/S2Geography.git", "26b65bb0a60361adfcc72b0ac427302cbf10b040"),
DirectorySource("./bundled"),
]

# TODO: fix the build
# by pointing to the right s2 and abseil paths
# from the JLLs.
script = raw"""
cd ${WORKSPACE}/srcdir/s2geography
atomic_patch -p1 ../patches/msvc_to_win32_target.patch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This failed because your patch was in bundled/msvc_to_win32_target.patch not in bundled/patches/msvc_to_win32_target.patch -- I've moved it now

mkdir build
cd build
cmake ..
-DS2GEOGRAPHY_S2_SOURCE=SYSTEM
-DS2GEOGRAPHY_BUILD_TESTS=OFF
-DS2GEOGRAPHY_BUILD_EXAMPLES=OFF
-DS2GEOGRAPHY_CODE_COVERAGE=OFF
cmake --build .
"""

platforms = supported_platforms()

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()
# The following platforms are also excluded by s2geometry, which we depend on.

# Only 64-bit platforms supported
filter!(p -> nbits(p) == 64, platforms)
# We are missing some dependencies (Abseil) for aarch64-freebsd,
# can be re-enabled in the future when we have them
filter!(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms)
# Compilation fails for powerpc:
# /workspace/srcdir/s2geometry/src/s2/s2edge_crossings.cc:120:31: error: ‘(6.15348059642740421245081038903225e-15l / 5.40431955284459475358983848622456e+16l)’ is not a constant expression
filter!(p -> arch(p) != "powerpc64le", platforms)

platforms = expand_cxxstring_abis(platforms)

products = [
LibraryProduct("libs2geography", :libs2geography),
LibraryProduct("libs2geography_geoarrow", :libs2geography_geoarrow),
]

dependencies = [
Dependency(PackageSpec(name="abseil_cpp_jll", uuid="43133aba-3931-5066-b004-a34c79b93f2e"), compat="20240116.2.0"),
Dependency(PackageSpec(name="S2Geometry_jll", uuid="846536d6-5c10-5069-b47f-45525c463cf9"), compat="0.11.1"),
]

build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"7")
12 changes: 12 additions & 0 deletions S/S2Geography/bundled/msvc_to_win32_target.patch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please upstream this patch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened a PR a while ago google/s2geometry#379 and I just saw someone commented there - will see what they think. But for this version is this reasonable to get in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, never mind, this is for s2geography. I'll talk to the author there to try and upstream this.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -147,7 +147,7 @@ elseif(${S2_SOURCE} STREQUAL "SYSTEM")
endif()
endif()

-if (MSVC AND NOT ${S2_SOURCE} STREQUAL "BUNDLED")
+if (WIN32 AND NOT ${S2_SOURCE} STREQUAL "BUNDLED")
# used in s2geometry's CMakeLists.txt but not defined in target
target_compile_definitions(s2::s2 INTERFACE _USE_MATH_DEFINES)
target_compile_definitions(s2::s2 INTERFACE NOMINMAX)