Skip to content

Commit

Permalink
Fix compile error on Windows with Rust 1.70 (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
yutannihilation committed Jun 9, 2023
1 parent ee00811 commit 05c8504
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,18 @@ jobs:
cache-version: 2
extra-packages: rcmdcheck

# TODO: allow warnings on oldrel (cf., https://stat.ethz.ch/pipermail/r-package-devel/2023q2/009229.html)
- name: Check R version
id: error-on
run: |
output <- Sys.getenv("GITHUB_OUTPUT")
if (.Platform$OS.type == "windows" && getRversion() < "4.3.0") {
cat('level=error', file = output, append = TRUE)
} else {
cat('level=warning', file = output, append = TRUE)
}
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
with:
error-on: '"${{ steps.error-on.outputs.level }}"'
9 changes: 8 additions & 1 deletion .github/workflows/test_pkg_gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,19 @@ jobs:
)
Sys.chmod("configure", "0755")
# TODO: allow warnings on oldrel (cf., https://stat.ethz.ch/pipermail/r-package-devel/2023q2/009229.html)
if (.Platform$OS.type == "windows" && getRversion() < "4.3.0") {
error_on <- "error"
} else {
error_on <- "warning"
}
# check if rextendr::document() compiles and generates wrappers properly
rextendr::document()
rcmdcheck::rcmdcheck(
path = ".",
args = c("--no-manual", "--as-cran"),
error_on = "warning",
error_on = error_on,
check_dir = "check_use_extendr"
)
Expand Down
2 changes: 1 addition & 1 deletion inst/templates/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu
TARGET_DIR = ./rust/target
LIBDIR = $(TARGET_DIR)/$(TARGET)/release
STATLIB = $(LIBDIR)/lib{{{lib_name}}}.a
PKG_LIBS = -L$(LIBDIR) -l{{{lib_name}}} -lws2_32 -ladvapi32 -luserenv -lbcrypt
PKG_LIBS = -L$(LIBDIR) -l{{{lib_name}}} -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll

all: C_clean

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/use_extendr.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
TARGET_DIR = ./rust/target
LIBDIR = $(TARGET_DIR)/$(TARGET)/release
STATLIB = $(LIBDIR)/libtestpkg.a
PKG_LIBS = -L$(LIBDIR) -ltestpkg -lws2_32 -ladvapi32 -luserenv -lbcrypt
PKG_LIBS = -L$(LIBDIR) -ltestpkg -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll
all: C_clean
Expand Down

0 comments on commit 05c8504

Please sign in to comment.