From 7584c4de636645bdf7661ecf940e8ea28fdda275 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 22 Apr 2024 23:07:16 +0300 Subject: [PATCH] Correctly handle different version availabilities --- R/rstan_config.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/rstan_config.R b/R/rstan_config.R index c21e1f5..87f8750 100644 --- a/R/rstan_config.R +++ b/R/rstan_config.R @@ -217,8 +217,6 @@ rstan_config <- function(pkgdir = ".") { cat("#include ", eigen_incl, "#include ", - # Make stan::rng_t typedef available - "#include ", file = file.path(pkgdir, "src", paste(basename(pkgdir), "types.h", sep = "_")), sep = "\n") @@ -238,7 +236,9 @@ rstan_config <- function(pkgdir = ".") { } else { cppcode <- c("#include ", cppcode) } - cppcode <- gsub("boost::ecuyer1988", "stan::rng_t", cppcode, fixed = TRUE) + if (utils::packageVersion('StanHeaders') >= "2.34") { + cppcode <- gsub("boost::ecuyer1988", "stan::rng_t", cppcode, fixed = TRUE) + } # Stan header file hdr_name <- .stan_prefix(model_name, ".h") # get license file (if any) @@ -278,7 +278,7 @@ rstan_config <- function(pkgdir = ".") { header = paste0('#include "', hdr_name, '"'), module = paste0("stan_fit4", model_name, "_mod"), - CppClass = "rstan::stan_fit ", + CppClass = "rstan::stan_fit ", Rfile = FALSE) ) })