|
14 | 14 | # documentation root, use os.path.abspath to make it absolute, like shown here.
|
15 | 15 | #
|
16 | 16 | import os
|
| 17 | +from os.path import exists |
17 | 18 | import sys
|
18 |
| -from selfdrive.version import get_version |
| 19 | +from selfdrive.version import get_version |
| 20 | +from common.basedir import BASEDIR |
19 | 21 | sys.path.insert(0, os.path.abspath('.'))
|
20 | 22 | sys.path.insert(0, os.path.abspath('..'))
|
| 23 | + |
21 | 24 | VERSION = get_version()
|
22 | 25 |
|
23 | 26 |
|
|
37 | 40 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
38 | 41 | # ones.
|
39 | 42 | extensions = [
|
40 |
| - 'sphinx.ext.autodoc', # Auto-generate docs |
41 |
| - 'sphinx.ext.viewcode', # Add view code link to modules |
42 |
| - 'sphinx_rtd_theme', # Read The Docs theme |
43 |
| - 'myst_parser', # Markdown parsing |
44 |
| - 'sphinx_sitemap', # sitemap generation for SEO |
| 43 | + 'sphinx.ext.autodoc', # Auto-generate docs |
| 44 | + 'sphinx.ext.viewcode', # Add view code link to modules |
| 45 | + 'sphinx_rtd_theme', # Read The Docs theme |
| 46 | + 'myst_parser', # Markdown parsing |
| 47 | + 'breathe', # Doxygen C/C++ integration |
| 48 | + 'sphinx_sitemap', # sitemap generation for SEO |
45 | 49 | ]
|
46 | 50 |
|
47 | 51 | myst_html_meta = {
|
48 |
| - "description": "openpilot docs", |
49 |
| - "keywords": "op, openpilot, docs, documentation", |
50 |
| - "robots": "all,follow", |
51 |
| - "googlebot": "index,follow,snippet,archive", |
52 |
| - "property=og:locale": "en_US", |
53 |
| - "property=og:site_name": "docs.comma.ai", |
54 |
| - "property=og:url": "https://docs.comma.ai", |
55 |
| - "property=og:title": "openpilot Docuemntation", |
56 |
| - "property=og:type": "website", |
57 |
| - "property=og:image:type": "image/jpeg", |
58 |
| - "property=og:image:width": "400", |
59 |
| - "property=og:image": "https://docs.comma.ai/_static/logo.png", |
60 |
| - "property=og:image:url": "https://docs.comma.ai/_static/logo.png", |
61 |
| - "property=og:image:secure_url": "https://docs.comma.ai/_static/logo.png", |
62 |
| - "property=og:description": "openpilot Documentation", |
63 |
| - "property=twitter:card": "summary_large_image", |
64 |
| - "property=twitter:logo": "https://docs.comma.ai/_static/logo.png", |
65 |
| - "property=twitter:title": "openpilot Documentation", |
66 |
| - "property=twitter:description": "openpilot Documentation" |
| 52 | + "description": "openpilot docs", |
| 53 | + "keywords": "op, openpilot, docs, documentation", |
| 54 | + "robots": "all,follow", |
| 55 | + "googlebot": "index,follow,snippet,archive", |
| 56 | + "property=og:locale": "en_US", |
| 57 | + "property=og:site_name": "docs.comma.ai", |
| 58 | + "property=og:url": "https://docs.comma.ai", |
| 59 | + "property=og:title": "openpilot Docuemntation", |
| 60 | + "property=og:type": "website", |
| 61 | + "property=og:image:type": "image/jpeg", |
| 62 | + "property=og:image:width": "400", |
| 63 | + "property=og:image": "https://docs.comma.ai/_static/logo.png", |
| 64 | + "property=og:image:url": "https://docs.comma.ai/_static/logo.png", |
| 65 | + "property=og:image:secure_url": "https://docs.comma.ai/_static/logo.png", |
| 66 | + "property=og:description": "openpilot Documentation", |
| 67 | + "property=twitter:card": "summary_large_image", |
| 68 | + "property=twitter:logo": "https://docs.comma.ai/_static/logo.png", |
| 69 | + "property=twitter:title": "openpilot Documentation", |
| 70 | + "property=twitter:description": "openpilot Documentation" |
67 | 71 | }
|
68 | 72 |
|
69 | 73 | html_baseurl = 'https://docs.comma.ai/'
|
|
78 | 82 | exclude_patterns = []
|
79 | 83 |
|
80 | 84 |
|
| 85 | +# -- c docs configuration --------------------------------------------------- |
| 86 | + |
| 87 | +# Breathe Configuration |
| 88 | +# breathe_default_project = "c_docs" |
| 89 | +breathe_build_directory = f"{BASEDIR}/build/docs/html/xml" |
| 90 | +breathe_separate_member_pages = True |
| 91 | +breathe_default_members = ('members', 'private-members', 'undoc-members') |
| 92 | +breathe_domain_by_extension = { |
| 93 | + "h": "cc", |
| 94 | +} |
| 95 | +breathe_implementation_filename_extensions = ['.c', '.cc'] |
| 96 | +breathe_doxygen_config_options = {} |
| 97 | +breathe_projects_source = {} |
| 98 | + |
| 99 | +# only document files that have accompanying .cc files next to them |
| 100 | +print("searching for c_docs...") |
| 101 | +for root, dirs, files in os.walk(BASEDIR): |
| 102 | + found = False |
| 103 | + breath_src = {} |
| 104 | + breathe_srcs_list = [] |
| 105 | + |
| 106 | + for file in files: |
| 107 | + ccFile = os.path.join(root, file)[:-2] + ".cc" |
| 108 | + |
| 109 | + if file.endswith(".h") and exists(ccFile): |
| 110 | + f = os.path.join(root, file) |
| 111 | + |
| 112 | + parent_dir_abs = os.path.dirname(f) |
| 113 | + parent_dir = parent_dir_abs[len(BASEDIR) + 1:] |
| 114 | + project = parent_dir.replace('/', '_') |
| 115 | + print(f"\tFOUND: {f} in {project}") |
| 116 | + |
| 117 | + breathe_srcs_list.append(file) |
| 118 | + found = True |
| 119 | + |
| 120 | + if found: |
| 121 | + breath_src[project] = (parent_dir_abs, breathe_srcs_list) |
| 122 | + breathe_projects_source.update(breath_src) |
| 123 | + |
| 124 | +print(f"breathe_projects_source: {breathe_projects_source.keys()}") |
| 125 | + |
81 | 126 | # -- Options for HTML output -------------------------------------------------
|
82 | 127 |
|
83 | 128 | # The theme to use for HTML and HTML Help pages. See the documentation for
|
|
93 | 138 | html_logo = '_static/logo.png'
|
94 | 139 | html_favicon = '_static/favicon.ico'
|
95 | 140 | html_theme_options = {
|
96 |
| - 'logo_only': False, |
97 |
| - 'display_version': True, |
98 |
| - 'vcs_pageview_mode': 'blob', |
99 |
| - 'style_nav_header_background': '#000000', |
| 141 | + 'logo_only': False, |
| 142 | + 'display_version': True, |
| 143 | + 'vcs_pageview_mode': 'blob', |
| 144 | + 'style_nav_header_background': '#000000', |
100 | 145 | }
|
101 | 146 | html_extra_path = ['_static']
|
0 commit comments