Enable control over debug for compile_dll #100
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables the debug flags to be controlled for
compile_dll()
. At present if the user has a~/.R/Makevars
(or equivalent) then the debug flags (-O0 -g
) are not added, otherwise they are unconditionally added. I noticed this when code was behaving differently in a docker container to locally.I have kept the default behaviour the same, though it might be better flipped, controlled by an option etc. Any thoughts on that would depend on this function's interaction with
load_all
and friends though.I have not added tests (yet) because I am not sure you'd want to support this feature. If testing was added it would likely require pulling in mockery as a Suggests.
Motivation: I am using this within a package that loads user code - I need a bit more control than
cpp11::cpp_source
as I am also pairing a bit of R code with the compiled code and trying to keep the workflow as similar as a packaged workflow as possible. I notice thatcpp11::cpp_source
itself does not usepkgbuild::compile_dll
, though it would run into this if it did.