blob: d3f73613ed5553d38c9aeb885b630a22e7a6127a [file] [log] [blame]
Wenzel Jakob28f98aa2015-10-13 02:57:16 +02001#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# pybind11 documentation build configuration file, created by
5# sphinx-quickstart on Sun Oct 11 19:23:48 2015.
6#
7# This file is execfile()d with the current directory set to its
8# containing dir.
9#
10# Note that not all possible configuration values are present in this
11# autogenerated file.
12#
13# All configuration values have a default; values that are commented out
14# serve to show the default.
15
16import sys
17import os
18import shlex
Dean Moldovan57a9bbc2017-01-31 16:54:08 +010019import subprocess
Wenzel Jakob28f98aa2015-10-13 02:57:16 +020020
21# If extensions (or modules to document with autodoc) are in another directory,
22# add these directories to sys.path here. If the directory is relative to the
23# documentation root, use os.path.abspath to make it absolute, like shown here.
24#sys.path.insert(0, os.path.abspath('.'))
25
26# -- General configuration ------------------------------------------------
27
28# If your documentation needs a minimal Sphinx version, state it here.
29#needs_sphinx = '1.0'
30
31# Add any Sphinx extension module names here, as strings. They can be
32# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33# ones.
Henry Schreiner81555ce2020-09-17 15:40:09 -040034extensions = ['breathe', 'sphinx.ext.imgconverter']
Dean Moldovan57a9bbc2017-01-31 16:54:08 +010035
36breathe_projects = {'pybind11': '.build/doxygenxml/'}
37breathe_default_project = 'pybind11'
38breathe_domain_by_extension = {'h': 'cpp'}
Wenzel Jakob28f98aa2015-10-13 02:57:16 +020039
40# Add any paths that contain templates here, relative to this directory.
41templates_path = ['.templates']
42
43# The suffix(es) of source filenames.
44# You can specify multiple suffix as a list of string:
45# source_suffix = ['.rst', '.md']
46source_suffix = '.rst'
47
48# The encoding of source files.
49#source_encoding = 'utf-8-sig'
50
51# The master toctree document.
52master_doc = 'index'
53
54# General information about the project.
55project = 'pybind11'
Wenzel Jakobd405b1b2017-03-22 22:20:07 +010056copyright = '2017, Wenzel Jakob'
Wenzel Jakob28f98aa2015-10-13 02:57:16 +020057author = 'Wenzel Jakob'
58
59# The version info for the project you're documenting, acts as replacement for
60# |version| and |release|, also used in various other places throughout the
61# built documents.
Henry Schreiner99ef2b82020-09-17 09:08:08 -040062
63# Read the listed version
64with open("../pybind11/_version.py") as f:
65 code = compile(f.read(), "../pybind11/_version.py", "exec")
66loc = {}
67exec(code, loc)
68
Wenzel Jakob28f98aa2015-10-13 02:57:16 +020069# The full version, including alpha/beta/rc tags.
Henry Schreiner99ef2b82020-09-17 09:08:08 -040070version = loc["__version__"]
Wenzel Jakob28f98aa2015-10-13 02:57:16 +020071
72# The language for content autogenerated by Sphinx. Refer to documentation
73# for a list of supported languages.
74#
75# This is also used if you do content translation via gettext catalogs.
76# Usually you set "language" from the command line for these cases.
77language = None
78
79# There are two options for replacing |today|: either, you set today to some
80# non-false value, then it is used:
81#today = ''
82# Else, today_fmt is used as the format for a strftime call.
83#today_fmt = '%B %d, %Y'
84
85# List of patterns, relative to source directory, that match files and
86# directories to ignore when looking for source files.
Dean Moldovanaebca122016-08-16 01:26:02 +020087exclude_patterns = ['.build', 'release.rst']
Wenzel Jakob28f98aa2015-10-13 02:57:16 +020088
89# The reST default role (used for this markup: `text`) to use for all
90# documents.
Dean Moldovan57a9bbc2017-01-31 16:54:08 +010091default_role = 'any'
Wenzel Jakob28f98aa2015-10-13 02:57:16 +020092
93# If true, '()' will be appended to :func: etc. cross-reference text.
94#add_function_parentheses = True
95
96# If true, the current module name will be prepended to all description
97# unit titles (such as .. function::).
98#add_module_names = True
99
100# If true, sectionauthor and moduleauthor directives will be shown in the
101# output. They are ignored by default.
102#show_authors = False
103
104# The name of the Pygments (syntax highlighting) style to use.
105#pygments_style = 'monokai'
106
107# A list of ignored prefixes for module index sorting.
108#modindex_common_prefix = []
109
110# If true, keep warnings as "system message" paragraphs in the built documents.
111#keep_warnings = False
112
113# If true, `todo` and `todoList` produce output, else they produce nothing.
114todo_include_todos = False
115
116
117# -- Options for HTML output ----------------------------------------------
118
119# The theme to use for HTML and HTML Help pages. See the documentation for
120# a list of builtin themes.
121
122on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
123
124if not on_rtd: # only import and set the theme if we're building docs locally
125 import sphinx_rtd_theme
126 html_theme = 'sphinx_rtd_theme'
127 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
Wenzel Jakobbda3b672015-12-07 18:25:38 +0100128
Wenzel Jakob93296692015-10-13 23:21:54 +0200129 html_context = {
130 'css_files': [
Wenzel Jakobbda3b672015-12-07 18:25:38 +0100131 '_static/theme_overrides.css'
Wenzel Jakob93296692015-10-13 23:21:54 +0200132 ]
133 }
Wenzel Jakobbda3b672015-12-07 18:25:38 +0100134else:
135 html_context = {
136 'css_files': [
Henry Schreinerd8c7ee02020-07-20 13:35:21 -0400137 '//media.readthedocs.org/css/sphinx_rtd_theme.css',
138 '//media.readthedocs.org/css/readthedocs-doc-embed.css',
Wenzel Jakobbda3b672015-12-07 18:25:38 +0100139 '_static/theme_overrides.css'
140 ]
141 }
Wenzel Jakob28f98aa2015-10-13 02:57:16 +0200142
143# Theme options are theme-specific and customize the look and feel of a theme
144# further. For a list of options available for each theme, see the
145# documentation.
146#html_theme_options = {}
147
148# Add any paths that contain custom themes here, relative to this directory.
149#html_theme_path = []
150
151# The name for this set of Sphinx documents. If None, it defaults to
Henry Schreiner99ef2b82020-09-17 09:08:08 -0400152# "<project> v<version> documentation".
Wenzel Jakob28f98aa2015-10-13 02:57:16 +0200153#html_title = None
154
155# A shorter title for the navigation bar. Default is the same as html_title.
156#html_short_title = None
157
158# The name of an image file (relative to this directory) to place at the top
159# of the sidebar.
160#html_logo = None
161
162# The name of an image file (within the static path) to use as favicon of the
163# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
164# pixels large.
165#html_favicon = None
166
167# Add any paths that contain custom static files (such as style sheets) here,
168# relative to this directory. They are copied after the builtin static files,
169# so a file named "default.css" will overwrite the builtin "default.css".
Wenzel Jakobe84f5572016-04-26 23:19:19 +0200170html_static_path = ['_static']
Wenzel Jakob28f98aa2015-10-13 02:57:16 +0200171
172# Add any extra paths that contain custom files (such as robots.txt or
173# .htaccess) here, relative to this directory. These files are copied
174# directly to the root of the documentation.
175#html_extra_path = []
176
177# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
178# using the given strftime format.
179#html_last_updated_fmt = '%b %d, %Y'
180
181# If true, SmartyPants will be used to convert quotes and dashes to
182# typographically correct entities.
183#html_use_smartypants = True
184
185# Custom sidebar templates, maps document names to template names.
186#html_sidebars = {}
187
188# Additional templates that should be rendered to pages, maps page names to
189# template names.
190#html_additional_pages = {}
191
192# If false, no module index is generated.
193#html_domain_indices = True
194
195# If false, no index is generated.
196#html_use_index = True
197
198# If true, the index is split into individual pages for each letter.
199#html_split_index = False
200
201# If true, links to the reST sources are added to the pages.
202#html_show_sourcelink = True
203
204# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
205#html_show_sphinx = True
206
207# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
208#html_show_copyright = True
209
210# If true, an OpenSearch description file will be output, and all pages will
211# contain a <link> tag referring to it. The value of this option must be the
212# base URL from which the finished HTML is served.
213#html_use_opensearch = ''
214
215# This is the file name suffix for HTML files (e.g. ".xhtml").
216#html_file_suffix = None
217
218# Language to be used for generating the HTML full-text search index.
219# Sphinx supports the following languages:
220# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
221# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
222#html_search_language = 'en'
223
224# A dictionary with options for the search language support, empty by default.
225# Now only 'ja' uses this config value
226#html_search_options = {'type': 'default'}
227
228# The name of a javascript file (relative to the configuration directory) that
229# implements a search results scorer. If empty, the default will be used.
230#html_search_scorer = 'scorer.js'
231
232# Output file base name for HTML help builder.
233htmlhelp_basename = 'pybind11doc'
234
235# -- Options for LaTeX output ---------------------------------------------
236
237latex_elements = {
238# The paper size ('letterpaper' or 'a4paper').
239#'papersize': 'letterpaper',
240
241# The font size ('10pt', '11pt' or '12pt').
242#'pointsize': '10pt',
243
244# Additional stuff for the LaTeX preamble.
Henry Schreiner81555ce2020-09-17 15:40:09 -0400245'preamble': r'''
246\DeclareUnicodeCharacter{00A0}{}
247\DeclareUnicodeCharacter{2194}{<->}
248''',
Wenzel Jakob28f98aa2015-10-13 02:57:16 +0200249
250# Latex figure (float) alignment
251#'figure_align': 'htbp',
252}
253
254# Grouping the document tree into LaTeX files. List of tuples
255# (source start file, target name, title,
256# author, documentclass [howto, manual, or own class]).
257latex_documents = [
258 (master_doc, 'pybind11.tex', 'pybind11 Documentation',
259 'Wenzel Jakob', 'manual'),
260]
261
262# The name of an image file (relative to this directory) to place at the top of
263# the title page.
Wenzel Jakobf64feaf2016-04-28 14:33:45 +0200264# latex_logo = 'pybind11-logo.png'
Wenzel Jakob28f98aa2015-10-13 02:57:16 +0200265
266# For "manual" documents, if this is true, then toplevel headings are parts,
267# not chapters.
268#latex_use_parts = False
269
270# If true, show page references after internal links.
271#latex_show_pagerefs = False
272
273# If true, show URL addresses after external links.
274#latex_show_urls = False
275
276# Documents to append as an appendix to all manuals.
277#latex_appendices = []
278
279# If false, no module index is generated.
280#latex_domain_indices = True
281
282
283# -- Options for manual page output ---------------------------------------
284
285# One entry per manual page. List of tuples
286# (source start file, name, description, authors, manual section).
287man_pages = [
288 (master_doc, 'pybind11', 'pybind11 Documentation',
289 [author], 1)
290]
291
292# If true, show URL addresses after external links.
293#man_show_urls = False
294
295
296# -- Options for Texinfo output -------------------------------------------
297
298# Grouping the document tree into Texinfo files. List of tuples
299# (source start file, target name, title, author,
300# dir menu entry, description, category)
301texinfo_documents = [
302 (master_doc, 'pybind11', 'pybind11 Documentation',
303 author, 'pybind11', 'One line description of project.',
304 'Miscellaneous'),
305]
306
307# Documents to append as an appendix to all manuals.
308#texinfo_appendices = []
309
310# If false, no module index is generated.
311#texinfo_domain_indices = True
312
313# How to display URL addresses: 'footnote', 'no', or 'inline'.
314#texinfo_show_urls = 'footnote'
315
316# If true, do not generate a @detailmenu in the "Top" node's menu.
317#texinfo_no_detailmenu = False
318
319primary_domain = 'cpp'
320highlight_language = 'cpp'
Dean Moldovan57a9bbc2017-01-31 16:54:08 +0100321
322
323def generate_doxygen_xml(app):
Dean Moldovan8665ee82017-08-17 15:01:43 +0200324 build_dir = os.path.join(app.confdir, '.build')
Dean Moldovan57a9bbc2017-01-31 16:54:08 +0100325 if not os.path.exists(build_dir):
326 os.mkdir(build_dir)
327
328 try:
329 subprocess.call(['doxygen', '--version'])
Dean Moldovan8665ee82017-08-17 15:01:43 +0200330 retcode = subprocess.call(['doxygen'], cwd=app.confdir)
Dean Moldovan57a9bbc2017-01-31 16:54:08 +0100331 if retcode < 0:
332 sys.stderr.write("doxygen error code: {}\n".format(-retcode))
333 except OSError as e:
334 sys.stderr.write("doxygen execution failed: {}\n".format(e))
335
336
337def setup(app):
338 """Add hook for building doxygen xml when needed"""
339 app.connect("builder-inited", generate_doxygen_xml)