[Rcpp-commits] r4205 - in pkg/Rcpp: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 13 13:38:09 CET 2013


Author: jjallaire
Date: 2013-01-13 13:38:09 +0100 (Sun, 13 Jan 2013)
New Revision: 4205

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/R/Attributes.R
   pkg/Rcpp/TODO
Log:
add source file directory as an include path for sourceCpp

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2013-01-13 12:07:12 UTC (rev 4204)
+++ pkg/Rcpp/ChangeLog	2013-01-13 12:38:09 UTC (rev 4205)
@@ -2,8 +2,8 @@
 
         * R/Attributes.R: use plugin includes in cppFunction; stop with 
         explicit error on Windows then the Rcpl libPath or sourceCpp
-        target file contains spaces in it's path
-       
+        target file contains spaces in it's path; add source file directory
+        as an include path for sourceCpp
         * man/pluginsAttribute.Rd: clarify which fields of plugin are
         used by sourceCpp
 

Modified: pkg/Rcpp/R/Attributes.R
===================================================================
--- pkg/Rcpp/R/Attributes.R	2013-01-13 12:07:12 UTC (rev 4204)
+++ pkg/Rcpp/R/Attributes.R	2013-01-13 12:38:09 UTC (rev 4205)
@@ -514,13 +514,19 @@
     # set CLINK_CPPFLAGS based on the LinkingTo dependencies
     buildEnv$CLINK_CPPFLAGS <- .buildClinkCppFlags(linkingToPackages)
     
-    # if the source file is in a package then add standard package
-    # include directories
+    # add source file's directory to the compilation
+    srcDir <- dirname(sourceFile)
+    if (.Platform$OS.type == "windows")
+        srcDir <- utils::shortPathName(srcDir)
+    buildEnv$CLINK_CPPFLAGS <- paste(buildEnv$CLINK_CPPFLAGS, 
+                                     paste0('-I"', srcDir, '"'), 
+                                     collapse=" ")
+    
+    # if the source file is in a package then add inst/include
     if (.isPackageSourceFile(sourceFile)) {
-        srcDir <- dirname(sourceFile)
         incDir <- file.path(dirname(sourceFile), "..", "inst", "include")
         buildEnv$CLINK_CPPFLAGS <- paste(buildEnv$CLINK_CPPFLAGS, 
-                                         paste0('-I"', c(srcDir, incDir), '"'), 
+                                         paste0('-I"', incDir, '"'), 
                                          collapse=" ")
     }
 

Modified: pkg/Rcpp/TODO
===================================================================
--- pkg/Rcpp/TODO	2013-01-13 12:07:12 UTC (rev 4204)
+++ pkg/Rcpp/TODO	2013-01-13 12:38:09 UTC (rev 4205)
@@ -114,9 +114,6 @@
 
     o   Allow sourceCpp to build an entire directory
 
-    o   Use source directory as build working directory so that a) error
-        messages refer to the correct file; and b) local includes work
-
 Testing
 
     o	all r* functions : rnorm, etc ...



More information about the Rcpp-commits mailing list