[Rcpp-devel] optionally linking to external libraries

Dirk Eddelbuettel edd at debian.org
Tue Jun 9 13:24:06 CEST 2015


On 9 June 2015 at 09:38, Simon Barthelmé wrote:
| Dear list,
| 
| I've been working on an image processing package for R 
| (https://github.com/dahtah/imager) that uses Rcpp to provide an 
| interface to the CImg library.
| 
| Cimg is contained in just one header file, which makes it easy to ship 
| with an R package. It is relatively self-contained, but some 
| functionality requires external dependencies, such as libpng, libjpeg, 

Those two you get from R itself:

R> capabilities()[1:2]
jpeg  png 
TRUE TRUE 
R>

| libfftw3 and opencv. These additional modules can be included at compile 

Hundreds of packages do just that -- bring in external libraries. And Rcpp
makes it easy.

| time via a #define statement, but of course the right headers and 
| libraries need to be present.
| 
| I'm trying to find a way to provide the additional functionality without 
| forcing the user to install these dependencies. On Linux/Mac a possible 
| way to do that would be to use autoconf, but from what I read Windows 
| support is going to be headache. Does anyone have advice on 
| alternatives? Much appreciated.

Take this one at a time.  On Linux/OS X autoconf is indeed common. Some
package include their own libraries, external libraries is (IMHO) more
elegant.  Some do hybrids.

Windows is always different.

And also see the new r-package-devel list.

Dirk

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


More information about the Rcpp-devel mailing list