Skip to content

Commit 5778be1

Browse files
committed
Add argument scanHeaderFiles to compileAttributes
1 parent 63d2cbc commit 5778be1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

R/Attributes.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ areMacrosDefined <- function(names,
340340

341341
# Scan the source files within a package for attributes and generate code
342342
# based on the attributes.
343-
compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
343+
compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose"),
344+
scanHeaderFiles = FALSE) {
344345

345346
# verify this is a package and read the DESCRIPTION to get it's name
346347
pkgdir <- normalizePath(pkgdir, winslash = "/")
@@ -366,8 +367,11 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
366367
dir.create(rDir)
367368

368369
# get a list of all source files
369-
cppFiles <- list.files(srcDir, pattern="\\.c(c|pp)$")
370-
370+
if (scanHeaderFiles)
371+
cppFiles <- list.files(srcDir, pattern = "\\.(c(c|pp))|(h(pp)?)$")
372+
else
373+
cppFiles <- list.files(srcDir, pattern="\\.c(c|pp)$")
374+
371375
# derive base names (will be used for modules)
372376
cppFileBasenames <- tools::file_path_sans_ext(cppFiles)
373377

0 commit comments

Comments
 (0)