summaryrefslogtreecommitdiff
path: root/src/api/python/CMakeLists.txt
diff options
context:
space:
mode:
authormakaimann <makaim@stanford.edu>2020-02-19 13:54:17 -0800
committerGitHub <noreply@github.com>2020-02-19 15:54:17 -0600
commitc82720479efcf922136f0919f6fc26a502b2515a (patch)
treef9007e124cfc07490e914ae1e1e05747e1e1ee11 /src/api/python/CMakeLists.txt
parentc6a9ab9da205df7cbf192edc142ee151404dcb1b (diff)
Add Python bindings using Cython -- see below for more details (#2879)
Diffstat (limited to 'src/api/python/CMakeLists.txt')
-rw-r--r--src/api/python/CMakeLists.txt42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/api/python/CMakeLists.txt b/src/api/python/CMakeLists.txt
new file mode 100644
index 000000000..166a728de
--- /dev/null
+++ b/src/api/python/CMakeLists.txt
@@ -0,0 +1,42 @@
+if(POLICY CMP0057)
+ # For cmake >= 3.3 this policy changed the behavior of IN_LIST
+ # if the policy exists, we use the NEW behavior
+ cmake_policy(SET CMP0057 NEW)
+endif()
+
+find_package(PythonExtensions REQUIRED)
+find_package(Cython 0.29 REQUIRED)
+
+include_directories(${PYTHON_INCLUDE_DIRS})
+include_directories(${CMAKE_CURRENT_LIST_DIR}) # cvc4kinds.pxd
+include_directories(${PROJECT_SOURCE_DIR}/src)
+include_directories(${PROJECT_SOURCE_DIR}/src/include)
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+# TEMP: Only needed while expr/kind.h is public in the C++ api
+include_directories("${CMAKE_BINARY_DIR}/src/")
+
+# Generate cvc4kinds.{pxd,pyx}
+add_custom_target(
+ gen-pycvc4-kinds
+ ALL
+ COMMAND
+ "${PYTHON_EXECUTABLE}"
+ "${CMAKE_CURRENT_LIST_DIR}/genkinds.py"
+ --kinds-header "${PROJECT_SOURCE_DIR}/src/api/cvc4cppkind.h"
+ --kinds-file-prefix "cvc4kinds"
+ DEPENDS
+ genkinds.py
+ COMMENT
+ "Generate cvc4kinds.{pxd,pyx}"
+)
+
+add_cython_target(pycvc4 CXX)
+
+add_library(pycvc4
+ MODULE
+ ${pycvc4})
+
+target_link_libraries(pycvc4 cvc4 ${PYTHON_LIBRARIES})
+
+python_extension_module(pycvc4)
+install(TARGETS pycvc4 DESTINATION lib)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback