doc: Make conf.py work on readthedocs

rtd scans the project for a conf.py file so we cannot name it conf.py.in
unless we get rtd to run cmake before building.

The easier option is to have doc/conf.py be the file used by rtd and all
other builds use cmake to first configure it.
This commit is contained in:
patrick96 2019-01-03 20:24:21 +01:00 committed by Patrick Ziegler
parent 3111bee143
commit bbdcbee068
2 changed files with 15 additions and 6 deletions

View File

@ -102,7 +102,8 @@ if(NOT SPHINX_EXECUTABLE)
message_colored(FATAL_ERROR "Failed to locate sphinx-build" 31) message_colored(FATAL_ERROR "Failed to locate sphinx-build" 31)
endif() endif()
configure_file(conf.py.in conf.py @ONLY) # Configures conf.py in the current folder and puts it in the build folder
configure_file(conf.py conf.py @ONLY)
set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build") set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build")
separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}") separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}")

View File

@ -28,6 +28,17 @@ version = '@APP_VERSION@'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = version release = version
# is whether we are on readthedocs.io
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# Set path to documentation
if on_rtd:
# On readthedocs conf.py is already in the doc folder
doc_path = '.'
else:
# In all other builds conf.py is configured with cmake and put into the
# build folder.
doc_path = '@doc_path@'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
@ -42,7 +53,7 @@ extensions = [
] ]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['@doc_path@/_templates'] templates_path = [doc_path + '/_templates']
# The suffix(es) of source filenames. # The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string: # You can specify multiple suffix as a list of string:
@ -71,9 +82,6 @@ pygments_style = None
# -- Options for HTML output ------------------------------------------------- # -- Options for HTML output -------------------------------------------------
# is whether we are on readthedocs.io
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
# #
@ -91,7 +99,7 @@ else:
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['@doc_path@/_static'] html_static_path = [doc_path + '/_static']
# Custom sidebar templates, must be a dictionary that maps document names # Custom sidebar templates, must be a dictionary that maps document names
# to template names. # to template names.