Skip to content

Commit 8c3d280

Browse files
committed
Cleanup R/build.R
1 parent e1b2cc4 commit 8c3d280

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

R/build.R

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,36 +53,31 @@ tbbCxxFlags <- function() {
5353

5454
# Return the linker flags requried for TBB on this platform
5555
tbbLdFlags <- function() {
56-
tbb_path <- Sys.getenv("TBB_LIBRARY_FILE")
57-
if (file.exists(tbb_path)) {
56+
tbb <- tbbLibPath()
57+
if (file.exists(tbb)) {
58+
paste("-L", asBuildPath(dirname(tbb)), " -ltbb -ltbbmalloc", sep = "")
59+
# on Windows and Solaris we need to explicitly link against tbb.dll
60+
} else if ((Sys.info()['sysname'] %in% c("Windows", "SunOS")) && !isSparc()) {
5861
paste("-L", asBuildPath(dirname(tbb)), " -ltbb -ltbbmalloc", sep = "")
5962
} else {
60-
# on Windows and Solaris we need to explicitly link against tbb.dll
61-
if ((Sys.info()['sysname'] %in% c("Windows", "SunOS")) && !isSparc()) {
62-
tbb <- tbbLibPath()
63-
paste("-L", asBuildPath(dirname(tbb)), " -ltbb -ltbbmalloc", sep = "")
64-
} else {
65-
""
66-
}
63+
""
6764
}
6865
}
6966

7067
# Determine the platform-specific path to the TBB library
7168
tbbLibPath <- function(suffix = "") {
7269
sysname <- Sys.info()['sysname']
7370
tbbSupported <- list(
74-
"Darwin" = paste("libtbb", suffix, ".dylib", sep = ""),
75-
"Linux" = paste("libtbb", suffix, ".so.2", sep = ""),
71+
"Darwin" = paste("libtbb", suffix, ".dylib", sep = ""),
72+
"Linux" = paste("libtbb", suffix, ".so.2", sep = ""),
7673
"Windows" = paste("tbb", suffix, ".dll", sep = ""),
7774
"SunOS" = paste("libtbb", suffix, ".so", sep = "")
7875
)
7976

80-
tbb_path <- Sys.getenv("TBB_LIBRARY_FILE")
81-
if (file.exists(tbb_path)) {
82-
libDir <- dirname(tbb_path)
83-
libExt <- strsplit(basename(tbb_path), split="\\.")[[1]][-1]
84-
85-
normalizePath(file.path(libDir, paste("libtbb", suffix, ".", libExt, sep = "")))
77+
tbb <- Sys.getenv("TBB_LIBRARY_FILE")
78+
if (file.exists(tbb)) {
79+
libDir <- dirname(tbb)
80+
normalizePath(file.path(libDir, paste("libtbb", suffix, ".so", sep = "")))
8681
} else {
8782
if ((sysname %in% names(tbbSupported)) && !isSparc()) {
8883
libDir <- "lib/"

0 commit comments

Comments
 (0)