Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
^\.Rproj\.user$
^data-raw$
^src/Makevars$
^src/Makevars\.win$
^\.github$
^\.vscode$
^\.covrignore$
Expand All @@ -18,3 +19,4 @@
^\.cache$
^docker-compose\.yml$
^\.dockerignore$
^vcpkg$
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

64 changes: 51 additions & 13 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ name: R-CMD-check

permissions: read-all

env:
VCPKG_REF: 580d480f750618f8affeb77abbb956e6eeaee0ce

jobs:
# Check MacOS first before embarking on the full check matrix
test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
- name: Install Abseil (MacOS)
run: brew install abseil
- name: Install s2geometry (Homebrew)
run: brew install s2geometry
- name: Install minimal dependencies
run: |
R -e 'install.packages(c("wk", "Rcpp", "bit64", "testthat"))'
Expand All @@ -32,7 +35,7 @@ jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
name: ${{ matrix.config.os }} (${{ matrix.config.r }}, ${{ matrix.config.deps }})

needs:
- test
Expand All @@ -41,21 +44,51 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: '4.2'}
- {os: windows-latest, r: '4.3'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: macos-latest, r: 'release', deps: 'homebrew'}
- {os: macos-latest, r: 'release', deps: 'vcpkg'}
- {os: windows-latest, r: '4.2', deps: 'vcpkg'}
- {os: windows-latest, r: '4.3', deps: 'vcpkg'}
- {os: windows-latest, r: 'release', deps: 'vcpkg'}
- {os: ubuntu-latest, r: 'devel', deps: 'vcpkg', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release', deps: 'vcpkg'}
- {os: ubuntu-latest, r: 'oldrel-1', deps: 'vcpkg'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
VCPKG_ROOT: ${{ matrix.config.deps == 'vcpkg' && format('{0}/vcpkg', github.workspace) || '' }}
VCPKG_DEFAULT_BINARY_CACHE: ${{ matrix.config.deps == 'vcpkg' && format('{0}/vcpkg-bincache', github.workspace) || '' }}

steps:
- uses: actions/checkout@v4

- name: Clone vcpkg
if: matrix.config.deps == 'vcpkg'
uses: actions/checkout@v4
with:
repository: microsoft/vcpkg
ref: ${{ env.VCPKG_REF }}
path: vcpkg

- name: Bootstrap vcpkg (Unix)
if: matrix.config.deps == 'vcpkg' && runner.os != 'Windows'
run: |
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
mkdir -p "$VCPKG_DEFAULT_BINARY_CACHE"

- name: Bootstrap vcpkg (Windows)
if: matrix.config.deps == 'vcpkg' && runner.os == 'Windows'
run: |
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
New-Item -ItemType Directory -Force $env:VCPKG_DEFAULT_BINARY_CACHE

- name: Cache vcpkg binaries
if: matrix.config.deps == 'vcpkg'
uses: actions/cache@v4
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: r-vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ env.VCPKG_REF }}-${{ hashFiles('tools/vcpkg.json', 'tools/vcpkg-triplets/**') }}

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
Expand All @@ -64,10 +97,10 @@ jobs:
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- name: Install Abseil (MacOS)
if: matrix.config.os == 'macos-latest'
- name: Install s2geometry (Homebrew)
if: matrix.config.os == 'macos-latest' && matrix.config.deps == 'homebrew'
run: |
brew install abseil
brew install s2geometry

- name: Set Makevars and environment (Ubuntu)
if: matrix.config.os == 'ubuntu-latest'
Expand All @@ -88,3 +121,8 @@ jobs:
if: always()
run: find check -name '00install.out*' -exec cat '{}' \; || true
shell: bash

- name: Show vcpkg compiler detection logs
if: failure() && runner.os == 'Windows'
run: find vcpkg/buildtrees/detect_compiler -name '*.log' -exec cat '{}' \; || true
shell: bash
12 changes: 4 additions & 8 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
runs-on: macos-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
Expand All @@ -24,14 +24,10 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: actions/checkout@v7
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v2
- run: brew install s2geometry
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::dplyr, any::pkgdown, local::.
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,14 @@ permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
runs-on: macos-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: actions/checkout@v7
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install Abseil (Ubuntu)
run: |
sudo apt-get update && sudo apt-get install -y libabsl-dev

