Skip to content

Commit b097d55

Browse files
committed
rename
1 parent cf86415 commit b097d55

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ export(RcppParallel.package.skeleton)
66
export(RcppParallelLibs)
77
export(defaultNumThreads)
88
export(setThreadOptions)
9-
export(tbbLibPath)
9+
export(tbbLibraryPath)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## RcppParallel 5.1.2 (UNRELEASED)
22

3-
* `RcppParallel` gains the `tbbLibPath()` function, to be used when attempting
3+
* `RcppParallel` gains the `tbbLibraryPath()` function, to be used when attempting
44
to query the location of the TBB libraries that `RcppParallel` has been
55
configured to use. This may be useful for R packages which wish to explicitly
66
use, or link to, these libraries.

R/hooks.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mallocDllInfo <- NULL
55
.onLoad <- function(libname, pkgname) {
66

77
# load tbb and tbbmalloc on supported platforms
8-
tbb <- tbbLibPath()
8+
tbb <- tbbLibraryPath("tbb")
99
if (!is.null(tbb)) {
1010
if (!file.exists(tbb)) {
1111
warning(paste("TBB library", tbb, "not found."))
@@ -14,7 +14,7 @@ mallocDllInfo <- NULL
1414
}
1515
}
1616

17-
tbbMalloc <- tbbLibPath("tbbmalloc")
17+
tbbMalloc <- tbbLibraryPath("tbbmalloc")
1818
if (!is.null(tbbMalloc)) {
1919
if (!file.exists(tbbMalloc)) {
2020
warning(paste("TBB malloc library", tbbMalloc, "not found."))

R/tbb.R

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,23 @@
55
#' using RcppParallel that wish to use, or re-use, the version of TBB that
66
#' RcppParallel has been configured to use.
77
#'
8-
#' @param name The name of the library. Normally, this is one of
9-
#' `tbb`, `tbbmalloc`, or `tbbmalloc_proxy`.
8+
#' @param name
9+
#' The name of the TBB library to be resolved. Normally, this is one of
10+
#' `tbb`, `tbbmalloc`, or `tbbmalloc_proxy`. When `NULL`, the library
11+
#' path containing the TBB libraries is returned instead.
1012
#'
1113
#' @export
12-
tbbLibPath <- function(name = "tbb") {
14+
tbbLibraryPath <- function(name = NULL) {
1315

1416
# library paths for different OSes
1517
sysname <- Sys.info()[["sysname"]]
1618

19+
# find root for TBB install
20+
tbbRoot <- Sys.getenv("TBB_LIB", unset = tbbRoot())
21+
if (is.null(name))
22+
return(tbbRoot)
23+
24+
# form library names
1725
tbbLibNames <- list(
1826
"Darwin" = paste0("lib", name, ".dylib"),
1927
"Windows" = paste0( name, ".dll"),
@@ -29,8 +37,7 @@ tbbLibPath <- function(name = "tbb") {
2937
if (!isCompatible)
3038
return(NULL)
3139

32-
# find root for TBB install
33-
tbbRoot <- Sys.getenv("TBB_LIB", unset = tbbRoot())
40+
# find the request library (if any)
3441
libNames <- tbbLibNames[[sysname]]
3542
for (libName in libNames) {
3643
tbbName <- file.path(tbbRoot, libName)
@@ -80,7 +87,7 @@ tbbLdFlags <- function() {
8087
# on Windows and Solaris, we need to explicitly link
8188
needsExplicitFlags <- is_windows() || (is_solaris() && !is_sparc())
8289
if (needsExplicitFlags) {
83-
libPath <- asBuildPath(dirname(tbbLibPath()))
90+
libPath <- asBuildPath(tbbLibraryPath())
8491
libFlag <- paste0("-L", shQuote(libPath))
8592
return(paste(libFlag, "-ltbb", "-ltbbmalloc"))
8693
}

man/tbbLibPath.Rd

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)