Skip to content

Commit 9328a00

Browse files
committed
initial work on local includes
1 parent 1ad7e3a commit 9328a00

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

R/Attributes.R

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -624,17 +624,23 @@ sourceCppFunction <- function(func, isVoid, dll, symbol) {
624624
# set CLINK_CPPFLAGS based on the LinkingTo dependencies
625625
buildEnv$CLINK_CPPFLAGS <- .buildClinkCppFlags(linkingToPackages)
626626

627-
# if the source file is in a package then add src and inst/include
627+
# add the source file's directory to the compliation
628+
srcDir <- dirname(sourceFile)
629+
srcDir <- asBuildPath(srcDir)
630+
buildDirs <- srcDir
631+
632+
# if the source file is in a package then add inst/include
628633
if (.isPackageSourceFile(sourceFile)) {
629-
srcDir <- dirname(sourceFile)
630-
srcDir <- asBuildPath(srcDir)
631634
incDir <- file.path(dirname(sourceFile), "..", "inst", "include")
632635
incDir <- asBuildPath(incDir)
633-
dirFlags <- paste0('-I"', c(srcDir, incDir), '"', collapse=" ")
634-
buildEnv$CLINK_CPPFLAGS <- paste(buildEnv$CLINK_CPPFLAGS,
635-
dirFlags,
636-
collapse=" ")
636+
buildDirs <- c(buildDirs, incDir)
637637
}
638+
639+
# set CLINK_CPPFLAGS with directory flags
640+
dirFlags <- paste0('-I"', buildDirs, '"', collapse=" ")
641+
buildEnv$CLINK_CPPFLAGS <- paste(buildEnv$CLINK_CPPFLAGS,
642+
dirFlags,
643+
collapse=" ")
638644

639645
# merge existing environment variables
640646
for (name in names(buildEnv))

0 commit comments

Comments
 (0)