- run: brew install s2geometry
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: covr
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ License: Apache License (== 2.0)
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
SystemRequirements: cmake, OpenSSL >= 1.0.1, Abseil >= 20230802.0
SystemRequirements: cmake, s2geometry (Homebrew >= 0.14.0 or vcpkg)
LinkingTo:
Rcpp,
wk
Expand Down
42 changes: 36 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,43 @@ And the development version from [GitHub](https://github.com/) with:
remotes::install_github("r-spatial/s2")
```

The S2 package requires [Abseil](https://github.com/abseil/abseil-cpp) and OpenSSL. You can install these using a system package manager on most platforms:
The S2 package requires CMake and s2geometry. On macOS, install Homebrew's
[s2geometry](https://formulae.brew.sh/formula/s2geometry) 0.14 or newer:

- Windows: Both OpenSSL and Abseil are available from RTools since R 4.3
- MacOS: `brew install openssl abseil`
- Debian/Ubuntu: `apt-get install libssl-dev libabsl-dev`
- Fedora: `dnf install openssl-devel abseil-cpp-devel`
- Alpine: `apk add abseil-cpp`
``` sh
brew install cmake s2geometry
```

CMake resolves the Abseil libraries required by Homebrew s2geometry 0.14;
OpenSSL is no longer required for that build.

On Linux or Windows, or to build without Homebrew on macOS, point `VCPKG_ROOT`
to a bootstrapped [vcpkg](https://github.com/microsoft/vcpkg) checkout. On
Linux and macOS:

``` sh
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
VCPKG_ROOT="$(pwd)/vcpkg" R CMD INSTALL .
```

On Windows, use PowerShell to bootstrap vcpkg and set `VCPKG_ROOT`:

``` powershell
git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
$env:VCPKG_ROOT = (Resolve-Path .\vcpkg).Path
R CMD INSTALL .
```

The Windows overlay uses Rtools MinGW rather than MSVC so that the dependency
libraries use R's C++ ABI.

The vcpkg build uses an overlay triplet selected for the host architecture and
builds s2geometry and its dependencies with R's compiler and flags. Set
`VCPKG_TARGET_TRIPLET` to override the automatically selected triplet. The
manifest resolves all transitive dependencies required by vcpkg's s2geometry
port.

## Example

Expand Down
46 changes: 37 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,43 @@ And the development version from [GitHub](https://github.com/) with:
remotes::install_github("r-spatial/s2")
```

The S2 package requires [Abseil](https://github.com/abseil/abseil-cpp)
and OpenSSL. You can install these using a system package manager on
most platforms:

- Windows: Both OpenSSL and Abseil are available from RTools since R 4.3
- MacOS: `brew install openssl abseil`
- Debian/Ubuntu: `apt-get install libssl-dev libabsl-dev`
- Fedora: `dnf install openssl-devel abseil-cpp-devel`
- Alpine: `apk add abseil-cpp`
The S2 package requires CMake and s2geometry. On macOS, install Homebrew's
[s2geometry](https://formulae.brew.sh/formula/s2geometry) 0.14 or newer:

``` sh
brew install cmake s2geometry
```

CMake resolves the Abseil libraries required by Homebrew s2geometry 0.14;
OpenSSL is no longer required for that build.

On Linux or Windows, or to build without Homebrew on macOS, point `VCPKG_ROOT`
to a bootstrapped [vcpkg](https://github.com/microsoft/vcpkg) checkout. On
Linux and macOS:

``` sh
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
VCPKG_ROOT="$(pwd)/vcpkg" R CMD INSTALL .
```

On Windows, use PowerShell to bootstrap vcpkg and set `VCPKG_ROOT`:

``` powershell
git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
$env:VCPKG_ROOT = (Resolve-Path .\vcpkg).Path
R CMD INSTALL .
```

The Windows overlay uses Rtools MinGW rather than MSVC so that the dependency
libraries use R's C++ ABI.

The vcpkg build uses an overlay triplet selected for the host architecture and
builds s2geometry and its dependencies with R's compiler and flags. Set
`VCPKG_TARGET_TRIPLET` to override the automatically selected triplet. The
manifest resolves all transitive dependencies required by vcpkg's s2geometry
port.

## Example

Expand Down
8 changes: 4 additions & 4 deletions cleanup
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
rm -f src/Makevars configure.log autobrew
rm `find src -name "*.o"`
rm `find src -name "*.a"`
rm `find src -name "*.tmp"`
rm -f src/Makevars src/Makevars.win configure.log autobrew
find src -name "*.o" -exec rm -f {} +
find src -name "*.a" -exec rm -f {} +
find src -name "*.tmp" -exec rm -f {} +
rm -rf tools/build
rm -rf tools/dist
Loading
Loading