Open vspinu opened 2 years ago
You should be able to set the environment variable R_MAKEVARS_USER
to wherever you want it to be if you don't want to use the site wide makevars file. see https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Customizing-package-compilation
There isn't anything built into cpp11 to make this easier however.
Thanks! I learned something new today.
Would it make sense for cpp11 to pick the Makevars in the working directory automatically? Similarly how the Makevars within packages works I would suggest.
You can also temporarily set the PKG_CPPFLAGS
environment variable (totally unverified hack on my end). For example, I use this to prototype C++ linking to my local development version of Arrow:
withr::with_envvar(
list(
PKG_CXXFLAGS = paste0("-I", Sys.getenv("ARROW_HOME"), "/include"),
PKG_LIBS = paste0("-L", Sys.getenv("ARROW_HOME"), "/lib", " -larrow")
),
cpp11::cpp_source("2021_11_05_copy_files.cpp")
)
Sorry if obvious, but I cannot figure out a way to provide compiler flags to
cpp_soruce
besides modifying the~/.R/Makevars
. A localMakevars
file is not picked up.