利用者:DingTo/OpenShadingLanguage/Compile

提供: wiki
移動先: 案内検索

Precompiled libraries

  • For Linux, use the new Script in SVN to compile the dependencies.
  • Windows: the libraries are in SVN too. (lib/windows and lib/win64)

Compile OSL on Linux

Note: This guide is only here for reference, to get Blender + OSL see above^^.

Requirements

  • LLVM 3.0 / 3.1 or Clang 3.1
  • flex, bison, can be installed from the Ubuntu Repository.

ATTENTION: Make sure you use right versions, as noted above. Especially important is use recent OSL and OIIO versions. Other versions probably won't work!!

Boost

  • Compile
./bootstrap.sh

./bjam -j4 variant=release link=static threading=multi --with-filesystem --with-thread --with-regex --with-system --with-date_time stage cxxflags=-fPIC

OpenImageIO

  • Go into the OIIO source folder.
  • Create the directory build/linux and cd into it.
  • Compile static libraries:
  • Replace /path_to_includes with your path to Boost includes (example: ./lib/linux64/boost/include)
  • Replace /path_to_libs with your path to Boost libs (example: ./lib/linux64/boost/lib)
cmake ../../src/ -DBUILDSTATIC=1 -DBOOST_CUSTOM=1 -DBoost_INCLUDE_DIRS=/path_to_includes -DBoost_LIBRARY_DIRS=/path_to_libs -DBoost_LIBRARIES="boost_date_time;boost_filesystem;boost_thread;boost_regex;boost_system" -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_INSTALL_PREFIX=`pwd`/../../dist/linux64
  • make install

Open Shading Language

  • Set environment variables for OIIO, BOOST and LLVM. Replace the example paths with the ones of the previously compiled libraries on your system.
export OPENIMAGEIOHOME=path/to/OIIO
export BOOST_HOME=path/to/BOOST
export LLVM_VERSION=3.0
export LLVM_DIRECTORY=path/to/LLVM
  • run "make cmakesetup"
  • ccmake ./build/linux64 (this path might be different on your OS)
  • Change the following options in cmake:
BUILDSTATIC=ON
LINKSTATIC=ON
BUILD_TESTING=OFF
  • run "make" again.

Blender

  • Copy all libs to the Blender libfolder (lib/linux64/), cmake should find them.
  • Set the following CMake options:
CYCLES_OSL=ON
WITH_LLVM=ON

After updating cmake you will currently have to change some options again (this is a bit stupid, will be fixed):

  • Set these to same values as in OSL:
LLVM_VERSION
LLVM_DIRECTORY

Then run cmake update again and build as usual.

  • Change the "Shading System" to "Open Shading Language" in the Properties Editor. Enjoy.