[Rcpp-devel] Rcpp package structure

Iñaki Úcar i.ucar86 at gmail.com
Thu Jul 12 15:56:36 CEST 2018

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:

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:

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.

Hope it helps.

> Thanks and best regards,
> Vissarion.
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

More information about the Rcpp-devel mailing list