Skip to content

Commit

Permalink
Correctly handle different version availabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Apr 22, 2024
1 parent b4da478 commit 7584c4d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/rstan_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ rstan_config <- function(pkgdir = ".") {
cat("#include <exporter.h>",
eigen_incl,
"#include <stan/math/prim/meta.hpp>",
# Make stan::rng_t typedef available
"#include <stan/services/util/create_rng.hpp>",
file = file.path(pkgdir, "src",
paste(basename(pkgdir), "types.h", sep = "_")),
sep = "\n")
Expand All @@ -238,7 +236,9 @@ rstan_config <- function(pkgdir = ".") {
} else {
cppcode <- c("#include <rstan/rstaninc.hpp>", 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)
Expand Down Expand Up @@ -278,7 +278,7 @@ rstan_config <- function(pkgdir = ".") {
header = paste0('#include "', hdr_name, '"'),
module = paste0("stan_fit4",
model_name, "_mod"),
CppClass = "rstan::stan_fit<stan_model, stan::rng_t> ",
CppClass = "rstan::stan_fit<stan_model, boost::random::ecuyer1988> ",
Rfile = FALSE)
)
})
Expand Down

0 comments on commit 7584c4d

Please sign in to comment.