[Rcpp-commits] r764 - in pkg/RcppArmadillo: R inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Feb 22 11:23:08 CET 2010
Author: romain
Date: 2010-02-22 11:23:08 +0100 (Mon, 22 Feb 2010)
New Revision: 764
Modified:
pkg/RcppArmadillo/R/flags.R
pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R
Log:
try to set the flags
Modified: pkg/RcppArmadillo/R/flags.R
===================================================================
--- pkg/RcppArmadillo/R/flags.R 2010-02-21 19:37:27 UTC (rev 763)
+++ pkg/RcppArmadillo/R/flags.R 2010-02-22 10:23:08 UTC (rev 764)
@@ -16,27 +16,28 @@
## You should have received a copy of the GNU General Public License
## along with RcppArmadillo. If not, see <http://www.gnu.org/licenses/>.
-.__CxxFlags <- function(Rcpp = TRUE, ...){
+RcppArmadilloCxxFlags <- function(Rcpp = TRUE, ...){
rcpp <- ifelse(Rcpp, Rcpp:::RcppCxxFlags(...), "")
arma <- system.file("include", package = "RcppArmadillo")
if (.Platform$OS.type=="windows")
arma <- paste('"', arma, '"', sep="")
-
- res <- sprintf('%s -I%s', rcpp, arma)
+
+ res <- sprintf('%s -I%s -I/usr/include ', rcpp, arma)
}
-.__LdFlags <- function(Rcpp = TRUE, ...){
- rcpp <- ifelse( Rcpp, Rcpp:::LdFlags(...) , "" )
- arma <- c("-larmadillo" )
- paste( rcpp, arma, sep = " " )
+CxxFlags <- function(Rcpp = TRUE, ...){
+ cat( RcppArmadilloCxxFlags(Rcpp = Rcpp, ...), sep = " " )
}
-CxxFlags <- function(Rcpp = TRUE, ...){
- cat( .__CxxFlags(Rcpp = Rcpp, ...), sep = " " )
+
+RcppArmadilloLdFlags <- function(Rcpp = TRUE, ...){
+ rcpp <- ifelse( Rcpp, Rcpp:::RcppLdFlags(static= !grepl("^linux",R.version$os) ) , "" )
+ arma <- c("-L/usr/lib -larmadillo" )
+ paste( rcpp, arma, "", sep = " " )
}
LdFlags <- function(Rcpp = TRUE, ...){
- cat( .__LdFlags(Rcpp, ... ), sep = "" )
+ cat( RcppArmadilloLdFlags(Rcpp, ... ), sep = "" )
}
## no ldflags as user packages would not need to link to RcppArmadillo.so
Modified: pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R
===================================================================
--- pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2010-02-21 19:37:27 UTC (rev 763)
+++ pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2010-02-22 10:23:08 UTC (rev 764)
@@ -1,8 +1,29 @@
+#!/usr/bin/r -t
+#
+# Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
+#
+# This file is part of RcppArmadillo.
+#
+# RcppArmadillo is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# RcppArmadillo is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with RcppArmadillo. If not, see <http://www.gnu.org/licenses/>.
+.setUp <- function(){
+ suppressMessages( require( inline ) )
+}
+
test.wrap.R <- function(){
src <- '
-SEXP RcppArmadilloExample(){
using namespace Rcpp ;
using namespace arma ;
@@ -90,8 +111,10 @@
return output ;'
funx <- cfunction( signature(), src,
- cxxargs = RcppArmadillo:::CxxFlags(),
- libargs = "-larmadillo" )
+ cxxargs = RcppArmadillo:::RcppArmadilloCxxFlags(),
+ libargs = RcppArmadillo:::RcppArmadilloLdFlags(),
+ Rcpp = FALSE,
+ includes = c("#include <RcppArmadillo.h>", "using namespace Rcpp; ", "using namespace arma;") )
}
More information about the Rcpp-commits
mailing list