[Rcpp-commits] r4254 - in pkg/Rcpp: . R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Feb 15 12:00:15 CET 2013
Author: jjallaire
Date: 2013-02-15 12:00:14 +0100 (Fri, 15 Feb 2013)
New Revision: 4254
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/R/Attributes.R
pkg/Rcpp/TODO
pkg/Rcpp/inst/NEWS.Rd
Log:
Merge existing values of build related environment variables for sourceCpp
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2013-02-12 15:52:30 UTC (rev 4253)
+++ pkg/Rcpp/ChangeLog 2013-02-15 11:00:14 UTC (rev 4254)
@@ -1,3 +1,8 @@
+2013-02-15 JJ Allaire <jj at rstudio.org>
+
+ * R/Attributes.R: Merge existing values of build related
+ environment variables for sourceCpp
+
2013-02-12 Romain Francois <romain at r-enthusiasts.com>
* src/api.cpp : More careful about RCPP_PROTECTION_STACK init
Modified: pkg/Rcpp/R/Attributes.R
===================================================================
--- pkg/Rcpp/R/Attributes.R 2013-02-12 15:52:30 UTC (rev 4253)
+++ pkg/Rcpp/R/Attributes.R 2013-02-15 11:00:14 UTC (rev 4254)
@@ -438,10 +438,32 @@
# changes that were made
.setupBuildEnvironment <- function(depends, plugins, sourceFile) {
- # discover dependencies
+ # setup
buildEnv <- list()
linkingToPackages <- c("Rcpp")
+ # merge values into the buildEnv
+ mergeIntoBuildEnv <- function(name, value) {
+
+ # protect against null or empty string
+ if (is.null(value) || !nzchar(value))
+ return;
+
+ # if it doesn't exist already just set it
+ if (is.null(buildEnv[[name]])) {
+ buildEnv[[name]] <<- value
+ }
+ # if it's not identical then append
+ else if (!identical(buildEnv[[name]], value)) {
+ buildEnv[[name]] <<- paste(buildEnv[[name]], value);
+ }
+ else {
+ # it already exists and it's the same value, this
+ # likely means it's a flag-type variable so we
+ # do nothing rather than appending it
+ }
+ }
+
# update dependencies from a plugin
setDependenciesFromPlugin <- function(plugin) {
@@ -451,21 +473,7 @@
# merge environment variables
pluginEnv <- settings$env
for (name in names(pluginEnv)) {
- # if it doesn't exist already just set it
- if (is.null(buildEnv[[name]])) {
- buildEnv[[name]] <<- pluginEnv[[name]]
- }
- # if it's not identical then append
- else if (!identical(buildEnv[[name]],
- pluginEnv[[name]])) {
- buildEnv[[name]] <<- paste(buildEnv[[name]],
- pluginEnv[[name]]);
- }
- else {
- # it already exists and it's the same value, this
- # likely means it's a flag-type variable so we
- # do nothing rather than appending it
- }
+ mergeIntoBuildEnv(name, pluginEnv[[name]])
}
# capture any LinkingTo elements defined by the plugin
@@ -520,6 +528,10 @@
collapse=" ")
}
+ # merge existing environment variables
+ for (name in names(buildEnv))
+ mergeIntoBuildEnv(name, Sys.getenv(name))
+
# add cygwin message muffler
buildEnv$CYGWIN = "nodosfilewarning"
Modified: pkg/Rcpp/TODO
===================================================================
--- pkg/Rcpp/TODO 2013-02-12 15:52:30 UTC (rev 4253)
+++ pkg/Rcpp/TODO 2013-02-15 11:00:14 UTC (rev 4254)
@@ -120,6 +120,9 @@
o Support persistence of sourceCpp created functions across sessions
(either via long-lived temp dir or via environment persistence)
+ o Additional high-level mechanism for specifying additional build
+ configuration (perhaps cxxflags and libs attributes)
+
Testing
o all r* functions : rnorm, etc ...
Modified: pkg/Rcpp/inst/NEWS.Rd
===================================================================
--- pkg/Rcpp/inst/NEWS.Rd 2013-02-12 15:52:30 UTC (rev 4253)
+++ pkg/Rcpp/inst/NEWS.Rd 2013-02-15 11:00:14 UTC (rev 4254)
@@ -17,6 +17,8 @@
the new \code{registerPlugin} function.
\item Added built-in \code{cpp11} plugin for specifying
the use of C++11 in a translation unit
+ \item Merge existing values of build related environment
+ variables for sourceCpp
\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