diff --git a/.github/workflows/check-latest.yaml b/.github/workflows/check-latest.yaml index 05a199b..d8d3181 100644 --- a/.github/workflows/check-latest.yaml +++ b/.github/workflows/check-latest.yaml @@ -47,12 +47,12 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get update -y - sudo apt-get install -y libproj-dev libaec-dev libopenjp2-7-dev libpng-dev + sudo apt-get install -y libproj-dev libaec-dev libopenjp2-7-dev libpng-dev python3-dev - name: Install macOS dependencies if: runner.os == 'macOS' run: | - brew install proj libaec openjpeg zlib + brew install proj libaec openjpeg zlib python - name: Build eccodes from source run: ./install_eccodes.sh diff --git a/.github/workflows/check-minimum.yaml b/.github/workflows/check-minimum.yaml index 9d0a441..4e16897 100644 --- a/.github/workflows/check-minimum.yaml +++ b/.github/workflows/check-minimum.yaml @@ -30,7 +30,7 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes - ECCODES_VERSION: 2.19.0 + ECCODES_VERSION: 2.30.0 steps: - uses: actions/checkout@v4 @@ -47,12 +47,12 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get update -y - sudo apt-get install -y libproj-dev libaec-dev libopenjp2-7-dev libpng-dev + sudo apt-get install -y libproj-dev libaec-dev libopenjp2-7-dev libpng-dev python3-dev - name: Install macOS dependencies if: runner.os == 'macOS' run: | - brew install proj libaec openjpeg zlib + brew install proj libaec openjpeg zlib python - name: Build eccodes from source (Linux) if: runner.os == 'Linux' diff --git a/.github/workflows/check-standard.yaml b/.github/workflows/check-standard.yaml index 961c3d4..0b08263 100644 --- a/.github/workflows/check-standard.yaml +++ b/.github/workflows/check-standard.yaml @@ -47,11 +47,11 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get update -y - sudo apt-get install -y libproj-dev libeccodes-dev + sudo apt-get install -y libproj-dev libeccodes-dev python3-dev - name: Install macOS dependencies if: runner.os == 'macOS' - run: brew install proj eccodes + run: brew install proj eccodes python - uses: r-lib/actions/setup-r-dependencies@v2 with: diff --git a/.github/workflows/check-windows.yaml b/.github/workflows/check-windows.yaml new file mode 100644 index 0000000..bb73924 --- /dev/null +++ b/.github/workflows/check-windows.yaml @@ -0,0 +1,60 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help + +name: Build (Windows UCRT) + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: windows-latest, r: 'release'} + - {os: windows-latest, r: 'devel', http-user-agent: 'release'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + r-tools-version: '44' + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - name: Install dependencies + run: | + pacman -Syu --noconfirm + pacman -S mingw-w64-ucrt-x86_64-proj --noconfirm + pacman -S mingw-w64-ucrt-x86_64-eccodes --noconfirm + pacman -S mingw-w64-ucrt-x86_64-gcc --noconfirm + pacman -S mingw-w64-ucrt-x86_64-python --noconfirm + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true diff --git a/DESCRIPTION b/DESCRIPTION index 2feb71c..4747b7a 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: gribr Type: Package Title: Read GRIB Files -Version: 1.2.7 -Date: 2024-07-12 +Version: 1.2.8 +Date: 2024-08-16 Author: Nathan Wendt Maintainer: Nathan Wendt BugReports: https://github.com/nawendt/gribr/issues @@ -11,6 +11,6 @@ License: BSD_3_clause + file LICENSE RoxygenNote: 7.2.3 Encoding: UTF-8 NeedsCompilation: yes -SystemRequirements: ECMWF ecCodes (>= 2.19.0) +SystemRequirements: ECMWF ecCodes (>= 2.30.0) Imports: proj4, methods, utils Suggests: testthat, lintr, covr diff --git a/R/zzz.R b/R/zzz.R deleted file mode 100644 index 8b634ea..0000000 --- a/R/zzz.R +++ /dev/null @@ -1,29 +0,0 @@ -.onLoad <- function(libname, pkgname) { - # Windows will be binary distributions most of the time - # Need to set ECCODES_DEFINITION_PATH to avoid crash if it - # is not already set - if (.Platform$OS.type == "windows") { - if (Sys.getenv("ECCODES_DEFINITION_PATH") == "") { - normPath <- normalizePath(system.file("extdata", "definitions", - package = "gribr"), mustWork = FALSE) - if (normPath == "") { - warning("R was unable to set ECCODES_DEFINITION_PATH. Please set manually.") - } else { - Sys.setenv(ECCODES_DEFINITION_PATH = normPath) - Sys.setenv(GRIBR_MOD = 1) - } - } - } -} - -.onUnload <- function(libpath) { - # Clean up if .onLoad made mods to env - if (.Platform$OS.type == "windows") { - if (Sys.getenv("GRIBR_MOD") == 1) { - Sys.unsetenv("ECCODES_DEFINITION_PATH") - Sys.unsetenv("GRIBR_MOD") - } - } - - library.dynam.unload("gribr", libpath) -} diff --git a/configure.ucrt b/configure.ucrt new file mode 100644 index 0000000..f65e838 --- /dev/null +++ b/configure.ucrt @@ -0,0 +1 @@ +export PATH=/ucrt64/bin:$PATH diff --git a/install_eccodes.sh b/install_eccodes.sh index cbe8575..937c417 100755 --- a/install_eccodes.sh +++ b/install_eccodes.sh @@ -17,11 +17,12 @@ if [[ -z ${OPENJPEG_INCLUDE_DIR} ]]; then -DENABLE_JPG=ON \ -DENABLE_PNG=ON \ -DENABLE_AEC=ON \ - -DENABLE_PYTHON=OFF \ + -DENABLE_MEMFS=ON \ -DENABLE_FORTRAN=OFF \ -DENABLE_EXAMPLES=OFF \ - -DENABLE_JPG_LIBJASPER=OFF \ - -DENABLE_INSTALL_ECCODES_SAMPLES=OFF + -DENABLE_TESTS=OFF \ + -DENABLE_BUILD_TOOLS=OFF \ + -DENABLE_JPG_LIBJASPER=OFF else echo "OPENJPEG_INCLUDE_DIR: ${OPENJPEG_INCLUDE_DIR}" cmake . -B build -DCMAKE_BUILD_TYPE=Release \ @@ -29,10 +30,11 @@ else -DENABLE_JPG=ON \ -DENABLE_PNG=ON \ -DENABLE_AEC=ON \ - -DENABLE_PYTHON=OFF \ + -DENABLE_MEMFS=ON \ -DENABLE_FORTRAN=OFF \ -DENABLE_EXAMPLES=OFF \ - -DENABLE_INSTALL_ECCODES_SAMPLES=OFF \ + -DENABLE_TESTS=OFF \ + -DENABLE_BUILD_TOOLS=OFF \ -DENABLE_JPG_LIBOPENJPEG=ON \ -DENABLE_JPG_LIBJASPER=OFF \ -DOPENJPEG_INCLUDE_DIR=${OPENJPEG_INCLUDE_DIR} diff --git a/src/Makevars.ucrt b/src/Makevars.ucrt new file mode 100644 index 0000000..0974099 --- /dev/null +++ b/src/Makevars.ucrt @@ -0,0 +1,2 @@ +PKG_LIBS="-LC:/rtools44/ucrt64/lib -leccodes -lopenjp2 -ljasper -laec -lpng -lstdc++" +PKG_CPPFLAGS="-IC:/rtools44/ucrt64/include"