diff --git a/.readthedocs.yml b/.readthedocs.yml index 636e29c9708..51f5dbec27d 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -4,6 +4,9 @@ build: os: "ubuntu-22.04" tools: python: "3.6" + jobs: + pre_build: + - cd doc_new && doxygen Doxygen.in # Build from the docs/ directory with Sphinx sphinx: diff --git a/doc_new/.gitignore b/doc_new/.gitignore index 5ccff1a6bea..d0e9ca77ae0 100644 --- a/doc_new/.gitignore +++ b/doc_new/.gitignore @@ -1 +1,2 @@ +xml/ html/ diff --git a/doc_new/Doxygen.in b/doc_new/Doxygen.in new file mode 100644 index 00000000000..543e462c9dd --- /dev/null +++ b/doc_new/Doxygen.in @@ -0,0 +1,7 @@ +GENERATE_XML = YES +GENERATE_LATEX = NO +GENERATE_HTML = NO +HIDE_IN_BODY_DOCS = YES +EXTRACT_ALL = YES +INPUT = ../include +OUTPUT_DIRECTORY = . diff --git a/doc_new/Makefile b/doc_new/Makefile index aea89f6416a..8d8319ddb1a 100644 --- a/doc_new/Makefile +++ b/doc_new/Makefile @@ -2,4 +2,4 @@ all: sphinx-build -b html . html clean: - rm -rf html/ + rm -rf xml/ html/ diff --git a/doc_new/conf.py b/doc_new/conf.py index b333ebf2a8c..67129e1bf9c 100644 --- a/doc_new/conf.py +++ b/doc_new/conf.py @@ -3,6 +3,9 @@ # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +import os +import subprocess + # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information @@ -14,8 +17,10 @@ # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -extensions = [] - +# Doxygen support +extensions = ['breathe'] +breathe_default_project = "ltp" +breathe_projects = {'ltp': 'xml'} # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output @@ -23,5 +28,14 @@ html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] +def generate_doxygen_xml(app): + """ + Generate API documentation via Doxygen if we are not + inside a readthedocs server. + """ + if not os.environ.get('READTHEDOCS', None): + subprocess.call('doxygen Doxygen.in', shell=True) + def setup(app): app.add_css_file('custom.css') + app.connect("builder-inited", generate_doxygen_xml) diff --git a/doc_new/developers/api_c_tests.rst b/doc_new/developers/api_c_tests.rst index c03f9caf123..bc4fa96264f 100644 --- a/doc_new/developers/api_c_tests.rst +++ b/doc_new/developers/api_c_tests.rst @@ -1,4 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0-or-later +.. Include them in this file with: +.. .. doxygenfile:: tst_uid.h + Developing using C API ====================== diff --git a/doc_new/developers/api_kvm_tests.rst b/doc_new/developers/api_kvm_tests.rst index 1ef7ec45284..bf4cbefdf28 100644 --- a/doc_new/developers/api_kvm_tests.rst +++ b/doc_new/developers/api_kvm_tests.rst @@ -1,4 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0-or-later +.. Include them in this file with: +.. .. doxygenfile:: tst_uid.h + Developing using KVM API ======================== diff --git a/doc_new/developers/api_network_tests.rst b/doc_new/developers/api_network_tests.rst index 4fe45f5f663..43ff5e38f1a 100644 --- a/doc_new/developers/api_network_tests.rst +++ b/doc_new/developers/api_network_tests.rst @@ -1,4 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0-or-later +.. Include them in this file with: +.. .. doxygenfile:: tst_uid.h + Developing using network API ============================ diff --git a/doc_new/requirements.txt b/doc_new/requirements.txt index 59709ec7211..7442e49855c 100644 --- a/doc_new/requirements.txt +++ b/doc_new/requirements.txt @@ -1 +1,2 @@ sphinx-rtd-theme==2.0.0 +breathe==4.35.0