[R] Compiling only some C files

Lafaye de Micheaux Pierre Pierre.Lafaye-de-Micheaux at upmf-grenoble.fr
Mon Aug 11 14:17:26 CEST 2008


Dear R-users,

I am currently writing an R package that contains three C++ files in the 
src/ source directory

When i issue a R CMD check pkge_name, all the *.cpp files in the src/ 
directory will be compiled through something like (seen in 00install.out 
file):
* Installing *source* package 'pkge_name' ...
** libs
g++ -I/usr/lib/R/include -I/usr/lib/R/include  -I/usr/local/include    
-c file1.cpp -o file1.o
g++ -I/usr/lib/R/include -I/usr/lib/R/include  -I/usr/local/include    
-c file2.cpp -o file2.o
g++ -I/usr/lib/R/include -I/usr/lib/R/include  -I/usr/local/include    
-c file3.cpp -o file3.o


I would like to be able to choose which *.cpp files will be compiled and 
to exclude some *.cpp files from the compilation.
This is because some of my *.cpp files contain #include instructions 
calling some other *.cpp file.
For example, file1.cpp would contain
#include "file2.cpp"
#include "file3.cpp"

So i would like that a call to : R CMD check pkge_name
would compile only file1.cpp and so i do not want to see the following 
instructions:
g++ -I/usr/lib/R/include -I/usr/lib/R/include  -I/usr/local/include    
-c file2.cpp -o file2.o
g++ -I/usr/lib/R/include -I/usr/lib/R/include  -I/usr/local/include    
-c file3.cpp -o file3.o
but only the following one:
g++ -I/usr/lib/R/include -I/usr/lib/R/include  -I/usr/local/include    
-c file1.cpp -o file1.o
in the file 00install.out.

I tried to add some configure or Makevars.in files without success...

I hope to be clear enough.

Best regards,

Pierre Lafaye de Micheaux


-- 
Pierre Lafaye de Micheaux 

Bureau 210, bâtiment BSHM
1251 avenue centrale BP 47
38040 GRENOBLE Cedex 09
FRANCE

Tél.: 04.76.82.58.73 / Fax: 04.76.82.56.65
Pierre.Lafaye-de-Micheaux at upmf-grenoble.fr
http://www.biostatisticien.eu



More information about the R-help mailing list