Commit c8d4b436 authored by Morten Ofstad's avatar Morten Ofstad
Browse files

Added Doxygen+Breathe+Sphinx documentation build system.

parent 3c6fdc0a
#Look for an executable called sphinx-build
find_program(SPHINX_EXECUTABLE
NAMES sphinx-build
DOC "Path to sphinx-build executable")
include(FindPackageHandleStandardArgs)
#Handle standard arguments to find_package like REQUIRED and QUIET
find_package_handle_standard_args(Sphinx
"Failed to find sphinx-build executable"
SPHINX_EXECUTABLE)
cmake_minimum_required(VERSION 3.12.0)
project(Open-VDS)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/CMake")
include(GNUInstallDirs)
set (TEST_DATA_PATH "" CACHE PATH "Test data path")
......@@ -66,6 +69,7 @@ build3rdparty()
add_subdirectory(src)
add_subdirectory(python)
add_subdirectory(docs)
enable_testing()
add_subdirectory(tests)
# Based on https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/
find_package(Doxygen)
find_package(Sphinx)
if (NOT Doxygen_FOUND OR NOT Sphinx_FOUND)
return()
endif()
# Find all the public headers
get_target_property(OPENVDS_PUBLIC_HEADER_DIR openvds INTERFACE_INCLUDE_DIRECTORIES)
file(GLOB_RECURSE OPENVDS_PUBLIC_HEADERS ${OPENVDS_PUBLIC_HEADER_DIR}/*.h)
set(DOXYGEN_INPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/src/OpenVDS)
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen)
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIRECTORY}/xml/index.xml)
set(DOXYGEN_GENERATE_HTML NO)
set(DOXYGEN_GENERATE_XML YES)
doxygen_add_docs(Doxygen
${DOXYGEN_INPUT_DIRECTORY}
COMMENT "Generating docs")
#set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
#set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# Replace variables inside @@ with the current values
#configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)
# Doxygen won't create this for us
#file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIRECTORY})
# Only regenerate Doxygen when the Doxyfile or public headers change
#add_custom_command(OUTPUT ${DOXYGEN_INDEX_FILE}
# DEPENDS ${OPENVDS_PUBLIC_HEADERS}
# COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
# MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
# COMMENT "Generating docs"
# VERBATIM)
# Nice named target so we can run the job easily
#add_custom_target(Doxygen DEPENDS ${DOXYGEN_INDEX_FILE})
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/sphinx)
set(SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html)
# Only regenerate Sphinx when:
# - Doxygen has rerun
# - Our doc files have been updated
# - The Sphinx config has been updated
add_custom_command(OUTPUT ${SPHINX_INDEX_FILE}
COMMAND
${SPHINX_EXECUTABLE} -b html
# Tell Breathe where to find the Doxygen output
-Dbreathe_projects.OpenVDS=${DOXYGEN_OUTPUT_DIRECTORY}/xml
${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
# Other docs files you want to track should go here (or in some variable)
${CMAKE_CURRENT_SOURCE_DIR}/index.rst
MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py
COMMENT "Generating documentation with Sphinx")
# Nice named target so we can run the job easily
add_custom_target(Sphinx DEPENDS ${SPHINX_INDEX_FILE})
add_dependencies(Sphinx Doxygen)
# Add an install target to install the docs
include(GNUInstallDirs)
install(DIRECTORY ${SPHINX_BUILD}
DESTINATION ${CMAKE_INSTALL_DOCDIR})
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'OpenVDS'
copyright = '2019, Bluware, Inc.'
author = 'Bluware'
# The full version, including alpha/beta/rc tags
release = '0.1'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [ "breathe" ]
# Breathe Configuration
breathe_default_project = "OpenVDS"
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
\ No newline at end of file
.. OpenVDS documentation master file, created by
sphinx-quickstart on Thu Nov 7 15:40:05 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to OpenVDS's documentation!
===================================
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
API Reference
====
.. doxygenclass:: OpenVDS::VolumeDataAccessManager
:members:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment