Skip to content

Commit

Permalink
patch s2geography (add include dir for target)
Browse files Browse the repository at this point in the history
This hopefully fixes s2geography main header file not found when
building spherely windows wheels.
  • Loading branch information
benbovy committed Sep 5, 2024
1 parent c8a9702 commit a80053e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ci/install_3rdparty.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ cd %DEPENDENCIES_DIR%
curl -o s2geography.tar.gz -L https://github.com/paleolimbot/s2geography/archive/refs/tags/%S2GEOGRAPHY_VERSION%.tar.gz
tar -xf s2geography.tar.gz -C %SRC_DIR%

# TODO: remove when fixed in s2geography
rem TODO: remove when fixed in s2geography
cd %SRC_DIR%/s2geography-%S2GEOGRAPHY_VERSION%
patch -p1 < %PROJECT_DIR%\ci\s2geography-add-openssl-as-requirement.patch
patch -p1 < %PROJECT_DIR%\ci\s2geography-add-include-dir.patch

cmake -GNinja ^
-S %SRC_DIR%/s2geography-%S2GEOGRAPHY_VERSION% ^
Expand Down
2 changes: 2 additions & 0 deletions ci/install_3rdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ build_install_dependencies(){
cd $SRC_DIR/s2geography-$S2GEOGRAPHY_VERSION
if [ "$(uname)" == "Darwin" ]; then
patch -p1 < $PROJECT_DIR/ci/s2geography-add-openssl-as-requirement.patch
patch -p1 < $PROJECT_DIR/ci/s2geography-add-include-dir.patch
else
patch -p1 < /project/ci/s2geography-add-openssl-as-requirement.patch
patch -p1 < /project/ci/s2geography-add-include-dir.patch
fi

cmake -S $SRC_DIR/s2geography-$S2GEOGRAPHY_VERSION -B $S2GEOGRAPHY_BUILD_DIR \
Expand Down
15 changes: 15 additions & 0 deletions ci/s2geography-add-include-dir.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d0d5e56..a520a1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -212,6 +212,10 @@ add_library(s2geography
set_target_properties(s2geography PROPERTIES
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS})

+target_include_directories(s2geography PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
+ $<INSTALL_INTERFACE:include>)
+
target_compile_definitions(
s2geography
PUBLIC

0 comments on commit a80053e

Please sign in to comment.