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
4 changes: 4 additions & 0 deletions R/tbb.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ tbbLdFlags <- function() {
# shortcut if TBB_LIB defined
tbbLib <- Sys.getenv("TBB_LINK_LIB", Sys.getenv("TBB_LIB", unset = TBB_LIB))
if (nzchar(tbbLib)) {
if (R.version$os == "emscripten") {
fmt <- "-L%1$s -l%2$s"
return(sprintf(fmt, asBuildPath(tbbLib), TBB_NAME))
}
fmt <- "-L%1$s -Wl,-rpath,%1$s -l%2$s -l%3$s"
return(sprintf(fmt, asBuildPath(tbbLib), TBB_NAME, TBB_MALLOC_NAME))
}
Expand Down
18 changes: 18 additions & 0 deletions src/install.libs.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
Darwin = "^libtbb.*\\.dylib$",
"^libtbb.*\\.so.*$"
)
# WASM only supports static libraries
if (R.version$os == "emscripten") {
shlibPattern <- "^libtbb.*\\.a$"
}

if (!nzchar(tbbLib)) {

Expand Down Expand Up @@ -114,6 +118,15 @@ useBundledTbb <- function() {
".."
)

if (R.version$os == "emscripten") {
cmakeFlags <- c(
"-DEMSCRIPTEN=1",
"-DTBBMALLOC_BUILD=0",
"-DBUILD_SHARED_LIBS=0",
cmakeFlags
)
}

writeLines("*** configuring tbb")
owd <- setwd("tbb/build-tbb")
output <- system2(cmake, shQuote(cmakeFlags), stdout = TRUE, stderr = TRUE)
Expand Down Expand Up @@ -145,6 +158,11 @@ useBundledTbb <- function() {
"^libtbb.*\\.so.*$"
)

# WASM only supports static libraries
if (R.version$os == "emscripten") {
shlibPattern <- "^libtbb.*\\.a$"
}

tbbFiles <- list.files(
file.path(getwd(), "tbb/build-tbb"),
pattern = shlibPattern,
Expand Down
19 changes: 12 additions & 7 deletions tools/config/configure.R
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,18 @@ pkgLibs <- if (!is.na(tbbLib)) {
NULL

} else {

c(
"-Wl,-Ltbb/build/lib_release",
"-l$(TBB_NAME)",
"-l$(TBB_MALLOC_NAME)"
)

if (R.version$os == "emscripten") {
c(
"-Wl,-Ltbb/build/lib_release",
"-l$(TBB_NAME)"
)
} else {
c(
"-Wl,-Ltbb/build/lib_release",
"-l$(TBB_NAME)",
"-l$(TBB_MALLOC_NAME)"
)
}
}


Expand Down
Loading