Skip to content

Commit 507c82a

Browse files
committed
Add support for TBB on Solaris
1 parent eab15a3 commit 507c82a

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ RcppParallel 4.3.7
44
* Fix failure to compile with Rtools 3.3
55
* Fix failure to compile on OS X Snow Leopard R toolchain
66
* Add tbbmalloc library
7+
* Add support for TBB on Solaris
78

89
RcppParallel 4.3.6
910
------------------------------------------------------------------------

R/build.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ tbbCxxFlags <- function() {
3636

3737
# Return the linker flags requried for TBB on this platform
3838
tbbLdFlags <- function() {
39-
# on Windows we need to explicitly link against tbb.dll
40-
if (Sys.info()['sysname'] == "Windows") {
39+
# on Windows and Solaris we need to explicitly link against tbb.dll
40+
if (Sys.info()['sysname'] %in% c("Windows", "SunOS")) {
4141
tbb <- tbbLibPath()
4242
paste("-L", asBuildPath(dirname(tbb)), " -ltbb -ltbbmalloc", sep = "")
4343
} else {
@@ -51,7 +51,8 @@ tbbLibPath <- function(suffix = "") {
5151
tbbSupported <- list(
5252
"Darwin" = paste("libtbb", suffix, ".dylib", sep = ""),
5353
"Linux" = paste("libtbb", suffix, ".so.2", sep = ""),
54-
"Windows" = paste("tbb", suffix, ".dll", sep = "")
54+
"Windows" = paste("tbb", suffix, ".dll", sep = ""),
55+
"SunOS" = paste("libtbb", suffix, ".so", sep = "")
5556
)
5657
if (sysname %in% names(tbbSupported)) {
5758
libDir <- "lib/"

inst/include/RcppParallel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// compatibility with CRAN packages not previously configured
1111
// to link to TBB in Makevars.win)
1212
#ifndef RCPP_PARALLEL_USE_TBB
13-
#if defined(__APPLE__) || defined(__gnu_linux__)
13+
#if defined(__APPLE__) || defined(__gnu_linux__) || ((defined(__sun) && defined(__SVR4)))
1414
#define RCPP_PARALLEL_USE_TBB 1
1515
#include "RcppParallel/TBB.h"
1616
#else

inst/include/tthread/tinythread.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ freely, subject to the following restrictions:
8181
#include <signal.h>
8282
#include <sched.h>
8383
#include <unistd.h>
84+
#include <stdlib.h>
8485
#endif
8586

8687
// Generic includes

src/Makevars

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ else
2323
USE_TBB=Linux
2424
CXX_STD = CXX11
2525
endif
26+
ifeq ($(UNAME), SunOS)
27+
USE_TBB=SunOS
28+
endif
2629
# Note: regular MinGW not supported
2730

2831
endif
@@ -57,6 +60,13 @@ ifeq ($(USE_TBB), Windows)
5760

5861
endif
5962

63+
ifeq ($(USE_TBB), SunOS)
64+
R_32BIT = $(shell ${R_HOME}/bin/Rscript -e 'cat(.Machine$$sizeof.pointer == 4)')
65+
ifeq ($(R_32BIT), TRUE)
66+
MAKE_ARGS += arch=ia32
67+
endif
68+
endif
69+
6070
.PHONY: all tbb
6171

6272
# Order is important in Windows' case. See PKG_LIBS above

src/tbb/build/SunOS.suncc.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ WARNING_AS_ERROR_KEY = Warning as error
3131
WARNING_SUPPRESS = -erroff=unassigned,attrskipunsup,badargtype2w,badbinaryopw,wbadasg,wvarhidemem,inlasmpnu
3232
tbb_strict=0
3333

34-
CPLUS = CC
34+
CPLUS = CC -library=stlport4
3535
CONLY = cc
3636
LIB_LINK_FLAGS = -G -R . -M$(tbb_root)/build/suncc.map.pause
3737
LINK_FLAGS += -M$(tbb_root)/build/suncc.map.pause

0 commit comments

Comments
 (0)