[Rd] C macros and Makevars/package building
Kasper Daniel Hansen
khansen at stat.Berkeley.EDU
Fri Sep 9 06:50:29 CEST 2005
Hi
We are currently embedding a rather large C++ library in R (BioC),
and we want some comments on the portability of how we have approach
this.
First of, we are not really able to do much about the portability of
the basic library, which of course is the main question :) We have an
approach which seems to work, I just want a bit of feedback on it....
The way we integrate it into R is simply by having a subdirectory /
src/sdk together with a Makevars file. This file basically looks like
PKG_CPPFLAGS+=\
-imacros R_affx_constants.h\
-Isdk/files\
(... + a lot of other -I statements telling CPP to include
subdirectories of src/sdk)
Then we have a
SOURCES.SDK = \
sdk/files/FileIO.cpp \
(... + a lot of other .cpp files)
SOURCES.OURS = \
R_affx_cdf.cpp
and then finally a
OBJS=$(SOURCES.SDK:.cpp=.o) $(SOURCES.OURS:cpp:.o)
We seem to need the last statement since it seems that .cpp is not
automatically a C++ suffix (but is it done the "right" way for
portability?). We need the -imacro statement in order to include some
macros from Rconfig.h (big endian checks) which are then translated
from the WORDS_BIGENDIAN used in R to the IS_BIG_ENDIAN used in the
library.
Comments on the portability?
Kasper
More information about the R-devel
mailing list