Yayi logo

The project / HowToBuild ? / Samples page / History / Licence / Changes log

How to build

Forewords

Yayi is written almost entirely in ISO compliant C++ which garanty its full portability. It is developped under MacOSX and Ubuntu, and mainly tested against GCC 4.0.1 and GCC 4.4.0. However, you should be able to compile it on a recent and decent C++ compiler (Visual 2008, Intel ICC 9...) without major problems.

Yayi depends on several third party software, all coming with a non-intrusive fully free licence of use and exploitation. The dependency were choosen in such a way that they are available and fully tested on a wide range of operating systems.

These dependencies are:

Also, Yayi contains a lot of unit and regression tests. A section below is dedicated to this and explains how to run them. However, the major interest for shipping the tests with the code release lies in their instructive and didactive value. So if you are a bit curious about how things are working in Yayi in more details, this could interest you.

Compiling the third-party softwares (dependencies)

The compilation of Yayi depends on the libraries mentionned above. The prerequisites can be devided into two parts:

For Linux machines: currently the version shipped with the system is too old. So you should build it yourself. Some conflicts may occur depending on what is already installed. So please follow carrefully the instructions below.

Decompression of libPNG/JPG and Zlib

Decompress the files Yayi/plugins/external_libraries/[jpegsrc.v7.tar.gz / libpng-1.2.38-no-config.tar.bz2 / zlib-1.2.3.tar.gz] into the directory Yayi/plugins/external_libraries/
On Linux machines, this is simply:

Boost compilation

Some remarks for Linux machines:

Building Yayi

Default

The default building behaviour builds in debug mode, and tries to find Boost 1.38. It is possible to change this as explained in the following sections.

The directory where boost has been installed will be refered to as $BOOST_ROOT_DIRECTORY. Make also sure that libPNG, libJPG and Zlib were properly decompressed (see previous section). Then type the following commands:

The argument "-DBOOST_INSTALLATION_DIR=$BOOST_ROOT_DIRECTORY" tells cmake to look for boost in directory $BOOST_ROOT_DIRECTORY. You can omit this option, which in result would tell cmake to look for Boost in "Yayi/plugins/external_libraries/install_SYSTEM_ARCH", where SYSTEM is replaced by your operating system name, and ARCH by the host architecture (for intance "install__Darwin_i386").

If something go wrong ...

Make sure you have read this page properly. If the problem persists, have a look at the sections below. If it still doesn't work contact me.

If your configuration changes

... for instance the project was configured in debug and now you would like the release version:
Make sure to refresh the cmake cache. I usually prefer deleting the cache file and reconfiguring the project (the compilation is impacted only if necessay).

Setting the Boost version

In the shipped source release, the default version of Boost is "1.38". You can obviously change this by adding the following option in the cmake line:

where "XX" is your Boost version (for instance "42").

Compiling Yayi in release mode

In the same way as above, you can build Yayi in release mode, which for instance will activate some compiler optimization at the cost of loosing the debugging capabilities. This is simply done by the "CMAKE_BUILD_TYPE" option of cmake:

which of course can be cumulated with other options.

Changing the output directory

By default, the outputs are built into "Yayi/../Tmp/YAYI_SVNXXX/", where XXX is the SVN version of the release. This can be changed by setting the variable "YAYI_output_dir_base":

which of course can be cumulated with other options.

Testing Yayi

Running the tests bed of Yayi is very simple. It uses the test framework of cmake which can be run from Yayi/build. However there is a little bug in version of CMake previous to 2.8.0 for properly running these tests. A small python script addresses this issue:

For CMake versions starting from 2.8.0, you may simply type:

For Unix platforms, the dynamic libraries of Boost (usually in $BOOST_ROOT_DIRECTORY/lib) should be reachable by "ld" before running the tests, unless the tests concerning the python modules will fail. This can be done by the following commands:

For Linux:

For MAC OS X:

For Windows platforms, the same applies. The easiest is to copy the compiled Boost dynamic libraries into the destination directory.

Additional (optional) support

NumPy

Starting version v0.07, Yayi supports I/O operation from and to NumPy multidimensional arrays. This support is for the Python export only. In order to compile Yayi with the NumpPy support, you should activate the ENABLE_NUMPY compilation flag, as follow:

The NumPy library should be available in the python interpreter when cmake is executed. Yayi uses the path returned by numpy to set the include directories. An error is raised in cmake if NumPy is not found while the NumPy flag is set.

On MacOSX, NumPy is shipped in binary versions for the official python interpreter available at http://www.python.org. This means that it will NOT work with the unofficial Apple version of the interpreter. This also means that, if you choose to use NumPy, you should rebuilt Boost.Python with the official interpreter for the binaries to be properly linked against it.

HDF5

Starting from version v0.03, Yayi supports some of the many functionalities of HDF5 (for the moment just reading and writing multidimensional arrays of "native" types, considered as images). You should compile this library yourself by using the standard tools shipped with the library. Here are the commands for its compilation (Unix variant):

Then you have to configure Yayi to take into account the HDF5 library, mainly by specifying the directory of its installation and by activating the "ENABLE_HDF5" flag, as follow:

If the "-DHDF5_INSTALL_DIR" option of cmake is not provided, the path to HDF5 library is by default the same as the one used for other thirdparty libraries.