GNU R package cplexAPI: R Interface to C API of IBM ILOG CPLEX


The installation procedure for the cplexAPI package needs to know where to
find the CPLEX include directory and where to find the callable library.


# ---------------------------------------------------------------------------- #
# Linux and MacOS X installation
# ---------------------------------------------------------------------------- #

There are basically two different ways of installing the cplexAPI package:

1) Use --with-cplex-<ARG>

   --with-cplex-include=PATH    with PATH being the include directory of CPLEX

   --with-cplex-lib=PATH        with PATH being the directory containing the
                                callable library.

   R CMD INSTALL --configure-args=" \
       --with-cplex-include=/path/to/include/dir \
       --with-cplex-lib=/path/to/lib/dir" cplexAPI_X.X.X.tar.gz


   When using --with-cplex-<ARG>, both arguments must be given.

   A third argument can be used in order to use the debuging routines included
   in the C API of CPLEX:

   --with-cplex-check=PATH      with PATH being the directory containing the
                                file check.c from the CPLEX examples directory.

   The default libraries to link to are -lcplex -lm -lpthread.


2) Use of environment variables

   CPLEX_INCLUDE               giving the PATH to the include directory of CPLEX
   CPLEX_LIB                   giving the PATH to the directory containing the
                               callable library.


# ---------------------------------------------------------------------------- #
# Windows installation
# ---------------------------------------------------------------------------- #

For the installation on Windows systems the file Makewars.win in src/ is
required. The file looks like this:

PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"${CPLEX_STUDIO_DIR}\cplex\include"
PKG_LIBS=-L"${CPLEX_STUDIO_LIB32}" -L"${CPLEX_STUDIO_LIB64}" -lm -lcplex124

with the environment variable CPLEX_PATH being the installation directory
of CPLEX. This procedure was tested successfully on 32-bit Windows XP.


# ---------------------------------------------------------------------------- #

See also: http://www.stats.ox.ac.uk/~ripley/Win64/W64porting.html

If you want to have both 32- and 64 bit DLLs of libcplex in your PATH,
a good way is to set PATH in
R_HOME/etc/i386/Renviron.site for 32-bit and in
R_HOME/etc/x64/Renviron.site for 64-bit.
Also the variables CPLEX_STUDIO_DIR, CPLEX_STUDIO_LIB32 and
CPLEX_STUDIO_LIB64 can be set here.
