From 23df1d5ed33207880f15f73b5e86580ac056e4ef Mon Sep 17 00:00:00 2001 From: Gereon Kremer Date: Mon, 26 Apr 2021 22:48:40 +0200 Subject: [PATCH] Generate docs conf.py by cmake (#6441) This PR makes cmake generate the sphinx configuration file. This will simplify dynamically modifying this file in the future, for example to add custom paths within the build directory (for the python API). --- docs/CMakeLists.txt | 5 ++++- docs/{conf.py => conf.py.in} | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) rename docs/{conf.py => conf.py.in} (92%) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 4e18c0ba9..23e3c2dd6 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -22,14 +22,17 @@ add_subdirectory(cpp) set(SPHINX_INPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(SPHINX_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx) +configure_file(conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py) + add_custom_target(docs ALL DEPENDS docs-cpp COMMAND ${SPHINX_EXECUTABLE} -b html + -c ${CMAKE_CURRENT_BINARY_DIR} # Tell Breathe where to find the Doxygen output -Dbreathe_projects.cvc5=${CPP_DOXYGEN_XML_FOLDER} ${SPHINX_INPUT_DIR} ${SPHINX_OUTPUT_DIR} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating Sphinx Api docs") set(SPHINX_GH_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx-gh) diff --git a/docs/conf.py b/docs/conf.py.in similarity index 92% rename from docs/conf.py rename to docs/conf.py.in index 91a3b3a9a..12bfa9ed0 100644 --- a/docs/conf.py +++ b/docs/conf.py.in @@ -10,9 +10,10 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -import os + import sys -sys.path.insert(0, os.path.abspath('ext/')) +# add path to enable extensions +sys.path.insert(0, '${CMAKE_CURRENT_SOURCE_DIR}/ext/') # -- Project information ----------------------------------------------------- @@ -53,7 +54,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # html_theme = 'sphinx_rtd_theme' html_theme_options = {} -html_static_path = ['_static'] +html_static_path = ['${CMAKE_CURRENT_SOURCE_DIR}/_static/'] html_css_files = ['custom.css'] # -- Breathe configuration --------------------------------------------------- -- 2.30.2