Skip to content

Commit

Permalink
Test diff winflags
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Jan 22, 2024
1 parent b5736f7 commit c4d2461
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
5 changes: 0 additions & 5 deletions R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,6 @@ compile <- function(quiet = TRUE,
if (os_is_linux()) {
env_vars <- c(env_vars, "CXXFLAGS"="-fPIC")
}
if (os_is_windows() && is_ucrt_toolchain()) {
cxx <- "x86_64-w64-mingw32.static.posix-g++"
cc <- "x86_64-w64-mingw32.static.posix-gcc"
env_vars <- c(env_vars, "CXX"=cxx, "CC"=cc)
}

withr::with_path(
c(
Expand Down
18 changes: 12 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -745,18 +745,24 @@ with_cmdstan_flags <- function(expr) {
}
lib_paths <- c("/stan/lib/stan_math/lib/tbb/",
"/stan/lib/stan_math/lib/sundials_6.1.1/lib/")
new_makevars <- c(
USE_CXX14 = 1,
PKG_CPPFLAGS = ifelse(cmdstan_version() <= "2.30.1", "-DCMDSTAN_JSON", ""),
PKG_CXXFLAGS = paste(cxxflags, cmdstanr_includes, r_includes, collapse = " "),
PKG_LIBS = libs
)
if (os_is_windows() && is_ucrt_toolchain()) {
cxx <- "x86_64-w64-mingw32-g++"
cc <- "x86_64-w64-mingw32-gcc"
new_makevars <- c(new_makevars, "CXX" = cxx, "CC" = cc)
}
withr::with_path(
c(
paste0(cmdstan_path(), lib_paths),
toolchain_PATH_env_var()
),
withr::with_makevars(
c(
USE_CXX14 = 1,
PKG_CPPFLAGS = ifelse(cmdstan_version() <= "2.30.1", "-DCMDSTAN_JSON", ""),
PKG_CXXFLAGS = paste(cxxflags, cmdstanr_includes, r_includes, collapse = " "),
PKG_LIBS = libs
),
new_makevars,
expr
)
)
Expand Down

0 comments on commit c4d2461

Please sign in to comment.