[Rcpp-commits] r4271 - in pkg/Rcpp: . R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 24 11:10:45 CET 2013


Author: jjallaire
Date: 2013-02-24 11:10:45 +0100 (Sun, 24 Feb 2013)
New Revision: 4271

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/R/Attributes.R
   pkg/Rcpp/inst/NEWS.Rd
Log:
Add global package include file to RcppExports.cpp if it exists

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2013-02-21 02:53:55 UTC (rev 4270)
+++ pkg/Rcpp/ChangeLog	2013-02-24 10:10:45 UTC (rev 4271)
@@ -1,3 +1,8 @@
+2013-02-24 JJ Allaire <jj at rstudio.org>
+
+        * R/Attributes.R: add global package include file to RcppExports.cpp
+        if it exists
+
 2013-02-19 Romain Francois <romain at r-enthusiasts.com>
 
         * src/api.cpp : more debugging

Modified: pkg/Rcpp/R/Attributes.R
===================================================================
--- pkg/Rcpp/R/Attributes.R	2013-02-21 02:53:55 UTC (rev 4270)
+++ pkg/Rcpp/R/Attributes.R	2013-02-24 10:10:45 UTC (rev 4271)
@@ -332,6 +332,15 @@
     linkingTo <- as.character(pkgInfo$DESCRIPTION["LinkingTo"])
     includes <- .linkingToIncludes(linkingTo, TRUE)
     
+    # if a master include file is defined for the package then include it
+    pkgHeader <- paste(pkgname, ".h", sep="")
+    pkgHeaderPath <- file.path(pkgdir, "inst", "include",  pkgHeader)
+    if (file.exists(pkgHeaderPath)) {
+        pkgInclude <- paste("#include \"../inst/include/", 
+                            pkgHeader, "\"", sep="")
+        includes <- c(includes, pkgInclude)
+    } 
+    
     # generate exports
     invisible(.Call("compileAttributes", PACKAGE="Rcpp", 
                     pkgdir, pkgname, depends, cppFiles, cppFileBasenames, 

Modified: pkg/Rcpp/inst/NEWS.Rd
===================================================================
--- pkg/Rcpp/inst/NEWS.Rd	2013-02-21 02:53:55 UTC (rev 4270)
+++ pkg/Rcpp/inst/NEWS.Rd	2013-02-24 10:10:45 UTC (rev 4271)
@@ -19,6 +19,8 @@
         the use of C++11 in a translation unit
         \item Merge existing values of build related environment 
         variables for sourceCpp
+        \item Add global package include file to RcppExports.cpp
+        if it exists
         \item Stop with an error if the file name passed to 
         \code{sourceCpp} has spaces in it
         \item Return invisibly from void functions



More information about the Rcpp-commits mailing list