TMB c++ code in R package and CRAN checks

313 views Asked by At

I am working on an R package to include c++ templates created in TMB. Using the helpful guidelines shared in this suggestion, I managed to come a very long way.

At the moment, I'm using 2 c++ templates ("kglmer.cpp" and "nglmer.cpp") and the following Makefile.win (and equivalent Makefile) to create the dll's:

all: kglmer.dll nglmer.dll

kglmer.dll: kglmer.cpp
    Rscript --vanilla -e "TMB::compile('kglmer.cpp', '-O1 -g',DLLFLAGS='')"
nglmer.dll: nglmer.cpp
    Rscript --vanilla -e "TMB::compile('nglmer.cpp', '-O1 -g',DLLFLAGS='')"

clean:
    rm -rf *o

However, when running CRAN checks (using devtools::check()), I receive the following warning:

checking if this is a source package ...
     Subdirectory '/src' contains apparent object files/libraries
     kglmer.dll nglmer.dll
Object files/libraries should not be included in a source package.

The issue seems to be related to not properly cleaning the src folder. Do you have any suggestions on how to proceed?

1

There are 1 answers

1
Ralf Stubner On BEST ANSWER

Theclean targets should match the all target, i.e. in Makefile.win you should have

clean:
    rm -rf *.dll