- C++ function for exporting from shared library:
foo_cpp_function(filesrc/foo.cpp) - C++ shared library
foocpp(fileCMakeLists.txt) - Empty makefile to avoid R standard build (file
src/Makefile) - Custom configure script to trigger CMake build (file
configure)
- Load
foocpplibrary into R package (useDynLib(foocpp)fileNAMESPACE) - R wrapper function
foo_r_functionto call C++foo_cpp_function(fileR/foo.R) - Export R function
foo_r_function(export('foo_r_function')fileNAMESPACE)
- Library name
foopack(fileDESCRIPTION) - Version
0.0.1(fileDESCRIPTION) - Result package name
foopack_0.0.1.tar.gz
- Load R library
foopack(library('foopack')filemytest.R) - Call
foo_r_function(filemytest.R)
- Clean directory (
clean.py) - Run
R CMD build,R CMD check,R CMD INSTALL(to local directory) and testmytest.R(run.py)