Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLD: require latest s2geometry 0.11 / s2geography 0.1.1 + use cmake config to find libraries #34

Merged
merged 9 commits into from
Aug 19, 2024
7 changes: 0 additions & 7 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ build:
os: "ubuntu-20.04"
tools:
python: "mambaforge-4.10"
jobs:
pre_install:
- git clone https://github.com/paleolimbot/s2geography
- |
cmake -S s2geography -B s2geography/build -DS2GEOGRAPHY_S2_SOURCE=CONDA -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/docs/checkouts/readthedocs.org/user_builds/spherely/conda/$READTHEDOCS_VERSION -DCMAKE_INSTALL_LIBDIR=/home/docs/checkouts/readthedocs.org/user_builds/spherely/conda/$READTHEDOCS_VERSION/lib
- cmake --build s2geography/build
- cmake --install s2geography/build

conda:
environment: docs/environment.yml
Expand Down
28 changes: 19 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,22 @@ find_package(

find_package(pybind11 CONFIG REQUIRED)

# TODO: make it more flexible (non-conda)
set(S2_ROOT_DIR "$ENV{CONDA_PREFIX}")
set(S2GEOGRAPHY_ROOT_DIR "$ENV{CONDA_PREFIX}")
find_package(s2 CONFIG REQUIRED)
if(s2_FOUND)
get_target_property(s2_INCLUDE_DIRS s2::s2 INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "Found s2: ${s2_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Couldn't find s2")
endif()

find_package(s2 REQUIRED)
find_package(s2geography REQUIRED)
find_package(s2geography CONFIG REQUIRED)
if(${s2geography_FOUND})
# not yet provided by s2geography
# get_target_property(s2geography_INCLUDE_DIRS s2geography INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "Found s2geography v${s2geography_VERSION}")
else()
message(FATAL_ERROR "Couldn't find s2geography")
endif()

if(SPHERELY_CODE_COVERAGE)
message(STATUS "Building spherely with coverage enabled")
Expand All @@ -37,9 +47,9 @@ endif()
if (MSVC)
# used in s2geometry's CMakeLists.txt but not defined in target
# TODO: move this in FindS2.cmake?
target_compile_definitions(s2 INTERFACE _USE_MATH_DEFINES)
target_compile_definitions(s2 INTERFACE NOMINMAX)
target_compile_options(s2 INTERFACE /J)
target_compile_definitions(s2::s2 INTERFACE _USE_MATH_DEFINES)
target_compile_definitions(s2::s2 INTERFACE NOMINMAX)
target_compile_options(s2::s2 INTERFACE /J)
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
Expand Down Expand Up @@ -68,7 +78,7 @@ target_compile_definitions(spherely

target_link_libraries(spherely
PRIVATE pybind11::module pybind11::lto pybind11::windows_extras
PUBLIC s2 s2geography
PUBLIC s2::s2 s2geography
)

pybind11_extension(spherely)
Expand Down
2 changes: 1 addition & 1 deletion ci/environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- cxx-compiler
- s2geometry
- s2geometry>=0.11.1
- libabseil
- cmake
- python
Expand Down
4 changes: 2 additions & 2 deletions ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ channels:
- conda-forge
dependencies:
- cxx-compiler
- s2geometry=0.10
- s2geography
- s2geometry>=0.11.1
- s2geography>=0.1.2
- libabseil
- cmake
- python
Expand Down
3 changes: 2 additions & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ dependencies:
- cxx-compiler
- cmake
- make
- s2geometry=0.10
- s2geometry>=0.11.1
- s2geography>=0.1.2
- libabseil
- sphinx
- pydata-sphinx-theme>=0.8.1
Expand Down
78 changes: 0 additions & 78 deletions third_party/cmake/Finds2.cmake

This file was deleted.

77 changes: 0 additions & 77 deletions third_party/cmake/Finds2geography.cmake

This file was deleted.

Loading