Skip to content

Commit

Permalink
compileAttributes only after all code is generated
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Jun 2, 2017
1 parent 8f404df commit 7f872ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions ChangeLog
@@ -1,6 +1,7 @@
2017-06-02 JJ Allaire <jj@rstudio.com>

* src/attributes.cpp: Automatically register init functions for RcppModules
* R/Rcpp.package.skeleton.R: compileAttributes only after all code is generated

2017-06-01 JJ Allaire <jj@rstudio.com>

Expand Down
10 changes: 5 additions & 5 deletions R/Rcpp.package.skeleton.R
Expand Up @@ -138,18 +138,13 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
file.copy(file, src)
message(" >> copied ", file, " to src directory" )
}
compileAttributes(root)
}

if (example_code) {
if (isTRUE(attributes)) {
file.copy(file.path( skeleton, "rcpp_hello_world_attributes.cpp"),
file.path( src, "rcpp_hello_world.cpp"))
message(" >> added example src file using Rcpp attributes")
compileAttributes(root)
message(" >> compiled Rcpp attributes")
message(" >> do NOT modify by hand either RcppExports.cpp or ",
"RcppExports.R")
} else {
header <- readLines(file.path(skeleton, "rcpp_hello_world.h"))
header <- gsub("@PKG@", name, header, fixed = TRUE)
Expand Down Expand Up @@ -218,6 +213,11 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
rm("rcpp_hello_world", envir = env)
}

if (attributes) {
compileAttributes(root)
message(" >> compiled Rcpp attributes ")
}

invisible(NULL)
}

Expand Down

0 comments on commit 7f872ca

Please sign in to comment.