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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 13 22:00:52 CET 2013


Author: jjallaire
Date: 2013-01-13 22:00:52 +0100 (Sun, 13 Jan 2013)
New Revision: 4206

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/R/Attributes.R
Log:
special handling for sourceCpp include paths on windows

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2013-01-13 12:38:09 UTC (rev 4205)
+++ pkg/Rcpp/ChangeLog	2013-01-13 21:00:52 UTC (rev 4206)
@@ -3,7 +3,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; add source file directory
-        as an include path for sourceCpp
+        as an include path for sourceCpp; special handling for sourceCpp
+        include paths on windows
         * man/pluginsAttribute.Rd: clarify which fields of plugin are
         used by sourceCpp
 
@@ -1033,7 +1034,7 @@
 2012-05-09  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Expanded R CMD SHLIB discussion
-	after suggested changes from Søren Højsgaard; also expanded compiler
+	after suggested changes from SC8ren HC8jsgaard; also expanded compiler
 	section a little mentioning clang/clang++ and icc.
 
 2012-05-02  Dirk Eddelbuettel  <edd at debian.org>
@@ -1727,8 +1728,8 @@
 2010-12-13  Romain Francois <romain at r-enthusiasts.com>
 
 	* inst/include/Rcpp/vector/string_proxy.h: List::Proxy did not
-	convert bool correctly, reported on Rcpp-devel by Daniel Sabanés
-	Bové <daniel.sabanesbove at ifspm.uzh.ch>
+	convert bool correctly, reported on Rcpp-devel by Daniel SabanC)s
+	BovC) <daniel.sabanesbove at ifspm.uzh.ch>
 
 2010-12-12  Romain Francois <romain at r-enthusiasts.com>
 

Modified: pkg/Rcpp/R/Attributes.R
===================================================================
--- pkg/Rcpp/R/Attributes.R	2013-01-13 12:38:09 UTC (rev 4205)
+++ pkg/Rcpp/R/Attributes.R	2013-01-13 21:00:52 UTC (rev 4206)
@@ -37,9 +37,9 @@
     
     # validate that there are no spaces in the path on windows
     if (.Platform$OS.type == "windows") {
-        if (grepl(' ', path.package("Rcpp"), fixed=TRUE)) {
+        if (grepl(' ', find.package("Rcpp"), fixed=TRUE)) {
             stop("Rcpp is installed within a package library that has spaces ",
-                 "in it's path (", path.package("Rcpp"), "). Rcpp cannot be ",
+                 "in it's path (", find.package("Rcpp"), "). Rcpp cannot be ",
                  "built against in this configuration. Please re-install ",
                  "Rcpp in a package library without spaces in it's path.")
         }
@@ -439,6 +439,20 @@
              error = function(e) NULL) 
 }
 
+# Function to normalize build paths for passing to gcc on the command line
+# Leave them alone for posix (they'll be quoted). For Windows, mirror the
+# behavior of the R package build system by taking the fully resolved
+# absolute path (as a short path name) then convert backslashes to forward
+# slashes.
+.asBuildPath <- function(path) {
+    if (.Platform$OS.type == "windows") {
+        path <- normalizePath(path)
+        path <- utils::shortPathName(path)
+        path <- gsub("\\\\", "/", path)
+    }
+    return(path)
+}
+
 # Setup the build environment based on the specified dependencies. Returns an
 # opaque object that can be passed to .restoreEnvironment to reverse whatever
 # changes that were made
@@ -515,9 +529,7 @@
     buildEnv$CLINK_CPPFLAGS <- .buildClinkCppFlags(linkingToPackages)
     
     # add source file's directory to the compilation
-    srcDir <- dirname(sourceFile)
-    if (.Platform$OS.type == "windows")
-        srcDir <- utils::shortPathName(srcDir)
+    srcDir <- .asBuildPath(dirname(sourceFile))
     buildEnv$CLINK_CPPFLAGS <- paste(buildEnv$CLINK_CPPFLAGS, 
                                      paste0('-I"', srcDir, '"'), 
                                      collapse=" ")
@@ -525,6 +537,7 @@
     # if the source file is in a package then add inst/include
     if (.isPackageSourceFile(sourceFile)) {
         incDir <- file.path(dirname(sourceFile), "..", "inst", "include")
+        incDir <- .asBuildPath(incDir)
         buildEnv$CLINK_CPPFLAGS <- paste(buildEnv$CLINK_CPPFLAGS, 
                                          paste0('-I"', incDir, '"'), 
                                          collapse=" ")



More information about the Rcpp-commits mailing list