Building the Pastel Matlab interface

Back to Building the Pastel library

This section describes how to build the Pastel Matlab interface. Before doing this, you must first build the Pastel library.

Build process

Matlab uses special kinds of shared libraries to extend it. These are called mex files. The build process for such files must be driven from Matlab, because this is the only way that the approriate libraries will get linked into the resulting mex library, no matter what the Matlab version. Matlab redirects the compilation and linking to an external compiler, such as Visual Studio or gcc.

1. Select a compiler

To select the compiler Matlab uses, type

mex -setup cpp

on the Matlab command line, and follow the instructions. A compiler can be used to build the Pastel Matlab interface if

Supported compilers

The list of compilers which work out-of-the-box in Matlab is given in here. However, it is not necessary for the compiler to be in this list; new compilers can unofficially be added into Matlab. This is useful, for example, when developing for a pre-release version of a new version of Visual Studio.

Bitness

Matlab 32-bit is required to build 32-bit mex files, and Matlab 64-bit is required to build 64-bit mex files. In particular, it is not possible to do 32-bit builds from Matlab 64-bit. As of Matlab 2016a, a 32-bit version of Matlab is not produced anymore.

2. Build

To build Pastel Matlab interface in Release mode, set the folder to bin/toolset/matlab, and type in Matlab command line

>> build_pastel

To build the Pastel Matlab interface in debug mode, set the folder to bin/toolset/matlab, and type in Matlab command line

>> build_pastel('mode', 'debug')

For further options, type

>> help build_pastel

Build script

The build_pastel.m file is automatically generated from the template build_pastel.template.m when building Pastel, by substituting the correct build-information.

Output files

The output will be a set of dynamic libraries (mex files), whose names without file-extensions are

The file-extension depends on the operating system, and whether the Matlab that is being used to build the mex file is 32-bit or 64-bit. The file-extensions are:

OS Bits File extension
Mac 64 .mexmaci64
Linux 64 .mexa64
Linux 32 .mexglx
Windows 64 .mexw64
Windows 32 .mexw32

Ideally, you would have all of these variations built, so that you have a version of Pastel Matlab which works in any operating system, and whether Matlab is 32-bit or 64-bit. The prebuilt Pastel Matlab is published this way.

Files

Builds Pastel Matlab mex-libraries

Forms a mex-build-command.