[Rcpp-devel] Rcpp package structure

Dirk Eddelbuettel edd at debian.org
Fri Jul 13 00:26:22 CEST 2018


On 12 July 2018 at 15:56, Iñaki Úcar wrote:
| El jue., 12 jul. 2018 a las 15:32, Vissarion Fisikopoulos
| (<fisikop at gmail.com>) escribió:
| >
| > Hi all,
| >
| > I am mentoring a gsoc project on development of a C++ library with an
| > R interface using Rcpp.
| >
| > Currently the project has the following structure: let root be the
| > main folder of the package, the default Rcpp package structure is in
| > root/R-proj, C++ header files are in root/include and we have some
| > tests for the C++ functions in root/test as well as external libraries
| > in root/external.
| >
| > The package can be installed successfully without any problems (since
| > in makevars we include all the files from root/include) but if we run
| > devtools::check() in root/R-proj, it returns an error because it seems
| > that it is not able to see files outside R package main folder which
| > is root/R-proj.
| >
| > It seems that devtools expect to have C++ sources inside root/R-proj
| > but then either we mix the C++ sources with the R interface or we keep
| > two copies of the C++ sources (one inside R-proj and one outside).
| > Since both solutions seem problematic to me I would like to ask what
| > is the recommended structure for such a project?
| 
| See this thread:
| https://stat.ethz.ch/pipermail/r-package-devel/2017q2/001680.html
| 
| Summing up, a shared library must be installed in a standard location,
| otherwise, it should be under R-proj/src. For example, this is what
| MonetDBLite does:
| https://github.com/hannesmuehleisen/MonetDBLite-R/tree/master/src
| 
| If you are using git, I think that a good approach is to have a repo
| for the main C++ library and to add it as a git submodule under src/
| in the R package repo. This eases the burden of code synchronisation.
| But then you need to remember to always clone recursively.

Or have it in the same repo but maybe copy/link at build time.

The package layout requirement is an R issue, and is not imposed by Rcpp.

Dirk

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


More information about the Rcpp-devel mailing list