[Pomp-commits] r245 - pkg/inst/examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 17 23:48:42 CEST 2010


Author: kingaa
Date: 2010-05-17 23:48:41 +0200 (Mon, 17 May 2010)
New Revision: 245

Modified:
   pkg/inst/examples/euler_sir.R
Log:
- slight change to euler_sir example


Modified: pkg/inst/examples/euler_sir.R
===================================================================
--- pkg/inst/examples/euler_sir.R	2010-05-17 17:50:28 UTC (rev 244)
+++ pkg/inst/examples/euler_sir.R	2010-05-17 21:48:41 UTC (rev 245)
@@ -103,16 +103,15 @@
   model <- "sir"
   pkg <- "pomp"
   modelfile <- paste(model,".c",sep="")
-  headerfile <- system.file("include/pomp.h",package=pkg)
+  cppflags <- paste("PKG_CPPFLAGS=-I",system.file("include",package=pkg),sep="")
   pkglib <- system.file(paste("libs/",pkg,.Platform$dynlib.ext,sep=""),package=pkg)
   solib <- paste(model,.Platform$dynlib.ext,sep="")
 
   ## compile the model into a shared-object library
   if (!file.copy(from=system.file(paste("examples/",modelfile,sep=""),package=pkg),to=getwd()))
     stop("cannot copy source code ",modelfile," to ",getwd())
-  if (!file.copy(from=headerfile,to=getwd()))
-    stop("cannot copy header ",headerfile," to ",getwd())
-  rv <- system(paste(R.home("bin/R"),"CMD SHLIB -o",solib,modelfile,pkglib))
+  cmd <- paste(cppflags,R.home("bin/R"),"CMD SHLIB -o",solib,modelfile,pkglib)
+  rv <- system(cmd)
   if (rv!=0)
     stop("cannot compile shared-object library ",solib)
 



More information about the pomp-commits mailing list