Subsections

Build

labCA comes with a `configure' subdirectory and Makefiles conforming to the EPICS build system. Following a configuration step which involves editing two small files, 'make' is executed to install the generated libraries and scripts.

Prior to invoking the scilab or matlab application, the system must be properly set up in order for the applications to locate the labCA and channel access libraries.

Prerequisites

labCA needs an EPICS BASE installation that was built with shared libraries enabled10. The main reason being that matlab's mex files cannot have multiple entry points. Hence, when statically linking multiple mex files against ezca, ca, Com etc. multiple copies of those libraries would end up in the running matlab application with possible adverse effects. It should be possible to build and use the scilab interface with static libraries — minor tweaks to the Makefiles might be necessary.

labCA has been tested with matlab-6.5, matlab-7.0 and scilab-2.7 .. scilab-5.3 under a variety of EPICS releases up to 7.0.4.1 on linux-x86, linux-ppc, solaris-sparc-gnu, linux-x86_64, solaris-sparc, solaris-sparc64 and win32/6411.

Building the documentation (on- and off-line) requires the pdflatex, latex2html and lynx software. If any of these is missing then labCA is still built but no documentation is generated. Note that tagged releases on github usually come with pre-built documentation.

Configuration

Two files, `configure/CONFIG' and `configure/RELEASE' need to be adapted to the user's installation:
CONFIG:
A handful of configuration parameters must be defined in this file.
MAKEFOR:
Setting the MAKEFOR variable determines the target application program the interface library is built for. Valid settings are MAKEFOR=SCILAB or MAKEFOR=MATLAB. Any setting other than MATLAB is treated like SCILAB.

CONFIG_USE_CTRLC:
Set this to YES or NO to enable or disable, respectively, code for handling “Ctrl-C” keystroke sequences. When enabled, labCA operations (except for lcaDelay) may be aborted by hitting “Ctrl-C”. Note that labCA polls for an “abort condition” with a granularity of the ezca timeout parameter. Unfortunately, neither matlab nor scilab feature a documented API for handling Ctrl-C events and therefore Ctrl-C support — the implementation using undocumented features of scilab and matlab — must be considered “experimental” i.e., it might cause problems on certain operating system and/or scilab/matlab versions.

INSTALL_LOCATION:
Set this variable to install in a location different from the labCA top directory. NOTE: This method has been deprecated. Use INSTALL_LOCATION_APP in the RELEASE file instead.
RELEASE:
In this file, paths to the EPICS base (`EPICS_BASE' variable) and scilab (`SCILABDIR' variable) or matlab (`MATLABDIR' variable) installations must be specified.

Under win32/64, an additional variable `MATLIB_SUBDIR' must be set directing the build process to select the correct libmx.lib and libmex.lib library variants. The setting of this variable is compiler dependent.

INSTALL_LOCATION_APP=<path>
<path> defining the install location of the labCA package. If unset, the labCA TOP directory will be used.
MATLABDIR=<path>
<path> defining the matlab installation directory where the `extern' subdirectory can be found (e.g. /opt/matlabR14beta2).
SCILABDIR=<path>
<path> defining the scilab installation directory where the `routines' subdirectory can be found (e.g. /usr/lib/scilab-2.7). However, scilab-5 does not use a routines subdirectory anymore. SCILABDIR must point to the directory where relevant headers such as mex.h etc. are found under $(SCILABDIR)/include/scilab/. E.g., if there is /usr/include/scilab/mex.h then set SCILABDIR=/usr.
MATLIB_SUBDIR=<pathelem>
<pathelem> chosing the subdirectory corresponding to the C-compiler that is used for the build. (e.g. win32/microsoft/msvc60 for the microsoft visual c++ 6.0 compiler). The libmex.lib and libmx.lib files for the applicable compiler are found there.
Any irrelevant variables (such as MATLABDIR if MAKEFOR=SCILAB) are ignored.

Note that the EPICS build system has problems with path names containing white space as they are commonly used on win32/64. Although I have tried to work around this, you still might encounter problems. I found that setting the environment variable MATLAB to point to the matlab directory helped (cygwin). It is best to avoid white space in path names, however. This can be achieved by using symbolic links under recent win32/64(but this unfortunately requires special privileges), re-mounting as a network drive or simpy copying relevant headers and libraries to a secondary, white-space free “work-directory hierarchy”.

Building labCA

After setting the `EPICS_HOST_ARCH' environment variable, GNU make is invoked from the labCA top directory. Note that the compiler toolchain must be found in the system PATH12.



Footnotes

... enabled10
To be precise: only labCA needs to be a shared library (but must then have EPICS BASE linked in); we recommend an EPICS BASE installation with shared libraries enabled because modifications to the EPICS Makefiles are required to build a shared labCA library that is linked against static versions of EPICS BASE.
...win32/6411
Note that not all possible combinations have been tested with the latest labCA release but rather the latest versions of the respective components on the platforms that are in the distribution.
... style="font-family:monospace">PATH12
Under win32/64, the msvc compiler features a .BAT file for setting up the necessary environment.