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 }
0 commit comments