summaryrefslogtreecommitdiff
path: root/docs/installation.rst
blob: e6e26e2768bf84aafcd64e4fd826be19cacf2464 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
Installation
============

.. _building-from-source:

Building from source
********************

While there is a huge range of possible setups, the following steps
should work on OS X and most Linux distros.

The basic requirements are:

- cmake >= 2.8
- (optional) Python 2.x (for the Python bindings)
- (optional) Nuke 6.x (for the Nuke nodes)
- (optional) OpenImageIO (for apps including ocioconvert)
- (optional) Truelight SDK (for TruelightTransform)

To keep things simple, this guide will use the following example
paths - these will almost definitely be different for you:

- source code: ``/source/ocio``
- the temporary build location: ``/tmp/ociobuild``
- the final install directory: ``/software/ocio``

First make the build directory and cd to it::

    $ mkdir /tmp/ociobuild
    $ cd /tmp/ociobuild

Next step is to run cmake, which looks for things such as the
compiler's required arguments, optional requirements like Python,
Nuke, OpenImageIO etc

As we want to install OCIO to a custom location (instead of the
default ``/usr/local``), we will run cmake with
``CMAKE_INSTALL_PREFIX``

Still in ``/tmp/ociobuild``, run::

    $ cmake -D CMAKE_INSTALL_PREFIX=/software/ocio /source/ocio

The last argument is the location of the OCIO source code (containing
the main CMakeLists.txt file). You should see something along the
lines of::

    -- Configuring done
    -- Generating done
    -- Build files have been written to: /tmp/ociobuild

Next, build everything (with the ``-j`` flag to build using 8
threads)::

    $ make -j8

This should complete in a few minutes. Finally, install the files into
the specified location::

    $ make install

If nothing went wrong, ``/software/ocio`` should look something like
this::

    $ cd /software/ocio
    $ ls
    bin/     include/ lib/
    $ ls bin/
    ocio2icc    ociobakelut ociocheck
    $ ls include/
    OpenColorIO/   PyOpenColorIO/ pkgconfig/
    $ ls lib/
    libOpenColorIO.a      libOpenColorIO.dylib


.. _enabling-optional-components:

Enabling optional components
----------------------------

The OpenColorIO library is probably not all you want - the Python
libraries bindings, the Nuke nodes and several applications are only
built if their dependencies are found.

In the case of the Python bindings, the dependencies are the Python
headers for the version you wish to use. These may be picked up by
default - if so, when you run cmake you would see::

    -- Python 2.6 okay, will build the Python bindings against .../include/python2.6

If not, you can point cmake to correct Python executable using the
``-D PYTHON=...`` cmake flag::

    $ cmake -D PYTHON=/my/custom/python2.6 /source/ocio

Same process with Nuke (although it less likely to be picked up
automatically). Point cmake to your Nuke install directory by adding
``-D NUKE_INSTALL_PATH``::

    $ cmake -D PYTHON=/my/custom/python2.6 -D NUKE_INSTALL_PATH=/Applications/Nuke6.2v1/Nuke6.2v1.app/Contents/MacOS/ /source/ocio

The ``NUKE_INSTALL_PATH`` directory should contain the Nuke executable
(e.g Nuke6.2v1), and a ``include/`` directory containing ``DDImage/``
and others.

If set correctly, you will see something similar to::

    -- Found Nuke: /Applications/Nuke6.2v1/Nuke6.2v1.app/Contents/MacOS/include
    -- Nuke_API_VERSION: --6.2--

The Nuke plugins are installed into ``lib/nuke$MAJOR.$MINOR/``, e.g
``lib/nuke6.2/OCIODisdplay.so``


.. note::

    If you are using the Nuke plugins, you should compile the Python
    bindings for the same version of Python that Nuke uses
    internally. For Nuke 6.0 and 6.1 this is Python 2.5, and for 6.2
    it is Python 2.6

The applications included with OCIO have various dependencies - to
determine these, look at the CMake output when first run::

    -- Not building ocioconvert. Requirement(s) found: OIIO:FALSE


.. _quick-env-config:

Quick environment configuration
*******************************

The quickest way to set the required :ref:`environment-setup` is to
source the ``share/ocio/setup_ocio.sh`` script installed with OCIO.

For a simple single-user setup, add the following to ``~/.bashrc``
(assuming you are using bash, and the example install directory of
``/software/ocio``)::

    source /software/ocio/share/ocio/setup_ocio.sh

The only environment variable you must configure manually is
:envvar:`OCIO`, which points to the configuration file you wish to
use. For prebuilt config files, see the
:ref:`downloads` section

To do this, you would add a line to ``~/.bashrc`` (or a per-project
configuration script etc), for example::

    export OCIO="/path/to/my/config.ocio"


.. _nuke-configuration:

Nuke Configuration
******************

If you specified the ``NUKE_INSTALL_PATH`` option when running cmake,
you should have a ``/software/ocio/lib/nuke6.2`` directory containing
various files.

If you have followed :ref:`quick-env-config`, the plugins should be
functional. However, one common additional configuration step is to
register an OCIODisplay node for each display device/view specified in
the config.

To do this, in a menu.py on :envvar:`NUKE_PATH` (e.g
``~/.nuke/menu.py`` for a single user setup), add the following:

.. code-block:: python

    import ocionuke.viewer
    ocionuke.viewer.populate_viewer(also_remove = "default")

The ``also_remove`` argument can be set to either "default" to remove
the default sRGB/rec709 options, "all" to remove everything, or "none"
to leave existing viewer processes untouched.

Alternatively, if your workflow has different requirements, you can
copy the function and modify it as required, or use it as reference to
write your own, better viewer setup function!

.. literalinclude:: viewer.py
   :language: python


.. _environment-setup:

Environment variables
*********************

.. envvar:: OCIO

   This variable needs to point to the global OCIO config file, e.g
   ``config.ocio``

.. envvar:: DYLD_LIBRARY_PATH

    The ``lib/`` folder (containing ``libOpenColorIO.dylib``) must be
    on the ``DYLD_LIBRARY_PATH`` search path, or you will get an error
    similar to::

        dlopen(.../OCIOColorSpace.so, 2): Library not loaded: libOpenColorIO.dylib
        Referenced from: .../OCIOColorSpace.so
        Reason: image not found

    This applies to anything that links against OCIO, including the
    Nuke nodes, and the ``PyOpenColorIO`` Python bindings.

.. envvar:: LD_LIBRARY_PATH

    Equivalent to the ``DYLD_LIBRARY_PATH`` on Linux

.. envvar:: PYTHONPATH

    Python's module search path. If you are using the PyOpenColorIO
    module, you must add ``lib/python2.x`` to this search path (e.g
    ``python/2.5``), or importing the module will fail::

        >>> import PyOpenColorIO
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        ImportError: No module named PyOpenColorIO

    Note that :envvar:`DYLD_LIBRARY_PATH` or :envvar:`LD_LIBRARY_PATH`
    must be set correctly for the module to work.

.. envvar:: NUKE_PATH

    Nuke's customisation search path, where it will look for plugins,
    gizmos, init.py and menu.py scripts and other customisations.

    This should point to both ``lib/nuke6.2/`` (or whatever version
    the plugins are built against), and ``share/nuke/``