-
Notifications
You must be signed in to change notification settings - Fork 330
Building appleseed on macOS
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 3.1 or later is required. You can install it with Homebrew:
brew install cmake
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
We assume in the remaining of this document that Python 2.7.15 is installed in /usr/local/Cellar/python@2/2.7.15
. If you installed Python via Homebrew, you can check where it is installed:
brew info python@2
Adjust instructions if a different version of Python is installed in your system.
Let's start by installing as many dependendies as we can with Homebrew:
brew install boost --without-single --without-static
brew install boost-python llvm@5 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
OpenShadingLanguage (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 clone the OSL repository and switch to the correct branch:
git clone https://github.com/imageworks/OpenShadingLanguage.git
cd OpenShadingLanguage
git checkout Release-1.8.12
Edit the file CMakeLists.txt
and change line 25 from
# cmake_policy (SET CMP0042 OLD)
to
cmake_policy (SET CMP0042 OLD)
Then build and install OSL:
mkdir build
cd build
cmake -Wno-dev -DLLVM_DIRECTORY=/usr/local/opt/llvm@5/ -DLLVM_STATIC=ON -DENABLERTTI=ON -DUSE_LIBCPLUSPLUS=ON ..
sudo make install
SeExpr is a simple expression language developed by Walt Disney Animation Studios. SeExpr is required by appleseed to combine layers in the Disney material (and may be used more pervasively in the future).
Move to the directory of your choice, then retrieve, build and install SeExpr by running the following commands:
git clone https://github.com/wdas/SeExpr
cd SeExpr
git checkout db9610a24401fa7198c54c8768d0484175f54172
mkdir build
cd build
cmake -Wno-dev -DCMAKE_POLICY_DEFAULT_CMP0042=OLD ..
sudo make install
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 \
-DWITH_DISNEY_MATERIAL=ON \
-DUSE_STATIC_BOOST=OFF \
-DBoost_PYTHON_LIBRARY_RELEASE=/usr/local/lib/libboost_python27.dylib \
-DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/include/python2.7/ \
-DPYTHON_LIBRARY=/usr/local/Cellar/python@2/2.7.15/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 \
-DCMAKE_PREFIX_PATH=/usr/local/opt/qt \
..
make
This will install appleseed binaries under the sandbox/bin/Ship/
directory.
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.
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/Cellar/python@2/2.7.15/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.