[Rcpp-devel] [RcppExamples] -- would someone share the makefile?

Dirk Eddelbuettel edd at debian.org
Sat Aug 21 19:52:56 CEST 2010


On 21 August 2010 at 18:36, Johannes Egner wrote:
| Hi,
| 
| I am (slowly and carefully) learning about Rcpp, and thought that compiling
| the code in the RcppExamples package could be a good start.
| 
| MSVC seems to be out of the game (at least as far as the compiler is
| concerned; using it as an editor may be another story), and it seems I
| cannot avoid using MinGW and those mysterious makefiles anymore. Would
| anyone care to send me a makefile that was used to compile the mentioned
| examples, please? (I know it needs modifying -- I'll use it as a template to
| see what I need to learn about makefiles for now.)

There are no Makefiles. 

It all works through the magic of the R package system. Witmess:

edd at max:/tmp$ 
edd at max:/tmp$ 
edd at max:/tmp$ wget http://cran.us.r-project.org/src/contrib/RcppExamples_0.1.1.tar.gz
--2010-08-21 12:40:24--  http://cran.us.r-project.org/src/contrib/RcppExamples_0.1.1.tar.gz
Resolving cran.us.r-project.org... 140.107.3.21
Connecting to cran.us.r-project.org|140.107.3.21|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14446 (14K) [application/x-gzip]
Saving to: `RcppExamples_0.1.1.tar.gz'

100%[======================================>] 14,446      74.5K/s   in 0.2s    

2010-08-21 12:40:24 (74.5 KB/s) - `RcppExamples_0.1.1.tar.gz' saved [14446/14446]

edd at max:/tmp$ R CMD INSTALL RcppExamples_0.1.1.tar.gz 
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘RcppExamples’ ...
** libs
g++ -I/usr/share/R/include   -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -O3 -g0 -Wall -pipe  -c RcppDateExample.cpp -o RcppDateExample.o
g++ -I/usr/share/R/include   -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -O3 -g0 -Wall -pipe  -c RcppExample.cpp -o RcppExample.o
g++ -I/usr/share/R/include   -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -O3 -g0 -Wall -pipe  -c RcppMatrixExample.cpp -o RcppMatrixExample.o
g++ -I/usr/share/R/include   -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -O3 -g0 -Wall -pipe  -c RcppParamsExample.cpp -o RcppParamsExample.o
g++ -I/usr/share/R/include   -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -O3 -g0 -Wall -pipe  -c RcppStringVectorExample.cpp -o RcppStringVectorExample.o
g++ -I/usr/share/R/include   -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -O3 -g0 -Wall -pipe  -c RcppVectorExample.cpp -o RcppVectorExample.o
g++ -shared -o RcppExamples.so RcppDateExample.o RcppExample.o RcppMatrixExample.o RcppParamsExample.o RcppStringVectorExample.o RcppVectorExample.o -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/lib64/R/lib -lR
installing to /usr/local/lib/R/site-library/RcppExamples/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded

* DONE (RcppExamples)
edd at max:/tmp$ 
edd at max:/tmp$ 

Those two commands would be identical for you on Windows (provided you
installed wget and of course the Rtools needed to compile R packages).

We have a vignette Rcpp-package that has more on how to use Rcpp et al in
your package.  You can of course also just copy RcppExamples and start from
there.  And/or use Rcpp.package.skeleton().

Hope this helps,  Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list