From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Compile OpenVDB

The required dependencies for OpenVDB are OpenEXR, TBB, and Boost. For better interoperability with other software, it is recommended to compile OpenVDB with Blosc.

Here is a short script/guide to get and compile blosc for Linux:

# get the source
wget https://github.com/Blosc/c-blosc/archive/v1.7.0.tar.gz
 
tar -xvf v1.7.0.tar.gz
cd c-blosc-1.7.0/
 
# set up build dir
mkdir build
cd build/
 
# set up install dir
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install ..
 
# compile and install
cmake --build . --target install

It can also be desirable to link OpenVDB against a concurrent allocator, like jemalloc.


Unfortunately it is currently required to hand edit the Makefile from openvdb.

For reference, here is a stripped Makefile that I use to compile the library (minus the OpenVDB development related stuff).

The contents here should be copied into the Makefile, starting around line 80, ending with DOXYGEN, see: https://github.com/dreamworksanimation/openvdb/blob/master/openvdb/Makefile#L80

# The directory into which to install libraries, executables and header files
DESTDIR := /opt/lib/openvdb
 
# The parent directory of the boost/ header directory
BOOST_INCL_DIR := /opt/lib/boost/include
# The directory containing libboost_iostreams, libboost_system, etc.
BOOST_LIB_DIR := /opt/lib/boost
BOOST_LIB := -lboost_iostreams -lboost_system
BOOST_THREAD_LIB := -lboost_thread
 
# The parent directory of the OpenEXR/ header directory
EXR_INCL_DIR := /opt/lib/openexr/include
# The directory containing IlmImf
EXR_LIB_DIR := /opt/lib/openexr/lib
EXR_LIB := -lIlmImf
 
# The parent directory of the OpenEXR/ header directory (which contains half.h)
ILMBASE_INCL_DIR := $(EXR_INCL_DIR)
# The directory containing libIlmThread, libIlmThread, libHalf etc.
ILMBASE_LIB_DIR := $(EXR_LIB_DIR)
ILMBASE_LIB := -lIlmThread -lIex -lImath
HALF_LIB := -lHalf
 
# The parent directory of the tbb/ header directory
TBB_INCL_DIR := /usr/include
# The directory containing libtbb
TBB_LIB_DIR := /usr/lib
TBB_LIB := -ltbb
 
# The parent directory of the blosc.h header
# (leave blank if Blosc is unavailable)
BLOSC_INCL_DIR := /opt/lib/blosc/include
# The directory containing libblosc
BLOSC_LIB_DIR := /opt/lib/blosc/lib
BLOSC_LIB := -lblosc -lz
 
# A scalable, concurrent malloc replacement library
# such as jemalloc (included in the Houdini HDK) or TBB malloc
# (leave blank if unavailable)
CONCURRENT_MALLOC_LIB := -ljemalloc
#CONCURRENT_MALLOC_LIB := -ltbbmalloc_proxy -ltbbmalloc
# The directory containing the malloc replacement library
CONCURRENT_MALLOC_LIB_DIR := /usr/lib/x86_64-linux-gnu
 
# The parent directory of the cppunit/ header directory
# (leave blank if CppUnit is unavailable)
CPPUNIT_INCL_DIR :=
# The directory containing libcppunit
CPPUNIT_LIB_DIR :=
CPPUNIT_LIB :=
 
# The parent directory of the log4cplus/ header directory
# (leave blank if log4cplus is unavailable)
LOG4CPLUS_INCL_DIR :=
# The directory containing liblog4cplus
LOG4CPLUS_LIB_DIR :=
LOG4CPLUS_LIB :=
 
# The directory containing glfw.h
# (leave blank if GLFW is unavailable)
GLFW_INCL_DIR :=
# The directory containing libglfw
GLFW_LIB_DIR :=
GLFW_LIB :=
# The major version number of the GLFW library
# (header filenames changed between GLFW 2 and 3, so this must be specified explicitly)
GLFW_MAJOR_VERSION :=
 
# The version of Python for which to build the OpenVDB module
# (leave blank if Python is unavailable)
PYTHON_VERSION :=
# The directory containing Python.h
PYTHON_INCL_DIR :=
# The directory containing pyconfig.h
PYCONFIG_INCL_DIR :=
# The directory containing libpython
PYTHON_LIB_DIR :=
PYTHON_LIB :=
# The directory containing libboost_python
BOOST_PYTHON_LIB_DIR :=
BOOST_PYTHON_LIB :=
# The directory containing arrayobject.h
# (leave blank if NumPy is unavailable)
NUMPY_INCL_DIR :=
# The Epydoc executable
# (leave blank if Epydoc is unavailable)
EPYDOC :=
# Set PYTHON_WRAP_ALL_GRID_TYPES to "yes" to specify that the Python module
# should expose (almost) all of the grid types defined in openvdb.h
# Otherwise, only FloatGrid, BoolGrid and Vec3SGrid will be exposed
# (see, e.g., exportIntGrid() in python/pyIntGrid.cc).
# Compiling the Python module with PYTHON_WRAP_ALL_GRID_TYPES set to "yes"
# can be very memory-intensive.
PYTHON_WRAP_ALL_GRID_TYPES := no
 
# The Doxygen executable
# (leave blank if Doxygen is unavailable)
DOXYGEN :=