.. _builddocs:

Build documentation
======================

The main documentation and Python documentation is written in
`reStructuredText <http://www.sphinx-doc.org/en/stable/rest.html>`_ and
generated by `sphinx <http://www.sphinx-doc.org/>`_. The C++ API documentation
is generated by `Doxygen <http://www.doxygen.nl/>`_.

Documentation can be built on Ubuntu or macOS. Building documentation on Windows
may also be possible but it is not officially tested.

If you're building documentation on a computer without a display, please use
:ref:`headless_rendering`, otherwise the Jupyter tutorials will fail to execute.

Prerequisites
-------------

1. Install system dependencies
``````````````````````````````

**Ubuntu**

.. code-block:: bash

    sudo apt-get -y install doxygen texlive texlive-latex-extra ghostscript pandoc

**macOS**

First, install a TeX distribution such as `MacTeX <http://www.tug.org/mactex/>`_.

.. code-block:: bash

    brew install ghostscript pandoc doxygen


2. Install Python dependencies
``````````````````````````````

.. code-block:: bash

    pip install -r docs/requirements.txt


Build
-----

First, clone and build Open3D from source and install the Open3D Python package.
Visit :ref:`compilation` for details. After configuration, install the Open3D
Python package with:

.. code-block:: bash

    make install-pip-package -j$(nproc)

.. code-block:: bash

    cd docs

    # Run `python make_docs.py --help` to usage of the flags.
    python make_docs.py --clean_notebooks --execute_notebooks=auto --sphinx --doxygen

The docs html will be saved in ``docs/_out`` folder.
