Skip to content

Commit 7f872ca

Browse files
committed
compileAttributes only after all code is generated
1 parent 8f404df commit 7f872ca

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
2017-06-02 JJ Allaire <[email protected]>
22

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

56
2017-06-01 JJ Allaire <[email protected]>
67

R/Rcpp.package.skeleton.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,13 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
138138
file.copy(file, src)
139139
message(" >> copied ", file, " to src directory" )
140140
}
141-
compileAttributes(root)
142141
}
143142

144143
if (example_code) {
145144
if (isTRUE(attributes)) {
146145
file.copy(file.path( skeleton, "rcpp_hello_world_attributes.cpp"),
147146
file.path( src, "rcpp_hello_world.cpp"))
148147
message(" >> added example src file using Rcpp attributes")
149-
compileAttributes(root)
150-
message(" >> compiled Rcpp attributes")
151-
message(" >> do NOT modify by hand either RcppExports.cpp or ",
152-
"RcppExports.R")
153148
} else {
154149
header <- readLines(file.path(skeleton, "rcpp_hello_world.h"))
155150
header <- gsub("@PKG@", name, header, fixed = TRUE)
@@ -218,6 +213,11 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
218213
rm("rcpp_hello_world", envir = env)
219214
}
220215

216+
if (attributes) {
217+
compileAttributes(root)
218+
message(" >> compiled Rcpp attributes ")
219+
}
220+
221221
invisible(NULL)
222222
}
223223

0 commit comments

Comments
 (0)