diff --git a/docs/c_docs.rst b/docs/c_docs.rst new file mode 100644 index 0000000000..6527a569d5 --- /dev/null +++ b/docs/c_docs.rst @@ -0,0 +1,108 @@ +openpilot +========== + + +opendbc +------ +.. autodoxygenindex:: + :project: can + + + +cereal +------ + +messaging +^^^^^^^^^ +.. autodoxygenindex:: + :project: messaging + +visionipc +^^^^^^^^^ +.. autodoxygenindex:: + :project: visionipc + + + +selfdrive +--------- + +camerad +^^^^^^^ +.. autodoxygenindex:: + :project: cameras +.. autodoxygenindex:: + :project: transforms +.. autodoxygenindex:: + :project: imgproc +.. autodoxygenindex:: + :project: test + +locationd +^^^^^^^^^ +.. autodoxygenindex:: + :project: locationd +.. autodoxygenindex:: + :project: models + +ui +^^ +.. autodoxygenindex:: + :project: ui +.. autodoxygenindex:: + :project: soundd +.. autodoxygenindex:: + :project: navd +.. autodoxygenindex:: + :project: installer +.. autodoxygenindex:: + :project: replay + +qt +"" + +.. autodoxygenindex:: + :project: setup + +.. autodoxygenindex:: + :project: offroad +.. autodoxygenindex:: + :project: maps + +proclogd +^^^^^^^^ +.. autodoxygenindex:: + :project: proclogd + +modeld +^^^^^^ +.. autodoxygenindex:: + :project: transforms +.. autodoxygenindex:: + :project: models +.. autodoxygenindex:: + :project: thneed +.. autodoxygenindex:: + :project: runners + +common +^^^^^^ +.. autodoxygenindex:: + :project: common + +sensorsd +^^^^^^^^ +.. autodoxygenindex:: + :project: sensors + +boardd +^^^^^^ +.. autodoxygenindex:: + :project: boardd + + + +rednose +------- +.. autodoxygenindex:: + :project: helpers \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 0d33637a14..4f692c9277 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,10 +14,11 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os +from os.path import exists import sys sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath('..')) - +OPENPILOT_ROOT = os.path.abspath(r'../../') # from openpilot/build/docs # -- Project information ----------------------------------------------------- @@ -37,6 +38,7 @@ extensions = [ 'sphinx.ext.viewcode', # Add view code link to modules 'sphinx_rtd_theme', # Read The Docs theme 'myst_parser', # Markdown parsing + 'breathe', # Doxygen C/C++ integration ] # Add any paths that contain templates here, relative to this directory. @@ -48,6 +50,51 @@ templates_path = ['_templates'] exclude_patterns = [] +# -- c docs configuration --------------------------------------------------- + +# Breathe Configuration +# breathe_default_project = "c_docs" +breathe_build_directory = f"{OPENPILOT_ROOT}/build/docs/html/xml" +breathe_separate_member_pages = True +breathe_default_members = ('members', 'private-members', 'undoc-members') +breathe_domain_by_extension = { + "h" : "cc", + } +breathe_implementation_filename_extensions = ['.c', '.cc', '.cpp'] +breathe_doxygen_config_options = {} +breathe_projects_source = { + # "loggerd" : ("../../../selfdrive/loggerd", ["logger.h"]) + } + +# only document files that have accompanying .cc files next to them +print("searching for c_docs...") +for root, dirs, files in os.walk(OPENPILOT_ROOT): + found = False + breath_src = {} + breathe_srcs_list = [] + + for file in files: + ccFile = os.path.join(root, file)[:-2] +".cc" + + if file.endswith(".h") and exists(ccFile): + f = os.path.join(root, file) + parent_dir = os.path.basename(os.path.dirname(f)) + parent_dir_abs = os.path.dirname(f) + print(f"\tFOUND: {f} in {parent_dir} ({parent_dir_abs})") + + breathe_srcs_list.append(file) + # breathe_srcs_list.append(ccFile) + found = True + + # print(f"\tbreathe_srcs_list: {breathe_srcs_list}") + + if found: + breath_src[parent_dir] = (parent_dir_abs, breathe_srcs_list) + breathe_projects_source.update(breath_src) + +print(f"breathe_projects_source: {breathe_projects_source.keys()}") +# input("Press Enter to continue...") + # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for diff --git a/docs/index.md b/docs/index.md index 5a171ae91d..0fb2617a5b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -28,8 +28,15 @@ overview.rst - {ref}`search` ```{toctree} -:caption: 'Modules' +:caption: 'Python API' :maxdepth: 2 modules.rst ``` + +```{toctree} +:caption: 'C/C++ API' +:maxdepth: 4 + +c_docs.rst +``` \ No newline at end of file