From a7d3a77121f0127b9402a78b1138d00dd4f973fc Mon Sep 17 00:00:00 2001 From: Sayed Adel Date: Tue, 13 Jul 2021 23:37:25 +0200 Subject: DOC: Add support for documenting C/C++ via Doxygen & Breathe --- doc/source/conf.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc/source/conf.py') diff --git a/doc/source/conf.py b/doc/source/conf.py index 41b5cee25..835ad9064 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -84,6 +84,7 @@ extensions = [ 'IPython.sphinxext.ipython_console_highlighting', 'IPython.sphinxext.ipython_directive', 'sphinx.ext.mathjax', + 'breathe' ] # Add any paths that contain templates here, relative to this directory. @@ -477,3 +478,11 @@ class NumPyLexer(CLexer): inherit, ], } + + +# ----------------------------------------------------------------------------- +# Breathe & Doxygen +# ----------------------------------------------------------------------------- +breathe_projects = dict(numpy=os.path.join("..", "build", "doxygen", "xml")) +breathe_default_project = "numpy" +breathe_default_members = ("members", "undoc-members", "protected-members") -- cgit v1.2.1 From defd9fe389fda06b940cf4b186ea25f7047fd294 Mon Sep 17 00:00:00 2001 From: Sayed Adel Date: Tue, 31 Aug 2021 16:41:07 +0200 Subject: DOC: skip generating c/c++ doc from comment blocks when Doxygen or Breathe isn't available. --- doc/source/conf.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'doc/source/conf.py') diff --git a/doc/source/conf.py b/doc/source/conf.py index 835ad9064..d08f29e59 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -2,6 +2,7 @@ import os import re import sys +import importlib # Minimum version, enforced by sphinx needs_sphinx = '3.2.0' @@ -84,9 +85,18 @@ extensions = [ 'IPython.sphinxext.ipython_console_highlighting', 'IPython.sphinxext.ipython_directive', 'sphinx.ext.mathjax', - 'breathe' ] +skippable_extensions = [ + ('breathe', 'skip generating C/C++ API from comment blocks.'), +] +for ext, warn in skippable_extensions: + ext_exist = importlib.util.find_spec(ext) is not None + if ext_exist: + extensions.append(ext) + else: + print(f"Unable to find Sphinx extension '{ext}', {warn}.") + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] -- cgit v1.2.1