Compilation Options

This page shows advanced options to customize your Open3D build. For quick start, see Compiling from source.

Python binding

We use pybind11 to build the Python binding. It tries to automatically detect the installed version of Python and link against that. When this fails, or when there are multiple versions of Python and it finds the wrong one, delete CMakeCache.txt and then invoke CMake as follows:

cmake -DPYTHON_EXECUTABLE:FILEPATH=<path-to-python-executable> ../src

Note

Python binding issues can also refer to pybind11 document page.

If you do not want Python binding, you may turn off the following compilation options:

  • BUILD_PYBIND11
  • BUILD_PYTHON_MODULE
  • BUILD_PYTHON_TUTORIALS

Dependencies

For each dependent library, there is a corresponding CMake build option BUILD_<LIBRARY_NAME>. If the option is ON, the dependent library is forced to be compiled from the source code included in src/External folder. If it is OFF, CMake will try to find system installed libraries and use it. If CMake fails to find the dependent library, it falls back to compiling the library from source code.

Tip

On Ubuntu and OSX it is recommended to link Open3D to system installed libraries. The dependencies can be installed via scripts util/scripts/install-deps-ubuntu.sh and util/scripts/install-deps-osx.sh. On Windows it is recommended to compile everything from source since Windows lacks a package management software.

The following is an example of forcing building dependencies from source code:

cmake -DBUILD_EIGEN3=ON  \
      -DBUILD_GLEW=ON    \
      -DBUILD_GLFW=ON    \
      -DBUILD_JPEG=ON    \
      -DBUILD_JSONCPP=ON \
      -DBUILD_PNG=ON     \
      ../src

Note

Enabling these build options may increase the compilation time.

OpenMP

We automatically detect if the C++ compiler supports OpenMP and compile Open3D with it if the compilation option WITH_OPENMP is ON. OpenMP can greatly accelerate computation on a multi-core CPU.

The default LLVM compiler on OS X does not support OpenMP. A workaround is to install a C++ compiler with OpenMP support, such as gcc, then use it to compile Open3D. For example, starting from a clean build directory, run

brew install gcc --without-multilib
cmake -DCMAKE_C_COMPILER=gcc-6 -DCMAKE_CXX_COMPILER=g++-6 ../src
make -j

Note

This workaround has some compatibility issues with the source code of GLFW included in src/External. Make sure Open3D is linked against GLFW installed on the OS.

Unit testing

Warning

Work in progress!

  • Unit test coverage: low.
  • Tested on: macOS and Ubuntu.

Unit testing is based on Google Test. By default unit tests are turned off. In order to enable them follow the next steps:

  1. Download/Build/Install Google Test.
  2. Set the BUILD_UNIT_TESTS flag to ON.
cd util/scripts
./install-gtest.sh

cd <path_to_Open3D>
mkdir build
cd build
cmake ../src -DBUILD_UNIT_TESTS=ON
make -j

In order to perform the unit tests:

cd util/scripts
./runUnitTests.sh

Documentation

Documentation is written in reStructuredText and compiled with sphinx. From docs folder, run

pip install sphinx sphinx-autobuild sphinx-rtd-theme
make html

Documentation for C++ API is made with Doxygen. Follow the Doxygen installation instruction. From Open3D root folder, run

doxygen Doxyfile