extra/download_library.R

# Adopted from http://github.com/RcppCore/RcppNT2/blob/master/inst/configure/configure.R

BOOST_SIMD_URL <- "https://github.com/NumScale/boost.simd"
COMMIT <- "6ea67fcb8d1f2eeb0ccf8a1077175eb7f370fc91" # TAG == "v4.16.9.0"

get_path <- function(name) {
	program <- Sys.which(name)
	if (!nzchar(program)) {
		stop("No program named '", name, "' on PATH.", call. = FALSE)
	}
	program
}

git <- get_path("git")

# Move to up directory in project
owd <- getwd()
if (!grepl("RcppBoostSimd", owd)) {
  stop("this script should be called from within the RcppNT2 sources directory")
}
dir <- gsub("RcppBoostSimd.*", "RcppBoostSimd", owd)
setwd(dir)



# Check out boost.simd
if (!dir.exists("boost.simd")) {
  system2(git, c("clone", BOOST_SIMD_URL))
}
setwd("boost.simd")

system2(git, c("checkout", COMMIT))

setwd(owd)
includes <- file.path("boost.simd", "include")
from <- list.files(includes, full.names = TRUE)
to   <- file.path("inst/include")
if (!dir.exists(to)) {
  dir.create(to, recursive = TRUE)
}
file.copy(from, to, recursive = TRUE)

## Install boost.align
BOOST_ALIGN <- "https://github.com/glenfe/align"
COMMIT_ALIGN <- "a55058b433684a7661ca07c05ca905b95e316868"

if (!dir.exists("align")) {
  system2(git, c("clone", BOOST_ALIGN, "boost.align"))
}
setwd("boost.align")

system2(git, c("checkout", COMMIT_ALIGN))

setwd(owd)
includes <- file.path("align", "include")
from <- list.files(includes, full.names = TRUE)
to   <- file.path("inst/include")
if (!dir.exists(to)) {
  dir.create(to, recursive = TRUE)
}
file.copy(from, to, recursive = TRUE)
OHDSI/RcppBoostSimd documentation built on May 9, 2017, 3:29 p.m.