@@ -107,7 +107,6 @@ switch(
107
107
# on Windows, check for Rtools; if it exists, and we have tbb, use it
108
108
if (.Platform $ OS.type == " windows" ) {
109
109
110
- tbbPattern <- " lib(tbb[^[:alpha:]]*)\\ .a$"
111
110
gccPath <- normalizePath(Sys.which(" gcc" ), winslash = " /" )
112
111
113
112
tbbLib <- Sys.getenv(" TBB_LIB" , unset = NA )
@@ -118,22 +117,35 @@ if (.Platform$OS.type == "windows") {
118
117
if (is.na(tbbInc ))
119
118
tbbInc <- normalizePath(file.path(gccPath , " ../../include" ), winslash = " /" )
120
119
121
- tbbLibs <- list.files(tbbLib , pattern = tbbPattern )
122
- if (length(tbbLibs )) {
123
- tbbName <- gsub(tbbPattern , " \\ 1" , tbbLibs [[1L ]])
120
+ tbbFiles <- list.files(tbbLib , pattern = " ^libtbb" )
121
+ if (length(tbbFiles )) {
122
+
123
+ tbbPattern <- " ^lib(tbb\\ d*(?:_static)?)\\ .a$"
124
+ tbbName <- grep(tbbPattern , tbbFiles , perl = TRUE , value = TRUE )
125
+ tbbName <- gsub(tbbPattern , " \\ 1" , tbbName , perl = TRUE )
126
+
127
+ tbbMallocPattern <- " ^lib(tbbmalloc\\ d*(?:_static)?)\\ .a$"
128
+ tbbMallocName <- grep(tbbMallocPattern , tbbFiles , perl = TRUE , value = TRUE )
129
+ tbbMallocName <- gsub(tbbMallocPattern , " \\ 1" , tbbMallocName , perl = TRUE )
130
+
124
131
Sys.setenv(
125
132
TBB_LIB = tbbLib ,
126
133
TBB_INC = tbbInc ,
127
- TBB_NAME = tbbName
134
+ TBB_NAME = tbbName ,
135
+ TBB_MALLOC_NAME = tbbMallocName
128
136
)
137
+
129
138
}
139
+
130
140
}
131
141
132
142
# try and figure out path to TBB
133
143
tbbRoot <- Sys.getenv(" TBB_ROOT" , unset = NA )
134
144
tbbLib <- Sys.getenv(" TBB_LIB" , unset = NA )
135
145
tbbInc <- Sys.getenv(" TBB_INC" , unset = NA )
146
+
136
147
tbbName <- Sys.getenv(" TBB_NAME" , unset = " tbb" )
148
+ tbbMallocName <- Sys.getenv(" TBB_MALLOC_NAME" , unset = " tbbmalloc" )
137
149
138
150
# check TBB_ROOT first if defined
139
151
if (! is.na(tbbRoot )) {
@@ -205,9 +217,10 @@ if (tryAutoDetect) {
205
217
206
218
# now, define TBB_LIB and TBB_INC as appropriate
207
219
define(
208
- TBB_LIB = if (! is.na(tbbLib )) tbbLib else " " ,
209
- TBB_INC = if (! is.na(tbbInc )) tbbInc else " " ,
210
- TBB_NAME = tbbName
220
+ TBB_LIB = if (! is.na(tbbLib )) tbbLib else " " ,
221
+ TBB_INC = if (! is.na(tbbInc )) tbbInc else " " ,
222
+ TBB_NAME = tbbName ,
223
+ TBB_MALLOC_NAME = tbbMallocName
211
224
)
212
225
213
226
# set PKG_LIBS
@@ -217,7 +230,7 @@ pkgLibs <- if (!is.na(tbbLib)) {
217
230
" -Wl,-L\" $(TBB_LIB)\" " ,
218
231
sprintf(" -Wl,-rpath,%s" , shQuote(tbbLib )),
219
232
" -l$(TBB_NAME)" ,
220
- " -ltbbmalloc "
233
+ " -l$(TBB_MALLOC_NAME) "
221
234
)
222
235
223
236
} else if (.Platform $ OS.type == " windows" ) {
@@ -229,7 +242,7 @@ pkgLibs <- if (!is.na(tbbLib)) {
229
242
c(
230
243
" -Wl,-Ltbb/build/lib_release" ,
231
244
" -l$(TBB_NAME)" ,
232
- " -ltbbmalloc "
245
+ " -l$(TBB_MALLOC_NAME) "
233
246
)
234
247
235
248
}
0 commit comments