[PATCH] Allow CMake to build Sphinx documentation

Dan Liew dan at su-root.co.uk
Wed Apr 16 08:50:32 PDT 2014


Okay here is my second attempt at this. Rather than explain the
differences, here's how to use it

Build with the following CMake options enabled

LLVM_ENABLE_SPHINX
LLVM_BUILD_DOCS

This will enable and build by default the following targets
docs-llvm-html, docs-llvm-man.

If you run ``make install`` then the documentation will be installed
in the followings locations

HTML files are installed to

${CMAKE_INSTALL_PREFIX}/share/doc/${CMAKE_PROJECT_NAME}/html/

Man pages are installed to

${CMAKE_INSTALL_PREFIX}/share/man/man1/

These locations are correct for my particular Linux install but I'm
not sure about OSX or Windows.

I've put the add_sphinx_target() CMake function in a separate file so
it can be included by other projects (e.g. Clang). It just needs to be
called by CMakeLists.txt file within a directory containing Sphinx
documentation.

I've tested this with make and ninja under Linux and it seems to work fine.

I've also attached a second patch that makes configure fail if
LLVM_ENABLE_DOXYGEN was enabled but doxygen was not found.

Thanks,
Dan.


On 16 April 2014 02:02, Dan Liew <dan at su-root.co.uk> wrote:
>> Maybe it's because of the :program: tag?
>
> I think it's actually the docs/conf.py configuration file that
> populates the man_pages [1] variable based on the contents of
> docs/CommandGuide directory
>
> The program:: directive seems to tell sphinx that following option::
> directives refer to that tool [2]
>
> [1] http://sphinx-doc.org/config.html#confval-man_pages
> [2] http://sphinx-doc.org/domains.html#directive-program
>
> --
> Dan Liew
> PhD Student - Imperial College London



-- 
Dan Liew
PhD Student - Imperial College London
-------------- next part --------------
A non-text attachment was scrubbed...
Name: [V2]0001-Added-Sphinx-documentation-generation-to-CMake-build.patch
Type: text/x-patch
Size: 6771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140416/2f17f084/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-If-building-with-LLVM_ENABLE_DOXYGEN-with-CMake-then.patch
Type: text/x-patch
Size: 786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140416/2f17f084/attachment-0001.bin>


More information about the llvm-commits mailing list