/docs/installation.rst

http://github.com/imageworks/OpenColorIO · ReStructuredText · 486 lines · 338 code · 148 blank · 0 comment · 0 complexity · 5137fa8f49f21e24f8bf900242dd35b3 MD5 · raw file

  1. ..
  2. SPDX-License-Identifier: CC-BY-4.0
  3. Copyright Contributors to the OpenColorIO Project.
  4. .. _installation:
  5. Installation
  6. ============
  7. The easy way
  8. ************
  9. While prebuilt binaries are not yet available for all platforms, OCIO
  10. is available via several platform's package managers.
  11. Fedora and RHEL
  12. ^^^^^^^^^^^^^^^
  13. In Fedora Core 15 and above, the following command will install OpenColorIO::
  14. yum install OpenColorIO
  15. Providing you are using the `Fedora EPEL repository
  16. <http://fedoraproject.org/wiki/EPEL>`__ (see the `FAQ for instructions
  17. <http://fedoraproject.org/wiki/EPEL/FAQ#Using_EPEL>`__), this same
  18. command will work for RedHat Enterprise Linux 6 and higher (including
  19. RHEL derivatives such as CentOS 6 and Scientific Linux 6)
  20. OS X using Homebrew
  21. ^^^^^^^^^^^^^^^^^^^
  22. You can use the Homebrew package manager to install OpenColorIO on OS X.
  23. First install Homebrew as per the instructions on the `Homebrew
  24. homepage <http://mxcl.github.com/homebrew/>`__ (or see the `Homebrew wiki
  25. <https://github.com/mxcl/homebrew/wiki/Installation>`__ for more
  26. detailed instructions)
  27. Then simply run the following command to install::
  28. brew install opencolorio
  29. To build with the Python library use this command::
  30. brew install opencolorio --with-python
  31. .. _building-from-source:
  32. Building from source
  33. ********************
  34. Dependencies
  35. ************
  36. The basic requirements for building OCIO are:
  37. - cmake >= 3.10
  38. - \*Expat >= 2.2.5 (XML parser for CDL/CLF/CTF)
  39. - \*yaml-cpp >= 0.6.3 (YAML parser for Configs)
  40. - \*IlmBase (Half only) >= 2.3.0 (for half domain LUTs)
  41. - \*pystring >= 1.1.3
  42. Some optional components also depend on:
  43. - \*Little CMS >= 2.2 (for ociobakelut ICC profile baking)
  44. - Python 2.x (for the Python bindings and docs)
  45. - \*Sphinx >= 1.8.5
  46. - Nuke 6.x or newer (for the Nuke nodes)
  47. - OpenImageIO (for apps including ocioconvert)
  48. Automated Installation
  49. ^^^^^^^^^^^^^^^^^^^^^^
  50. Listed dependencies with a preceeding * can be automatically installed at
  51. build time by setting the ``OCIO_INSTALL_EXT_PACKAGES`` option in your cmake
  52. command (requires an internet connection). C/C++ libraries are pulled from
  53. external repositories, built, and statically-linked into libOpenColorIO. Python
  54. packages are installed with ``pip``. All installs are fully contained within
  55. your build directory.
  56. Three ``OCIO_INSTALL_EXT_PACKAGES`` options are available::
  57. cmake -DOCIO_INSTALL_EXT_PACKAGES=<NONE|MISSING|ALL>
  58. - ``NONE`` (default): Use system installed packages. Fail if any are missing or
  59. don't meet minimum version requireements.
  60. - ``MISSING``: Prefer system installed packages. Install any that are not
  61. found or don't meet minimum version requireements.
  62. - ``ALL``: Install all required packages, regardless of availability on the
  63. current system.
  64. Existing Install Hints
  65. ^^^^^^^^^^^^^^^^^^^^^^
  66. When using existing system libraries, the following CMake variables can be
  67. defined to hint at non-standard install locations and preference of shared
  68. or static linking:
  69. - ``-DEXPAT_DIRS=<path>`` (include and/or library root dir)
  70. - ``-DEXPAT_STATIC_LIBRARY=ON`` (prefer static lib)
  71. - ``-DYAMLCPP_DIRS=<path>`` (include and/or library root dir)
  72. - ``-DYAMLCPP_STATIC_LIBRARY=ON`` (prefer static lib)
  73. - ``-DILMBASE_DIRS=<path>`` (include and/or library root dir)
  74. - ``-DILMBASE_STATIC_LIBRARY=ON`` (prefer static lib)
  75. - ``-DPYSTRING_DIRS=<path>`` (include and/or library root dir)
  76. - ``-DPYSTRING_STATIC_LIBRARY=ON`` (prefer static lib)
  77. - ``-DLCMS2_DIRS=<path>`` (include and/or library root dir)
  78. - ``-DLCMS2_STATIC_LIBRARY=ON`` (prefer static lib)
  79. - ``-DNUKE_INSTALL_PATH=<path>`` (or use ``NDK_PATH`` environment variable)
  80. To hint at Python package locations, add paths to the ``PYTHONPATH``
  81. environment variable prior to configuring the build.
  82. .. _osx-and-linux:
  83. OS X and Linux
  84. ^^^^^^^^^^^^^^
  85. While there is a huge range of possible setups, the following steps
  86. should work on OS X and most Linux distros. To keep things simple, this guide
  87. will use the following example paths - these will almost definitely be
  88. different for you:
  89. - source code: ``/source/ocio``
  90. - the temporary build location: ``/tmp/ociobuild``
  91. - the final install directory: ``/software/ocio``
  92. First make the build directory and cd to it::
  93. $ mkdir /tmp/ociobuild
  94. $ cd /tmp/ociobuild
  95. Next step is to run cmake, which looks for things such as the
  96. compiler's required arguments, optional requirements like Python,
  97. Nuke, OpenImageIO etc
  98. As we want to install OCIO to a custom location (instead of the
  99. default ``/usr/local``), we will run cmake with
  100. ``CMAKE_INSTALL_PREFIX``.
  101. Still in ``/tmp/ociobuild``, run::
  102. $ cmake -DCMAKE_INSTALL_PREFIX=/software/ocio /source/ocio
  103. The last argument is the location of the OCIO source code (containing
  104. the main CMakeLists.txt file). You should see something along the
  105. lines of::
  106. -- Configuring done
  107. -- Generating done
  108. -- Build files have been written to: /tmp/ociobuild
  109. Next, build everything (with the ``-j`` flag to build using 8
  110. threads)::
  111. $ make -j8
  112. Starting with CMake 3.12, you can instead run a portable parallel build::
  113. $ cmake --build . -j 8
  114. This should complete in a few minutes. Finally, install the files into
  115. the specified location::
  116. $ make install
  117. If nothing went wrong, ``/software/ocio`` should look something like
  118. this::
  119. $ cd /software/ocio
  120. $ ls
  121. bin/ include/ lib/
  122. $ ls bin/
  123. ocio2icc ociobakelut ociocheck
  124. $ ls include/
  125. OpenColorIO/ PyOpenColorIO/ pkgconfig/
  126. $ ls lib/
  127. libOpenColorIO.a libOpenColorIO.dylib
  128. .. _windows-build:
  129. Windows Build
  130. ^^^^^^^^^^^^^
  131. While build environments may vary between user, here is an example batch file
  132. for compiling on Windows as provided by `@hodoulp <https://github.com/hodoulp>`__::
  133. @echo off
  134. REM Grab the repo name, default is ocio
  135. set repo_name=ocio
  136. if not %1.==. set repo_name=%1
  137. REM Using cygwin to have Linux cool command line tools
  138. set CYGWIN=nodosfilewarning
  139. set CMAKE_PATH=D:\OpenSource\3rdParty\cmake-3.12.2
  140. set GLUT_PATH=D:\OpenSource\3rdParty\freeglut-3.0.0-2
  141. set GLEW_PATH=D:\OpenSource\3rdParty\glew-1.9.0
  142. set PYTHON_PATH=C:\Python27
  143. REM Add glut & glew dependencies to have GPU unit tests
  144. set PATH=%GLEW_PATH%\bin;%GLUT_PATH%\bin;D:\Tools\cygwin64\bin;%CMAKE_PATH%\bin;%PATH%
  145. REM Add Ninja & jom to speed-up command line build i.e. one is enough
  146. set PATH=D:\OpenSource\3rdParty\ninja;D:\OpenSource\3rdParty\jom;%PYTHONPATH%;%PATH%
  147. call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
  148. REM call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64
  149. set OCIO_PATH=D:\OpenSource\%repo_name%
  150. D:
  151. IF NOT EXIST %OCIO_PATH% (
  152. echo %OCIO_PATH% does not exist
  153. exit /b
  154. )
  155. cd %OCIO_PATH%
  156. set CMAKE_BUILD_TYPE=Release
  157. echo *******
  158. echo *********************************************
  159. echo ******* Building %OCIO_PATH%
  160. echo **
  161. echo **
  162. set are_you_sure = Y
  163. set /P are_you_sure=Build in %CMAKE_BUILD_TYPE% ([Y]/N)?
  164. if not %are_you_sure%==Y set CMAKE_BUILD_TYPE=Debug
  165. set BUILD_PATH=%OCIO_PATH%\build_rls
  166. set COMPILED_THIRD_PARTY_HOME=D:/OpenSource/3rdParty/compiled-dist_rls
  167. set OCIO_BUILD_PYTHON=1
  168. if not %CMAKE_BUILD_TYPE%==Release (
  169. set BUILD_PATH=%OCIO_PATH%\build_dbg
  170. set COMPILED_THIRD_PARTY_HOME=D:/OpenSource/3rdParty/compiled-dist_dbg
  171. set OCIO_BUILD_PYTHON=0
  172. )
  173. set INSTALL_PATH=%COMPILED_THIRD_PARTY_HOME%/OpenColorIO-2.0.0
  174. IF NOT EXIST %BUILD_PATH% ( mkdir %BUILD_PATH% )
  175. cd %BUILD_PATH%
  176. echo **
  177. echo **
  178. REM cmake -G "Visual Studio 14 2015 Win64"
  179. REM cmake -G "Visual Studio 15 2017 Win64"
  180. REM cmake -G "Ninja"
  181. cmake -G "NMake Makefiles JOM" ^
  182. -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
  183. -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% ^
  184. -DBUILD_SHARED_LIBS=ON ^
  185. -DOCIO_BUILD_APPS=ON ^
  186. -DOCIO_BUILD_TESTS=ON ^
  187. -DOCIO_BUILD_GPU_TESTS=ON ^
  188. -DOCIO_BUILD_DOCS=OFF ^
  189. -DOCIO_USE_SSE=ON ^
  190. -DOCIO_WARNING_AS_ERROR=ON ^
  191. -DOCIO_BUILD_PYTHON=%OCIO_BUILD_PYTHON% ^
  192. -DPYTHON_LIBRARY=%PYTHONPATH%\libs\python27.lib ^
  193. -DPYTHON_INCLUDE_DIR=%PYTHONPATH%\include ^
  194. -DPYTHON_EXECUTABLE=%PYTHONPATH%\python.exe ^
  195. -DOCIO_BUILD_JAVA=OFF ^
  196. -DCMAKE_PREFIX_PATH=%COMPILED_THIRD_PARTY_HOME%\OpenImageIO-1.9.0;%COMPILED_THIRD_PARTY_HOME%/ilmbase-2.2.0 ^
  197. %OCIO_PATH%
  198. REM Add OCIO & OIIO
  199. set PATH=%BUILD_PATH%\src\OpenColorIO;%INSTALL_PATH%\bin;%COMPILED_THIRD_PARTY_HOME%\OpenImageIO-1.9.0\bin;%PATH%
  200. REM Find the current branch
  201. set GITBRANCH=
  202. for /f %%I in ('git.exe rev-parse --abbrev-ref HEAD 2^> NUL') do set GITBRANCH=%%I
  203. if not "%GITBRANCH%" == "" prompt $C%GITBRANCH%$F $P$G
  204. TITLE %repo_name% (%GITBRANCH%)
  205. echo *******
  206. echo *********************************************
  207. if not "%GITBRANCH%" == "" echo branch = %GITBRANCH%
  208. echo *
  209. echo Mode = %CMAKE_BUILD_TYPE%
  210. echo Build path = %BUILD_PATH%
  211. echo Install path = %INSTALL_PATH%
  212. echo *
  213. echo compile = jom all
  214. echo test = ctest -V
  215. echo doc = jom doc
  216. echo install = jom install
  217. echo *********************************************
  218. echo *******
  219. You could create a desktop shortcut with the following command:
  220. ``%comspec% /k "C:\Users\hodoulp\ocio.bat" ocio``
  221. Also look to the Appveyor config script at the root of repository for an example
  222. build sequence.
  223. .. _enabling-optional-components:
  224. Enabling optional components
  225. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  226. The OpenColorIO library is probably not all you want - the Python
  227. libraries bindings, the Nuke nodes and several applications are only
  228. built if their dependencies are found.
  229. In the case of the Python bindings, the dependencies are the Python
  230. headers for the version you wish to use. These may be picked up by
  231. default - if so, when you run cmake you would see::
  232. -- Python 2.6 okay, will build the Python bindings against .../include/python2.6
  233. If not, you can point cmake to correct Python executable using the
  234. ``-D PYTHON=...`` cmake flag::
  235. $ cmake -D PYTHON=/my/custom/python2.6 /source/ocio
  236. Same process with Nuke (although it less likely to be picked up
  237. automatically). Point cmake to your Nuke install directory by adding
  238. ``-D NUKE_INSTALL_PATH``::
  239. $ cmake -D PYTHON=/my/custom/python2.6 -D NUKE_INSTALL_PATH=/Applications/Nuke6.2v1/Nuke6.2v1.app/Contents/MacOS/ /source/ocio
  240. The ``NUKE_INSTALL_PATH`` directory should contain the Nuke executable
  241. (e.g Nuke6.2v1), and a ``include/`` directory containing ``DDImage/``
  242. and others.
  243. If set correctly, you will see something similar to::
  244. -- Found Nuke: /Applications/Nuke6.2v1/Nuke6.2v1.app/Contents/MacOS/include
  245. -- Nuke_API_VERSION: --6.2--
  246. The Nuke plugins are installed into ``lib/nuke$MAJOR.$MINOR/``, e.g
  247. ``lib/nuke6.2/OCIODisdplay.so``
  248. .. note::
  249. If you are using the Nuke plugins, you should compile the Python
  250. bindings for the same version of Python that Nuke uses
  251. internally. For Nuke 6.0 and 6.1 this is Python 2.5, and for 6.2
  252. it is Python 2.6
  253. The applications included with OCIO have various dependencies - to
  254. determine these, look at the CMake output when first run::
  255. -- Not building ocioconvert. Requirement(s) found: OIIO:FALSE
  256. .. _quick-env-config:
  257. Quick environment configuration
  258. *******************************
  259. The quickest way to set the required :ref:`environment-setup` is to
  260. source the ``share/ocio/setup_ocio.sh`` script installed with OCIO.
  261. For a simple single-user setup, add the following to ``~/.bashrc``
  262. (assuming you are using bash, and the example install directory of
  263. ``/software/ocio``)::
  264. source /software/ocio/share/ocio/setup_ocio.sh
  265. The only environment variable you must configure manually is
  266. :envvar:`OCIO`, which points to the configuration file you wish to
  267. use. For prebuilt config files, see the
  268. :ref:`downloads` section
  269. To do this, you would add a line to ``~/.bashrc`` (or a per-project
  270. configuration script etc), for example::
  271. export OCIO="/path/to/my/config.ocio"
  272. .. _nuke-configuration:
  273. Nuke Configuration
  274. ******************
  275. If you specified the ``NUKE_INSTALL_PATH`` option when running cmake,
  276. you should have a ``/software/ocio/lib/nuke6.2`` directory containing
  277. various files.
  278. If you have followed :ref:`quick-env-config`, the plugins should be
  279. functional. However, one common additional configuration step is to
  280. register an OCIODisplay node for each display device/view specified in
  281. the config.
  282. To do this, in a menu.py on :envvar:`NUKE_PATH` (e.g
  283. ``~/.nuke/menu.py`` for a single user setup), add the following:
  284. .. code-block:: python
  285. import ocionuke.viewer
  286. ocionuke.viewer.populate_viewer(also_remove = "default")
  287. The ``also_remove`` argument can be set to either "default" to remove
  288. the default sRGB/rec709 options, "all" to remove everything, or "none"
  289. to leave existing viewer processes untouched.
  290. Alternatively, if your workflow has different requirements, you can
  291. copy the function and modify it as required, or use it as reference to
  292. write your own, better viewer setup function!
  293. .. literalinclude:: /share/nuke/ocionuke/viewer.py
  294. :language: python
  295. .. _environment-setup:
  296. Environment variables
  297. *********************
  298. .. envvar:: OCIO
  299. This variable needs to point to the global OCIO config file, e.g
  300. ``config.ocio``
  301. .. envvar:: OCIO_LOGGING_LEVEL
  302. Configures OCIO's internal logging level. Valid values are
  303. ``none``, ``warning``, ``info``, or ``debug`` (or their respective
  304. numeric values ``0``, ``1``, ``2``, or ``3`` can be used)
  305. Logging output is sent to STDERR output.
  306. .. envvar:: OCIO_ACTIVE_DISPLAYS
  307. Overrides the :ref:`active-displays` configuration value.
  308. Colon-separated list of displays, e.g ``sRGB:P3``
  309. .. envvar:: OCIO_ACTIVE_VIEWS
  310. Overrides the :ref:`active-views` configuration
  311. item. Colon-separated list of view names, e.g
  312. ``internal:client:DI``
  313. .. envvar:: DYLD_LIBRARY_PATH
  314. The ``lib/`` folder (containing ``libOpenColorIO.dylib``) must be
  315. on the ``DYLD_LIBRARY_PATH`` search path, or you will get an error
  316. similar to::
  317. dlopen(.../OCIOColorSpace.so, 2): Library not loaded: libOpenColorIO.dylib
  318. Referenced from: .../OCIOColorSpace.so
  319. Reason: image not found
  320. This applies to anything that links against OCIO, including the
  321. Nuke nodes, and the ``PyOpenColorIO`` Python bindings.
  322. .. envvar:: LD_LIBRARY_PATH
  323. Equivalent to the ``DYLD_LIBRARY_PATH`` on Linux
  324. .. envvar:: PYTHONPATH
  325. Python's module search path. If you are using the PyOpenColorIO
  326. module, you must add ``lib/python2.x`` to this search path (e.g
  327. ``python/2.5``), or importing the module will fail::
  328. >>> import PyOpenColorIO
  329. Traceback (most recent call last):
  330. File "<stdin>", line 1, in <module>
  331. ImportError: No module named PyOpenColorIO
  332. Note that :envvar:`DYLD_LIBRARY_PATH` or :envvar:`LD_LIBRARY_PATH`
  333. must be set correctly for the module to work.
  334. .. envvar:: NUKE_PATH
  335. Nuke's customization search path, where it will look for plugins,
  336. gizmos, init.py and menu.py scripts and other customizations.
  337. This should point to both ``lib/nuke6.2/`` (or whatever version
  338. the plugins are built against), and ``share/nuke/``