[Rcpp-devel] testthat + sourceCpp
Tim Keitt
tkeitt at utexas.edu
Wed Jan 25 20:33:51 CET 2017
I have a package that compiles C++ at runtime using sourceCpp and I would
like to use testthat with the package. Its clear that testthat sets up a
non-standard environment and so it is difficult to combine it with
sourceCpp. The first hurdle was include paths not working.
This bit of code in the test_ file seemed to fix that:
ccflags = Sys.getenv("CCFLAGS")
ipath = file.path(getwd(), "inst", "include")
ccflags = if (nzchar(ccflags)) paste(ccflags, paste0("-I", ipath)) else
paste0("-I", ipath)
Sys.setenv(CCFLAGS = ccflags)
However, once compiled, the object does not load correctly as I cannot call
the compiled function. Does anyone have a workaround? (I have searched and
not found anything terribly useful.)
THK
http://www.keittlab.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20170125/3f545759/attachment.html>
More information about the Rcpp-devel
mailing list