summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGereon Kremer <gkremer@stanford.edu>2021-05-04 18:33:59 +0200
committerGitHub <noreply@github.com>2021-05-04 18:33:59 +0200
commitf41ae5481e9eb68aeeb87d57fca89e63501c6213 (patch)
tree5d012529e08b89f7a4ef4deb57c542ae111059e8 /docs
parent441c53b1a68cc16a345eb0dc8d9956c1301ed509 (diff)
Improve generation of python API documentation (#6482)
This PR makes generating the python part of our API documentation more reliable. If python bindings are enabled, it makes the docs target depend on pycvc5 and renders a warning into the documentation if python bindings are disabled. To make the dependency on pycvc5 work properly, it changes the python bindings build so that the library is directly put in the right place and avoid the manual rename, so that the pycvc5 target actually points to the correct file. Unfortunately, this means we need to build libcvc5 when building docs with python bindings enabled.
Diffstat (limited to 'docs')
-rw-r--r--docs/CMakeLists.txt3
-rw-r--r--docs/conf.py.in5
-rw-r--r--docs/python/CMakeLists.txt21
-rw-r--r--docs/python/python.rst6
4 files changed, 34 insertions, 1 deletions
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index b08668afa..4c5d9aa6c 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -18,6 +18,7 @@ check_python_module(sphinxcontrib.bibtex sphinxcontrib-bibtex)
check_python_module(sphinx_tabs.tabs sphinx-tabs)
add_subdirectory(cpp)
+add_subdirectory(python)
set(SPHINX_INPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SPHINX_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx)
@@ -25,7 +26,7 @@ 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
+ DEPENDS docs-cpp docs-python
COMMAND
${SPHINX_EXECUTABLE} -b html
-c ${CMAKE_CURRENT_BINARY_DIR}
diff --git a/docs/conf.py.in b/docs/conf.py.in
index 28e8fa04c..f6e75b9b5 100644
--- a/docs/conf.py.in
+++ b/docs/conf.py.in
@@ -18,6 +18,11 @@ sys.path.insert(0, '${CMAKE_CURRENT_SOURCE_DIR}/ext/')
# path to python api
sys.path.insert(0, '${CMAKE_BINARY_DIR}/src/api/python')
+if("${BUILD_BINDINGS_PYTHON}" == "ON"):
+ tags.add('bindings_python')
+if("${BUILD_BINDINGS_JAVA}" == "ON"):
+ tags.add('bindings_java')
+
# -- Project information -----------------------------------------------------
diff --git a/docs/python/CMakeLists.txt b/docs/python/CMakeLists.txt
new file mode 100644
index 000000000..cdac14de0
--- /dev/null
+++ b/docs/python/CMakeLists.txt
@@ -0,0 +1,21 @@
+###############################################################################
+# Top contributors (to current version):
+# Gereon Kremer
+#
+# This file is part of the cvc5 project.
+#
+# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
+# in the top-level source directory and their institutional affiliations.
+# All rights reserved. See the file COPYING in the top-level source
+# directory for licensing information.
+# #############################################################################
+#
+# Build system configuration for python API documentation.
+##
+
+add_custom_target(docs-python)
+
+if (BUILD_BINDINGS_PYTHON)
+ # Python API docs are generated from built python API
+ add_dependencies(docs-python pycvc5)
+endif()
diff --git a/docs/python/python.rst b/docs/python/python.rst
index 6d094488f..50d9077df 100644
--- a/docs/python/python.rst
+++ b/docs/python/python.rst
@@ -1,6 +1,12 @@
Python API Documentation
========================
+.. only:: not bindings_python
+
+ .. warning::
+
+ This documentation was built while python bindings were disabled. This part of the documentation is likely either empty or outdated. Please enable :code:`BUILD_BINDINGS_PYTHON` in :code:`cmake` and build the documentation again.
+
.. toctree::
:maxdepth: 2
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback