File tree Expand file tree Collapse file tree 2 files changed +50
-3
lines changed Expand file tree Collapse file tree 2 files changed +50
-3
lines changed Original file line number Diff line number Diff line change 1
1
2
+ CMAKE = @CMAKE@
2
3
R = @R@
3
4
4
5
TBB_LIB = @TBB_LIB@
@@ -19,7 +20,10 @@ $(OBJECTS): tbb
19
20
# NOTE: TBB libraries are installed via install.libs.R.
20
21
# However, we need to copy headers here so that they are visible during compilation.
21
22
tbb: tbb-clean
22
- @TBB_LIB="$(TBB_LIB)" TBB_INC="$(TBB_INC)" TBB_NAME="$(TBB_NAME)" @R@ -s -f install.libs.R --args build
23
+ TBB_LIB="$(TBB_LIB)" TBB_INC="$(TBB_INC)" TBB_NAME="$(TBB_NAME)" \
24
+ CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
25
+ CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
26
+ CMAKE="$(CMAKE)" "@R@" -s -f install.libs.R --args build
23
27
24
28
# NOTE: we do not want to clean ../inst/lib or ../inst/libs here,
25
29
# as we may be writing to those locations in multiarch builds
Original file line number Diff line number Diff line change @@ -220,7 +220,6 @@ pkgLibs <- if (!is.na(tbbLib)) {
220
220
" -l$(TBB_NAME)" ,
221
221
" -ltbbmalloc"
222
222
)
223
-
224
223
} else {
225
224
226
225
c(
@@ -230,8 +229,52 @@ pkgLibs <- if (!is.na(tbbLib)) {
230
229
)
231
230
232
231
}
233
-
232
+
234
233
define(PKG_LIBS = paste(pkgLibs , collapse = " " ))
234
+
235
+ # if we're going to build tbb from sources, check for cmake
236
+ define(CMAKE = " " )
237
+ if (is.na(tbbLib )) {
238
+
239
+ cmake <- local({
240
+
241
+ # check for envvar
242
+ cmake <- Sys.getenv(" CMAKE" , unset = NA )
243
+ if (! is.na(cmake ))
244
+ return (cmake )
245
+
246
+ # check for path
247
+ cmake <- Sys.which(" cmake" )
248
+ if (nzchar(cmake ))
249
+ return (cmake )
250
+
251
+ # check for macOS cmake
252
+ cmake <- " /Applications/CMake.app/Contents/bin/cmake"
253
+ if (file.exists(cmake ))
254
+ return (cmake )
255
+
256
+ stop(" cmake was not found" )
257
+
258
+ })
259
+
260
+ # make sure we have an appropriate version of cmake installed
261
+ output <- system(" cmake --version" , intern = TRUE )[[1L ]]
262
+ cmakeVersion <- numeric_version(sub(" cmake version " , " " , output ))
263
+ if (cmakeVersion < " 3.5" ) {
264
+ stop(" error: RcppParallel requires cmake (>= 3.6); you have " , cmakeVersion )
265
+ }
266
+
267
+ define(CMAKE = cmake )
268
+
269
+ }
270
+
271
+ # set TBB_RPATH
272
+ if (! is.na(tbbLib )) {
273
+ define(TBB_RPATH = sprintf(" -Wl,-rpath,%s" , shQuote(tbbLib )))
274
+ } else {
275
+ define(TBB_RPATH = " " )
276
+ }
277
+
235
278
236
279
# now, set up PKG_CPPFLAGS
237
280
if (! is.na(tbbLib )) {
You can’t perform that action at this time.
0 commit comments