Skip to content

Building appleseed on macOS

Esteban Tovagliari edited this page Apr 16, 2020 · 67 revisions

Prerequisites

Tools

Homebrew

Homebrew is a popular package manager for macOS. We'll use Homebrew to install most dependencies.

You may already have Homebrew installed on your system. If brew help returns something, you already have it. If instead it returns brew: command not found, you need to install Homebrew by opening Terminal and running this command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

CMake

CMake 3.14 or later is required. If you don't have CMake, you can install it with Homebrew:

brew install cmake

If you do already have CMake, you can update it to the latest version with Homebrew:

brew upgrade cmake

Python

Python 2.7.11 or a newer version of Python 2.7 is required. Start by checking the version of Python currently installed in your system:

python --version

If this returns anything older than Python 2.7.11 then install the latest version of Python 2.7:

brew install python@2

In case you already have a recent version of Python but it just needs to be linked:

brew link python@2

macOS SDK headers

If this is the first time you compile C++ code on your macOS installation, you may not yet have installed the macOS SDK headers.

You can install them with the following package:

/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Libraries available through Homebrew

Let's start by installing as many dependendies as we can with Homebrew:

brew install boost boost-python embree llvm@6 lz4 openimageio qt xerces-c zlib

mkdir -p $HOME/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> $HOME/Library/Python/2.7/lib/python/site-packages/homebrew.pth

Open Shading Language

Open Shading Language (OSL in short) is an advanced shading language for production renderers developed by Sony Pictures Imageworks. OSL is the shading language of appleseed.

Move to the directory of your choice, then retrieve, build and install OSL by running the following commands:

git clone https://github.com/imageworks/OpenShadingLanguage.git
cd OpenShadingLanguage
git checkout Release-1.10.3
mkdir build
cd build
cmake \
  -Wno-dev \
  -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" \
  -DCMAKE_PREFIX_PATH=/usr/local/opt/qt \
  -DLLVM_STATIC=ON \
  -DENABLERTTI=ON \
  -DUSE_LIBCPLUSPLUS=ON \
  -DLLVM_DIRECTORY=/usr/local/opt/llvm@6/ \
  ..
sudo make install

Building appleseed

You can finally clone appleseed's repository and build appleseed. Move to the directory of your choice, then retrieve and build appleseed by running the following commands:

git clone https://github.com/appleseedhq/appleseed.git
cd appleseed
mkdir build
cd build
cmake \
  -Wno-dev \
  -DCMAKE_PREFIX_PATH=/usr/local/opt/qt \
  -DWITH_EMBREE=ON \
  -DUSE_SSE42=ON \
  -DUSE_STATIC_BOOST=OFF \
  -DBoost_PYTHON_LIBRARY=/usr/local/lib/libboost_python27.dylib \
  -DPYTHON_INCLUDE_DIR=/usr/local/opt/python@2/Frameworks/Python.framework/Versions/2.7/include/python2.7/ \
  -DPYTHON_LIBRARY=/usr/local/opt/python@2/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib \
  -DZLIB_INCLUDE_DIR=/usr/local/opt/zlib/include \
  -DZLIB_LIBRARY=/usr/local/opt/zlib/lib/libz.dylib \
  ..
make

This will install appleseed binaries under the sandbox/bin/Ship/ directory.

Building appleseed.python with support for Python 3.x: If you are interested in building appleseed.python with support for Python 3.x, add the following lines to the CMake command:

-DWITH_PYTHON3_BINDINGS=ON -DBoost_PYTHON_LIBRARY=/usr/local/lib/libboost_python37.dylib -DPYTHON3_INCLUDE_DIR=/usr/local/opt/python@3/Frameworks/Python.framework/Versions/3.7/include/python3.7m/ -DPYTHON3_LIBRARY=/usr/local/opt/python@3/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib

(Make sure to replace libboost_python37.dylib, python3.7m/ and libpython3.7.dylib as appropriate.)

A note regarding compiler warnings

The default build configuration (or build type in CMake's terminology) is Ship (check Build Configurations for details). In Ship and Profile configurations, warnings emitted by the compiler don't cause builds to fail.

However, if you decide to build appleseed in Debug or Release configurations, any compiler warning will be treated as an error and will cause builds to fail.

We always make sure that the master branch of appleseed builds cleanly (without any warning) on all platforms and with all supported compiler and compiler versions. However your compiler may emit new warnings which will cause builds to fail.

Ideally, we would appreciate that you investigate the cause of these warnings and submit a pull request that fix them. Alternatively, you can add -DWARNINGS_AS_ERRORS=OFF to CMake's command line, then run make again. Warnings will still be emitted by the compiler but they won't cause builds to fail anymore.

Running appleseed

appleseed binaries, appleseed.studio in particular, need an "environment" with a specific directory structure and a number of support files in order to run properly. We call this environment the sandbox. The appleseed repository comes with a fully configured sandbox in the sandbox/ directory.

When appleseed is built, binaries get automatically deployed to sandbox/bin/<config> where <config> is the build configuration you selected with CMake's CMAKE_BUILD_TYPE option.

In addition to the sandbox, developer builds of appleseed.studio need to find the standard library of a Python 2.7 installation for the embedded Python 2.7 to function properly. They rely on the PYTHONHOME environment to find it. To set this variable, type

export PYTHONHOME=/usr/local/opt/python@2/Frameworks/Python.framework/Versions/2.7/

You should now be able to run appleseed.studio: navigate to sandbox/bin/<config> (e.g. sandbox/bin/Ship) and type

./appleseed.studio

Note that official builds of appleseed ship with a Python 2.7 standard library so they don't need one to exist on the user's system.

Clone this wiki locally