|
| 1 | +args <- commandArgs(TRUE) |
| 2 | +stopifnot(length(args) == 1L) |
| 3 | + |
| 4 | +variant <- args[[1]] |
| 5 | +repos <- c(CRAN = "https://cloud.r-project.org") |
| 6 | +ncpus <- max(1L, parallel::detectCores()) |
| 7 | + |
| 8 | +if (identical(variant, "classic")) { |
| 9 | + Sys.unsetenv(c("TBB", "TBB_ROOT", "TBB_INC", "TBB_LIB", "TBB_LINK_LIB", "TBB_AUTODETECT")) |
| 10 | +} else if (identical(variant, "onetbb")) { |
| 11 | + Sys.unsetenv("TBB_AUTODETECT") |
| 12 | + required <- c("TBB_INC", "TBB_LIB") |
| 13 | + missing <- required[!nzchar(Sys.getenv(required))] |
| 14 | + if (length(missing) > 0L) { |
| 15 | + stop("Missing required environment variables: ", paste(missing, collapse = ", ")) |
| 16 | + } |
| 17 | +} else { |
| 18 | + stop("Unknown variant: ", variant) |
| 19 | +} |
| 20 | + |
| 21 | +message("Installing RcppParallel variant: ", variant) |
| 22 | +install.packages("Rcpp", repos = repos, Ncpus = ncpus) |
| 23 | +install.packages("RcppParallel", repos = repos, type = "source", Ncpus = ncpus) |
| 24 | + |
| 25 | +pkgs <- c("Rcpp", "RcppParallel") |
| 26 | +stopifnot(all(vapply(pkgs, requireNamespace, logical(1), quietly = TRUE))) |
0 commit comments