[Rcpp-devel] Specify Rcpp header location in Makevars

jsmith5889 at yahoo.com jsmith5889 at yahoo.com
Wed Jul 29 21:33:49 CEST 2015


Thanks Dirk and Romain for your comments! CLINK_CPPFLAGS did the trick.

Dirk, I understand that it might seem sub-optimal to define my own
compile commands: part of my project is in cuda for GPU-based
parallelization, and I manually set the compile commands to compile my
cuda source files with nvcc and the c++ source files with the default
compiler.

If there is a more elegant or a more robust way to integrate c++ and
cuda sources in one project, I'd be delighted to hear about it; for now
my Makevars-based approach gets the job done.

Thanks again!
Lutz

On 07/29/2015 09:16 PM, Dirk Eddelbuettel wrote:
> 
> On 29 July 2015 at 17:19, jsmith5889 at yahoo.com wrote:
> | Is there a way to automatically specify the location of the Rcpp include
> | directory (for Rcpp.h) in Makevars?
> 
> As Romain said, add "LinkingTo: Rcpp" to your DESCRIPTION.
>  
> | In my Makevars, I use the following compile command:
> | 
> | %.o: %.cpp $(cpp_sources)
> | 	$(CXX) $(PKG_CXXFLAGS) $<
> 
> This is generally not a good idea. The advise in "Writing R Extensions" is
> not as clear-cut on this as it might be but there were e.g. some comments by
> Simon on this list (or maybe r-devel).  In general, you want your Makevars to
> be as minimal as possibly as these implicit rules __already__ come in via the
> core Makefile parts provided by R.  You are more likely to do harm than good
> here (and yes, I got burned too in the past).
>  
> | I also specified "Imports: Rcpp" in DESCRIPTION, but it does not appear
> | to automatically add the right flags to the compile command.
> | 
> | I am looking for something that could work similarly to Rscript -e
> | "Rcpp:::LdFlags()", which used to export the Rcpp library flags.
> | 
> | Any ideas are greatly appreciated!
> 
> The best best may be to start with Rcpp.package.skeleton() and see what it
> creates.
> 
> Cheers, Dirk
> 


More information about the Rcpp-devel mailing list