Build YafaRay on Linux

Get YafaRay source code

The source code for the Core and the Blender exporters can be found here (exporters for other 3d software can be found on the forum):

https://github.com/YafaRay

The repository is separated into several lines of development:

  • The master branches are developer branches, so they might contain some unfinished or broken features.
  • One or more branches that are used by developers to keep track of experimental features and bug fixes, before being tested and moved to mainline. Keep in mind that not every revision you could get from branches will work flawlessy or even build.

Prerequisites

Git, it's needed to download files from git repositories and keep your repository updated. Alternatively, Github also allows downloading snapshots as archives.

To get the YafaRay official source code with git, get them from git://github.com/YafaRay/Core.git. For the Core, on Linux/Unix machines usually this means you have to open a console and write:

$ git clone git://github.com/YafaRay/Core.git

and for the exporters (you need only the one corresponding to your Blender version):

$ git clone git://github.com/YafaRay/Blender-2.49-Exporter.git
$ git clone git://github.com/YafaRay/Blender-2.5-Exporter.git

At this point you should have the directories with the YafaRay source code and the exporters.

Note: The code is mainly tested on Linux (32 and 64bit) and Windows (32bit) and OS X (intel). Other platforms may require some work on configurations. For additional information about customization etc., please read the "INSTALL" in the source tree.

Build YafaRay

The YafaRay source code provides several features:

  • YafaRay libraries and binaries
  • YafaRay script language bindings (currently Python and Ruby)

Build YafaRay libraries and binaries

YafaRay libraries and binaries could be used stand alone with YafaRay XML scenes or as a library by other software. Look at LGPL licensing for that.
They will also provide the GUI to show a render in progress.

Prerequisites

Compiling YafaRay happens via cmake.

The YafaRay build system gives builders the ability to customize features. All features are enabled by default. If you want to customize them:

  1. Go into the directory CMakeConfig
  2. Copy (or rename) the file UserConfig.template to UserConfig.txt

For a specific example, if you don't need the Qt GUI, you need to disable it by changing set(WITH_QT ON) to set(WITH_QT OFF) in your UserConfig.txt.

On Linux, you should have no problem getting all the libraries via your package manager, as they are all used in well established linux applications. Just don't forget to install the developer versions (for headers and libraries) too.

Here we list all the dependencies needed for a build with all features enabled.

Dependencies (full list)

pthread (wrapper library for Windows)
libxml (for xml loader)
libjpeg
libpngOpenEXR
freetype 2

zlib

Qt

Build

At this point you should have the YafaRay sources and all dependencies needed to build YafaRay libraries and binaries. To do that you have to open a console and from the YafaRay source folder write:

$ mkdir build
$ cd build
$ cmake ..
$ make

Install

If everything worked with no errors you can install with (you could need to be root):

$ make install

By default YafaRay installs to /usr/local path, but this can be configured in UserConfig.txt.

Build YafaRay Python and Ruby bindings

YafaRay bindings are used to access YafaRay library features via other languages (used by the YafaRay exporter for Blender 2.49 for example).

Prerequisites

For building the Python bindings you will also need SWIG

Dependencies

Developer packages for whichever language bindings you want to compile.

SWIG

To build the Python bindings with Python >= 3.2, SWIG (>= 2.x) needs to be patched and built by hand until SWIG officially adopts these patches. The two necessary patches are in the git repository in the directory SupportFiles.

Quick version, enter your SWIG source code directory and apply the patches:

$ patch -p1 < swig-pycapsule.patch
$ patch -p1 < swig-pyslice.patch

See also the README in the SupportFiles directory.

The bindings are built automatically with the rest. To point CMake to the right locations for SWIG and Python, you can set several variables in CMakeConfig/UserConfig.txt:

  • YAF_PY_VERSION for the Python version (example: "3.2")
  • PYTHON_INCLUDE_DIR for the Python include directory (example: "/usr/local/include/python3.2")
  • PYTHON_LIBRARY for the Python library (.so, .dll or .dylib file)  (example: "/usr/local/lib/libpython3.2.so")
  • YAF_USER_SWIG_BIN_DIR for the directory containing the swig executable (example: "/usr/local/bin")

TODO WIN32

    Outdated from here on!

  1. If you are using the Visual Studio 8 Compiler, you can now get all libraries except Qt precompiled in SVN too:
    svn co https://ssl.little-isp.de/svn/lynx/yafaray/libs

    They were all (except libjpeg, which is from the old yafray repository) compiled with MSVC8 using dynamic runtime.

    On Windows, the librariess directory is assumed to be on the same level as the directory containing the sources. To achieve this, do the checkout commands in the same directory, for example if you do it in "C:\SomeDir" it should look something like:
    C:\SomeDir\yafaray
    C:\SomeDir\libs

Python based Blender export

The YafaRay Blender exporter project uses a SVN repository for source code. The main repository url is:

svn://svn.yafaray.org/repo/yafaray-blender

The repository is separated into several lines of development, with,

  • mainline containing the latest official exporter to be used with YafaRay official source code. It also contains official stable version at some point.
  • One or more branches that are used by developers to keep track of experimental features and bug fixes, before being tested and moved to mainline. Keep in mind that not every revision you could get from branches will work flawlessy.

Prerequisites:

Subversion or any other equivalent software. It's needed to download files from svn repositories.

 

To get the official YafaRay Blender exporter you need to use your subversion software and get them from svn://svn.yafaray.org/repo/yafaray-blender/mainline
On Linux machines usually this means you have to open a console and write:
$ svn co svn://svn.yafaray.org/repo/yafaray-blender/mainline yafaray_blender

To get the YafaRay Blender exporter experimental code you need to use subversion software and get them from one of the branches.
There is currently one branche under development:

darktide branch: this is the main branch used to keep track of experimental features and bug fixes before being tested and moved to mainline.
To get darktide branch exporter code you need to use your subversion software and get them from svn://svn.yafaray.org/repo/yafaray-blender/branches/darktide
On Linux machines usually this means you have to open a console and write:
$ svn co svn://svn.yafaray.org/repo/yafaray-blender/branches/darktide yafaray_blender

 

Install:

These scripts together allow the export from Blender. The scripts should be installed like this:

  • Linux
    Copy all scripts from the above source and the Python binding modules (all files from yafaray/bindings/python -- only available after you issued scons swig, see above) into either
    ~/.blender/scripts/yafaray
    or
    /usr/share/yafaray/blender/ (for a installation for all users). In the latter case, each user should copy the script yafaray_ui.py into ~/.blender/scripts (or you install it also globally, but must then ensure that Blender reads the directory you copy the script to as its script directory).