I am trying to install a C++ library called FastAD ( https://github.com/JamesYang007/FastAD#user-guide) in Rcpp but the installation instructions are generic (not specifically for Rcpp).
It would be greatly appreciated if someone coule give me some guidance for how to install and be able to #include the files?
FastAD is a header-only library which only depends on Eigen3. That makes for a pretty straightforward application for Rcpp and friends.
First, rely on the
RcppEigen.package.skeleton()function to create the barebones RcppEigen-using package.Second, we copy the FastAD library into
inst/include. We add aPKG_CPPFLAGSvariable insrc/Makevarsto let R know to source it from there. That is all the compiler needs with a header-only library. (Edit: We also setCXX_STD=CXX17unless one has a new enough compiler or R (currently: r-devel) which already default to C++17.)Third, we create a simple example in
src/based on an example in FastAD. We picked the Black-Scholes example.Fourth, minor cleanups like removing the
hello*stanza files.That is pretty much it. In its embryonic form the package is now here on GitHub. An example is