Skip to content

Commit

Permalink
DOC: skip generating c/c++ doc from comment blocks when Doxygen or Br…
Browse files Browse the repository at this point in the history
…eathe isn't available.
  • Loading branch information
seiko2plus committed Aug 31, 2021
1 parent 68956e1 commit 961e431
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/Makefile
Expand Up @@ -178,7 +178,11 @@ html: version-check html-build
html-build: generate
mkdir -p build/html build/doctrees
$(PYTHON) preprocess.py
ifeq (, $(shell which $(DOXYGEN)))
@echo "Unable to find 'Doxygen:$(DOXYGEN)', skip generating C/C++ API from comment blocks."
else
$(DOXYGEN) build/doxygen/Doxyfile
endif
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html $(FILES)
$(PYTHON) postprocess.py html build/html/*.html
@echo
Expand Down
12 changes: 11 additions & 1 deletion doc/source/conf.py
Expand Up @@ -2,6 +2,7 @@
import os
import re
import sys
import importlib

# Minimum version, enforced by sphinx
needs_sphinx = '3.2.0'
Expand Down Expand Up @@ -84,9 +85,18 @@ class PyTypeObject(ctypes.Structure):
'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']

Expand Down

0 comments on commit 961e431

Please sign in to comment.