Skip to content

Commit

Permalink
Enable control over debug for compile_dll (#100)
Browse files Browse the repository at this point in the history
Co-authored-by: Jim Hester <james.f.hester@gmail.com>
  • Loading branch information
richfitz and jimhester authored Oct 16, 2020
1 parent 3e31f39 commit d9717aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pkgbuild (development version)

* `compile_dll()` gains a `debug` argument for more control over the compile options used (@richfitz, #100)
* `pkgbuild_process()` and `build()` now use colored compiler diagnostics if supported (#102)

# pkgbuild 1.1.0
Expand Down
9 changes: 7 additions & 2 deletions R/compile-dll.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
#' @inheritParams build
#' @param force If `TRUE`, for compilation even if [needs_compile()] is
#' `FALSE`.
#' @param debug If `TRUE`, and if no user Makevars is found, then the build
#' runs without optimisation (`-O0`) and with debug symbols (`-g`). See
#' [compiler_flags()] for details. If you have a user Makevars (e.g.,
#' `~/.R/Makevars`) then this argument is ignored.
#' @seealso [clean_dll()] to delete the compiled files.
#' @export
compile_dll <- function(path = ".",
force = FALSE,
compile_attributes = pkg_links_to_cpp11(path) || pkg_links_to_rcpp(path),
register_routines = FALSE,
quiet = FALSE) {
quiet = FALSE,
debug = TRUE) {
path <- pkg_path(path)

if (!needs_compile(path) && !isTRUE(force)) {
Expand Down Expand Up @@ -49,7 +54,7 @@ compile_dll <- function(path = ".",
)
} else {
# Otherwise set makevars for fast development / debugging
withr::with_makevars(compiler_flags(TRUE), assignment = "+=", {
withr::with_makevars(compiler_flags(debug), assignment = "+=", {
install_min(
path,
dest = install_dir,
Expand Down
8 changes: 7 additions & 1 deletion man/compile_dll.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d9717aa

Please # to comment.