[Rcpp-devel] Makevars flags that get evaluated

Dirk Eddelbuettel edd at debian.org
Tue Oct 1 16:02:43 CEST 2013


On 1 October 2013 at 22:37, Gad Abraham wrote:
| Hi,
| 
| I've started using Rcpp recently and it's great!

Cool!
 
| Is there a list of which of the Makevars variables are evaluated, i.e., ones
| that I can declare as backticks for conditional results. For example, I'd like
| to be able to declare an environment variable during package installation,
| e.g.:
| 
| USE_OPENCL=yes R CMD INSTALL package
| 
| 
| but neither
| PKG_CPPFLAGS += `if ! [ -z $(USE_OPENCL) ]; then echo '-DUSE_OPENCL'; fi`
| nor
| PKG_CXXFLAGS += `if ! [ -z $(USE_OPENCL) ]; then echo '-DUSE_OPENCL'; fi`
| 
| seems to work.

That seems a little fragile.  I would try this in src/Makevars, which use the
Make language (which also inherits environment variables as I dimly recall)
but can also execute shell snippets.

Or you try to set up a local plugin for use by Rcpp Attributes.  Then you get
a hook into R code where you can query the (shell) environment variables and
act accordingly.  We now have plugins for c++11 -- and as of the Rcpp 0.10.5
release from this weekend also for openmp.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list