diff options
author | yoni206 <yoni206@users.noreply.github.com> | 2021-03-30 17:11:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-30 17:11:10 -0700 |
commit | 7ff3e6300f3adb64867b636c7638ee4e8b00ce5a (patch) | |
tree | 4dccf30b5a8cb5c837510a50b7b5cd8abc692a87 /src/api/python | |
parent | 5250e3714929164004f8dd5d7551a07f888ee311 (diff) |
Fix compilation of Python bindings for named build directories (#6244)
In current master, the following fails whenever <name> contains a /:
./configure.sh --python-bindings --name=<name>
The reason is that src/api/python/genkinds.py adds a directory to the python path while relying on the fact that the build directory is located directly under the main repo directory, which is not the case if <name> contains a /.
This PR fixes this by having cmake determine the right directory to add to the python path.
Diffstat (limited to 'src/api/python')
-rw-r--r-- | src/api/python/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/api/python/genkinds.py.in (renamed from src/api/python/genkinds.py) | 7 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/api/python/CMakeLists.txt b/src/api/python/CMakeLists.txt index b400c14e5..62482a0ba 100644 --- a/src/api/python/CMakeLists.txt +++ b/src/api/python/CMakeLists.txt @@ -26,12 +26,13 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories("${CMAKE_BINARY_DIR}/src/") # Generate cvc4kinds.{pxd,pyx} +configure_file(genkinds.py.in genkinds.py) add_custom_target( gen-pycvc4-kinds ALL COMMAND "${PYTHON_EXECUTABLE}" - "${CMAKE_CURRENT_LIST_DIR}/genkinds.py" + "${CMAKE_CURRENT_BINARY_DIR}/genkinds.py" --kinds-header "${PROJECT_SOURCE_DIR}/src/api/cvc4cppkind.h" --kinds-file-prefix "${CMAKE_CURRENT_BINARY_DIR}/cvc4kinds" DEPENDS diff --git a/src/api/python/genkinds.py b/src/api/python/genkinds.py.in index 30ee18708..0f8ba4b45 100644 --- a/src/api/python/genkinds.py +++ b/src/api/python/genkinds.py.in @@ -25,11 +25,8 @@ import argparse import os import sys -# the following command in CVC4/build/src/api/python/CMakeFiles/gen-pycvc4-kinds.dir/build.make -# cd CVC4/build/src/api/python && /usr/bin/python3 CVC4/src/api/python/genkinds.py ... -# indicates we are in directory CVC4/build/src/api/python -# so we use ../../../../src/api to access CVC4/src/api/parsekinds.py -sys.path.insert(0, os.path.abspath('../../../../src/api')) +# get access to CVC4/src/api/parsekinds.py +sys.path.insert(0, os.path.abspath('${CMAKE_SOURCE_DIR}/src/api')) from parsekinds import * |