Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions R/tbb.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ tbbLibraryPath <- function(name = NULL) {
tbbName <- file.path(tbbRoot, libName)
if (file.exists(tbbName))
return(tbbName)

arch <- if (nzchar(.Platform$r_arch)) .Platform$r_arch
suffix <- paste(c("lib", arch, libName), collapse = "/")
tbbName <- system.file(suffix, package = "RcppParallel")

tbbName <- systemFile("lib", libName)
if (file.exists(tbbName))
return(tbbName)

Expand Down Expand Up @@ -90,10 +88,8 @@ tbbLdFlags <- function() {
# on Windows, we statically link to oneTBB
if (is_windows()) {

libPath <- system.file("libs", package = "RcppParallel")
if (nzchar(.Platform$r_arch))
libPath <- file.path(libPath, .Platform$r_arch)

libPath <- systemFile("libs")

ldFlags <- sprintf("-L%s -lRcppParallel", asBuildPath(libPath))
return(ldFlags)

Expand Down Expand Up @@ -127,9 +123,6 @@ tbbRoot <- function() {
if (nzchar(TBB_LIB))
return(TBB_LIB)

rArch <- .Platform$r_arch
parts <- c("lib", if (nzchar(rArch)) rArch)
libDir <- paste(parts, collapse = "/")
system.file(libDir, package = "RcppParallel")
systemFile("lib")

}
8 changes: 8 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

# like system.file(), but injects the architecture-specific subdirectory
# used on Windows when set; e.g. systemFile("lib") resolves 'lib/x64'
systemFile <- function(dir, name = NULL) {
arch <- .Platform$r_arch
parts <- c(dir, if (nzchar(arch)) arch, name)
system.file(paste(parts, collapse = "/"), package = "RcppParallel")
}

# generate paths consumable by the compilers and linkers
# in particular, on Windows and Solaris, this means the path _cannot_ be quoted !!
asBuildPath <- function(path) {
Expand Down
4 changes: 1 addition & 3 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ loadTbbLibrary <- function(name) {
# NOTE: resolve against the package's own library directory, where
# install.libs.R places the stub; tbbRoot() would prefer TBB_LIB,
# which on Windows points at Rtools and holds only static libraries
arch <- .Platform$r_arch
parts <- c("lib", if (nzchar(arch)) arch, paste0(name, ".dll"))
path <- system.file(paste(parts, collapse = "/"), package = "RcppParallel")
path <- systemFile("lib", paste0(name, ".dll"))
if (!file.exists(path))
return(NULL)

Expand Down
Loading