From: Gereon Kremer Date: Mon, 26 Apr 2021 20:48:40 +0000 (+0200) Subject: Generate docs conf.py by cmake (#6441) X-Git-Tag: cvc5-1.0.0~1827 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=23df1d5ed33207880f15f73b5e86580ac056e4ef;p=cvc5.git Generate docs conf.py by cmake (#6441) This PR makes cmake generate the sphinx configuration file. This will simplify dynamically modifying this file in the future, for example to add custom paths within the build directory (for the python API). --- diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 4e18c0ba9..23e3c2dd6 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -22,14 +22,17 @@ add_subdirectory(cpp) set(SPHINX_INPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(SPHINX_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx) +configure_file(conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py) + add_custom_target(docs ALL DEPENDS docs-cpp COMMAND ${SPHINX_EXECUTABLE} -b html + -c ${CMAKE_CURRENT_BINARY_DIR} # Tell Breathe where to find the Doxygen output -Dbreathe_projects.cvc5=${CPP_DOXYGEN_XML_FOLDER} ${SPHINX_INPUT_DIR} ${SPHINX_OUTPUT_DIR} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating Sphinx Api docs") set(SPHINX_GH_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx-gh) diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 91a3b3a9a..000000000 --- a/docs/conf.py +++ /dev/null @@ -1,61 +0,0 @@ -# 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('ext/')) - - -# -- Project information ----------------------------------------------------- - -project = 'cvc5' -copyright = '2021, The Authors of cvc5' -author = 'The Authors of cvc5' - - -# -- 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', - 'sphinx.ext.autosectionlabel', - 'sphinxcontrib.bibtex', - 'sphinx_tabs.tabs', - 'examples', -] - -bibtex_bibfiles = ['references.bib'] - -# 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 = 'sphinx_rtd_theme' -html_theme_options = {} -html_static_path = ['_static'] -html_css_files = ['custom.css'] - -# -- Breathe configuration --------------------------------------------------- -breathe_default_project = "cvc5" -breathe_domain_by_extension = {"h" : "cpp"} diff --git a/docs/conf.py.in b/docs/conf.py.in new file mode 100644 index 000000000..12bfa9ed0 --- /dev/null +++ b/docs/conf.py.in @@ -0,0 +1,62 @@ +# 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 sys +# add path to enable extensions +sys.path.insert(0, '${CMAKE_CURRENT_SOURCE_DIR}/ext/') + + +# -- Project information ----------------------------------------------------- + +project = 'cvc5' +copyright = '2021, The Authors of cvc5' +author = 'The Authors of cvc5' + + +# -- 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', + 'sphinx.ext.autosectionlabel', + 'sphinxcontrib.bibtex', + 'sphinx_tabs.tabs', + 'examples', +] + +bibtex_bibfiles = ['references.bib'] + +# 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 = 'sphinx_rtd_theme' +html_theme_options = {} +html_static_path = ['${CMAKE_CURRENT_SOURCE_DIR}/_static/'] +html_css_files = ['custom.css'] + +# -- Breathe configuration --------------------------------------------------- +breathe_default_project = "cvc5" +breathe_domain_by_extension = {"h" : "cpp"}