Philippe,
On 29 June 2009 at 19:59, Philippe Grosjean wrote:
| Its a couple of days I am fighting with this problem, and cannot find a
| solution. I need to compile a DLL that is not directly used by R, but
| must be installed elsewhere (it is indeed part of a Tcl/Tk package). So,
| I want to install it in /tklibs/tkpackage/alib.dll (under Windows) in my
| compiled package.
|
| I do manage to compile it in /src, but cannot copy it at the right
| place. I tried using a cleanup.win file that contains:
|
| cp src/alib.dll "${R_PACKAGE_DIR}/tklibs/tkpackage/alib.dll"
|
| but it does not work. The Writing R extensions manual explicitly says
| not to use ${DPKG}. Yet, the following instruction does the job under R
| 2.8.0:
|
| cp src/alib.dll "${DPKG}/tklibs/tkpackage/alib.dll"
|
| I become really desperate to get it working!
| Thanks for help.
I think I am doing something similar to what you are trying to do inside the
Rcpp package [cf r-forge]. There my goal is to provide a package for
'external linking' and I do this in via src/Makevars:
1) Main target is 'all:' and includes the SHLIB the package would build
any
way, as well as an added target userLibrary:
2) Couple of variable including an extension for the shared lib which gets
filled only on OS X
3) In the userLibrary target, create (if need be) the target dir and copy
the previously created library over.
4) Targets for the shared and static user library that userLibrary target
depends upon.
This is essentially the same under Windows. Credit for a lot of this setup
goes to Simon who helped with this while addressing an issue I had on OS X.
Hope this helps, Dirk
all: $(SHLIB) userLibrary
USERLIB = libRcpp$(DYLIB_EXT)
USERLIBST = libRcpp.a
USERDIR = ../inst/lib
userLibrary: $(USERLIB) $(USERLIBST)
- at if test ! -e $(USERDIR)$(R_ARCH); then mkdir -p
$(USERDIR)$(R_ARCH); fi
cp $(USERLIB) $(USERDIR)$(R_ARCH)
cp Rcpp.h $(USERDIR)$(R_ARCH)
cp $(USERLIBST) $(USERDIR)$(R_ARCH)
rm $(USERLIB) $(USERLIBST)
$(USERLIB): Rcpp.o
$(SHLIB_CXXLD) -o $(USERLIB) $^ $(SHLIB_CXXLDFLAGS) $(ALL_LIBS)
@if test -e "/usr/bin/install_name_tool"; then
/usr/bin/install_name_tool -id $(R_PACKAGE_DIR)/lib$(R_ARCH)/$(USERLIB)
$(USERLIB); fi
$(USERLIBST): Rcpp.o
$(AR) qc $(USERLIBST) Rcpp.o
@if test -n "$(RANLIB)"; then $(RANLIB) $(USERLIBST);
fi
.PHONY: all clean userLibrary
clean:
rm -f $(OBJECTS) $(SHLIB) $(USERLIB) $(USERLIBST)
--
Three out of two people have difficulties with fractions.