summaryrefslogtreecommitdiff
path: root/src/api/python
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 /src/api/python
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 'src/api/python')
-rw-r--r--src/api/python/CMakeLists.txt12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/api/python/CMakeLists.txt b/src/api/python/CMakeLists.txt
index 227872aa7..c6686e32b 100644
--- a/src/api/python/CMakeLists.txt
+++ b/src/api/python/CMakeLists.txt
@@ -73,26 +73,20 @@ set_target_properties(pycvc5
COMPILE_FLAGS
"-Wno-error -Wno-shadow -Wno-implicit-fallthrough"
CXX_VISIBILITY_PRESET default
- VISIBILITY_INLINES_HIDDEN 0)
+ VISIBILITY_INLINES_HIDDEN 0
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pycvc5")
python_extension_module(pycvc5)
# Installation based on https://bloerg.net/2012/11/10/cmake-and-distutils.html
# Create a wrapper python directory and generate a distutils setup.py file
configure_file(setup.py.in setup.py)
-set(PYCVC5_MODULE "${CMAKE_CURRENT_BINARY_DIR}/pycvc5")
-file(MAKE_DIRECTORY "${PYCVC5_MODULE}")
-file(WRITE ${PYCVC5_MODULE}/__init__.py
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pycvc5/__init__.py
"import sys
from .pycvc5 import *
# fake a submodule for dotted imports, e.g. from pycvc5.kinds import *
sys.modules['%s.%s'%(__name__, kinds.__name__)] = kinds")
-set(PYCVC5_LOC "${PYCVC5_MODULE}/$<TARGET_FILE_NAME:pycvc5>")
-add_custom_command(TARGET pycvc5 POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:pycvc5> ${PYCVC5_LOC}
-)
-
# figure out if we're in a virtualenv
execute_process(OUTPUT_VARIABLE IN_VIRTUALENV
COMMAND
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback