Rmpp openmp plugin in building package
When I write a standalone cpp script, I enable openmp with // [[Rcpp::plugins(openmp)]]
.
However, when I try to create an R package with Rcpp, I don't know how to tell the compiler that I have a plugin. I tried to add Plugin:openmp
to the description, but it doesn't work.
Can anyone please help?
+3
source to share
1 answer
You edit src/Makevars
accordingly, which is explained in Writing V extensions :
PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS)
See section 1.2.1.1 in the link above for details.
+7
source to share