1# pylint: disable=C0103,C0114,C0116,C0301,E0402,W0622 2# 3# Configuration file for Verilator's Sphinx documentation builder. 4# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 5# 6# This file only contains overridden options. For a full list: 7# https://www.sphinx-doc.org/en/master/usage/configuration.html 8# 9# ---------------------------------------------------------------------- 10# -- Path setup 11 12from datetime import datetime 13import os 14import re 15import sys 16sys.path.insert(0, os.path.abspath('./_ext')) 17 18import sphinx_rtd_theme # pylint: disable=wrong-import-position, 19 20 21def get_vlt_version(): 22 filename = "../../Makefile" 23 with open(filename) as fh: 24 for line in fh: 25 match = re.search(r"PACKAGE_VERSION_NUMBER *= *([a-z0-9.]+)", line) 26 if match: 27 return match.group(1) 28 return "unknown" 29 30 31def setup(app): 32 app.add_css_file('css/vlt_sphinx.css') 33 34 35# ---------------------------------------------------------------------- 36# -- Project information 37 38project = 'Verilator' 39copyright = '2021 by Wilson Snyder, under LGPL-3.0 or Artistic-2.0' 40author = 'Wilson Snyder' 41 42# The master toctree document. 43master_doc = "index" 44 45version = get_vlt_version() 46release = get_vlt_version() 47 48rst_prolog = """ 49.. role:: vlopt(option) 50""" 51 52# ---------------------------------------------------------------------- 53# -- General configuration 54 55# Add any Sphinx extension module names here, as strings. They can be 56# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 57# ones. 58# To install: 59# sudo install enchant 60# sudo pip3 install sphinx sphinx_rtd_theme breathe sphinxcontrib-spelling 61# We keep this list empty for now to avoid needing dependencies 62extensions = [] 63# extensions = ['breathe', 'sphinxcontrib.spelling'] 64 65# List of patterns, relative to source directory, that match files and 66# directories to ignore when looking for source files. 67# This pattern also affects html_static_path and html_extra_path. 68exclude_patterns = [ 69 '_build', 'Thumbs.db', '.DS_Store', 'internals.rst', 'xml.rst', 'gen/ex_*', 70 'CONTRIBUTING.rst' 71] 72 73# Warn about refs 74nitpicky = True 75nitpicky_ignore = [] 76 77# Number figures for referencing 78numfig = True 79 80# The name of the Pygments (syntax highlighting) style to use. 81pygments_style = "sphinx" 82 83# The suffix(es) of source filenames. 84# You can specify multiple suffix as a list of string: 85source_suffix = [".rst"] 86 87# Add any paths that contain templates here, relative to this directory. 88templates_path = ['_templates'] 89 90# Date format to ISO 91today_fmt = datetime.now().strftime("%F") 92 93# If true, `todo` and `todoList` produce output, else they produce nothing. 94todo_include_todos = True 95 96# Could use this for internals<->guide references 97# intersphinx_mapping = { 'sphinx': ('https://sphinx-doc.org/', None), } 98 99# ---------------------------------------------------------------------- 100# -- Options for HTML output 101 102# html_baseurl = 103 104html_domain_indices = False 105 106html_logo = "../_static/verilator_192_150_min.png" 107 108html_theme = 'sphinx_rtd_theme' 109html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] 110 111html_theme_options = { 112 'analytics_id': 'G-D27B0C9QEB', 113 'logo_only': True, 114 'style_nav_header_background': "#45acf8", # Default is #2980B9 115 # 'canonical_url': 116} 117 118html_context = { 119 'display_github': True, 120 'github_user': 'verilator', 121 'github_repo': 'verilator', 122 'github_version': 'master/docs/guide/', 123} 124 125# Add any paths that contain custom static files (such as style sheets) here, 126# relative to this directory. They are copied after the builtin static files, 127# so a file named "default.css" will overwrite the builtin "default.css". 128html_static_path = ['../_static'] 129 130# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 131html_show_sphinx = False 132 133html_copy_source = False 134html_show_sourcelink = False 135 136html_use_index = False 137 138html_favicon = "../_static/verilator_32x32_min.png" 139 140# Custom sidebar templates, maps document names to template names. 141# html_sidebars 142 143# Add any extra paths that contain custom files (such as robots.txt or 144# .htaccess) here, relative to this directory. These files are copied 145# directly to the root of the documentation. 146# html_extra_path = [] 147 148# Additional templates that should be rendered to pages, maps page names to 149# template names. 150# html_additional_pages = {} 151 152# ---------------------------------------------------------------------- 153# -- Options for Latex output 154 155latex_logo = "../_static/verilator_logo.png" 156 157latex_elements = { 158 'extraclassoptions': 'openany,oneside', 159 'papersize': 'letterpaper', 160 'makeindex': '', 161 'printindex': '', 162 # 'pointsize': '10pt', 163 # 'preamble': '', 164} 165 166# Grouping the document tree into LaTeX files. List of tuples 167# (source start file, target name, title, 168# author, documentclass [howto, manual, or own class]). 169# latex_documents = [ 170# ( 171# master_doc, 172# "Verilog-to-Routing.tex", 173# "Verilog-to-Routing Documentation", 174# "VTR Developers", 175# "manual", 176# ), 177# ] 178 179# For "manual" documents, if this is true, then toplevel headings are parts, 180# not chapters. 181# latex_use_parts = False 182 183# If true, show page references after internal links. 184# latex_show_pagerefs = False 185 186# If true, show URL addresses after external links. 187# latex_show_urls = False 188 189latex_domain_indices = False 190 191# ---------------------------------------------------------------------- 192# -- Options for manual page output 193 194# One entry per manual page. List of tuples 195# (source start file, name, description, authors, manual section). 196# man_pages = [(master_doc, "verilog-to-routing", "Verilog-to-Routing Documentation", [author], 1)] 197 198# If true, show URL addresses after external links. 199# man_show_urls = False 200 201# ---------------------------------------------------------------------- 202# -- Options for spelling 203 204spelling_word_list_filename = ['spelling.txt'] 205spelling_ignore_contributor_names = True 206 207# ---------------------------------------------------------------------- 208# -- Options for doxygen 209 210# if shutil.which("doxygen"): 211# breathe_projects = { 212# "verilated": "../_build/doxygen/verilated/xml", 213# } 214# breathe_default_project = "verilated" 215# 216# if not os.environ.get("SKIP_DOXYGEN", None) == "True": 217# for prjname, prjdir in breathe_projects.items(): 218# print("Generating doxygen files for {}...".format(prjname)) 219# os.makedirs(prjdir, exist_ok=True) 220# cmd = "cd ../_doxygen && doxygen {}.dox".format(prjname) 221# subprocess.call(cmd, shell=True) 222# else: 223# for prjname, prjdir in breathe_projects.items(): 224# assert os.path.exists(prjdir) == True, "Regenerate doxygen XML for {}".format(prjname) 225 226breathe_projects = {"verilated": "_build/doxygen/verilated/xml/"} 227breathe_default_project = "verilated" 228breathe_default_members = ('members') 229