[R-pkg-devel] Rcpp: how best to include source from another Github repository

Jonathan Berrisch jon@th@n @end|ng |rom berr|@ch@b|z
Tue Jan 21 12:04:52 CET 2025


Hi John,

first of all: I'm not an expert on this and don't really know if there 
is a recommended way.

However, you may look at my 'rcpptimer' package and how it includes 
'cpptimer' as a submodule.

You can find the repository here: https://github.com/BerriJ/rcpptimer

And here you can see 'cpptimer' which is included as a submodule: 
https://github.com/BerriJ/rcpptimer/tree/main/inst/include

Whenever I make commits to 'cpptimer' I have to update the submodule 
(basically changing at what commit I want to have that submodule 
included 'git submodule update --remote'). You'll find good 
documentation about submodules online.

Maybe that helps.

Best Regards,

Jonathan / BerriJ


On 1/21/25 11:57, John Clarke wrote:
> Hi folks,
>
> I have an Rcpp package I'm developing. All but one of the cpp source code
> files are pulled from the original/authoritative (CLI) version of the
> application. The only unique cpp source code to the Rcpp package is my
> wrapper.cpp which contains the Rcpp interface. This approach works fine,
> but every time we make changes to the original CLI repository, it requires
> a manual (and duplicate) commit to my Rcpp repo. This is not ideal from a
> source tracking perspective and is a DRY violation.
>
> What is the recommended way of maintaining the shared cpp code in a Rcpp
> repo? Ideally, it would be nice to be able to pull the files from the
> source repo using a tag/hash so that the only code change in the Rcpp repo
> would be that reference rather than all the changes to the shared source.
> It would also be nice to use some sort of symlinkish setup during
> development to allow quick testing before making commits in the original
> CLI repo. Is this possible? Recommended? (we can assume dev is on MacOS or
> Linux)
>
> Thanks,
>
> -John
>
> John Clarke | Senior Technical Advisor |
> Cornerstone Systems Northwest | john.clarke using cornerstonenw.com
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



More information about the R-package-devel mailing list