C or C++ code inside subfolders in the src/
for example src/libfoo
don't get compiled when I install a package.
When I searched on other questions I found this that mentions Makevars. I searched the Matrix package Makevars. I I thought that I should add:
PKG_LIBS: -Llibfoo
But that didn't work.
I also found that on Writing R Extensions. I added the following to my Makevars and It didn't work either.
SOURCES = $(libfoo/*.c)
OBJECTS = $(SOURCES:.c=.o)
How should I tweak the Makevars file?
It ended up working by setting:
SOURCES = $(wildcard libfoo/*.c)
OBJECTS = foo.o RcppExports.o $(SOURCES:.c=.o)
The really mysterious part for me is the wildcard
when defining the SOURCES
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With