On Sun, 26 May 2024 17:57:17 -0500 Dirk Eddelbuettel <e...@debian.org> wrote:
> and we'd need something like this (untested) > > .plugins[["openmp"]] <- function() { > list(env = > list(PKG_CXXFLAGS=Sys.getenv("SHLIB_OPENMP_CXXFLAGS, ""), > PKG_LIBS=Sys.getenv("SHLIB_OPENMP_CXXFLAGS, ""))) } >From the documentation, it sounds like a good use for # variables will be pre-loaded from Makeconf Rcpp.plugin.maker(Makevars = ' PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) ') ...but I can't figure out where out$Makevars is used in Rcpp. This could also be a use for R CMD config, but SHLIB_OPENMP_CXXFLAGS is not currently on the list of variables to query: # Makes use of implementation details, ignores user settings make \ R_HOME=/usr/lib/R R_SHARE_DIR=/usr/share/R/share \ -f /usr/lib/R/etc/Makeconf -f /usr/share/R/share/make/config.mk \ print VAR=SHLIB_OPENMP_CXXFLAGS # => -fopenmp R CMD config SHLIB_OPENMP_CXXFLAGS # => ERROR: no information for variable 'SHLIB_OPENMP_CXXFLAGS' Looking at RcppArmadillo:::inlineCxxPlugin itself, it seems that there's no escaping, so Make expressions can be used directly inside the environment variables: registerPlugin('openmp', function() list(env = list( PKG_LIBS = '$(SHLIB_OPENMP_CXXFLAGS)', PKG_CPPFLAGS = '$(SHLIB_OPENMP_CXXFLAGS)' ))) This is mandated by POSIX ("All other environment variables, including those with null values, shall be used as macros") and seems to work in OpenBSD make too. -- Best regards, Ivan ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel