summaryrefslogtreecommitdiff
path: root/src/bindings/python/CMakeLists.txt
blob: 44d64fb29cafde56a758c3a8c96e2c88457ece9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Make sure that interpreter and libraries have a compatible version.
# Note: We use the Python interpreter to determine the install path for Python
# modules.  If the interpreter and library have different version, the module
# will be installed for the wrong Python version. Hence, we require the library
# version to match the Python interpreter's version.
find_package(PythonLibs
             ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})

set(SWIG_MODULE_CVC4_EXTRA_DEPS cvc4 cvc4parser)
set_property(SOURCE ${CVC4_SWIG_INTERFACE} PROPERTY CPLUSPLUS ON)

# Suppress -Wsuggest-override warnings for generated code
set_property(
  SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cvc4PYTHON_wrap.cxx
  PROPERTY COMPILE_OPTIONS -Wno-suggest-override)

# The generated module should have the name _CVC4.so, hence we use CVC4 as
# target name.
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
  swig_add_module(CVC4 Python ${CVC4_SWIG_INTERFACE})
else()
  swig_add_library(CVC4 LANGUAGE Python SOURCES ${CVC4_SWIG_INTERFACE})
endif()
swig_link_libraries(CVC4 cvc4 cvc4parser ${PYTHON_LIBRARIES})


# Install Python bindings to the corresponding python-*/site-packages
# directory.  Lookup Python module directory and store path in
# PYTHON_MODULE_PATH.
execute_process(COMMAND
                  ${PYTHON_EXECUTABLE} -c
                    "from distutils.sysconfig import get_python_lib;\
                     print(get_python_lib(plat_specific=True,\
                             prefix='${CMAKE_INSTALL_PREFIX}'))"
                OUTPUT_VARIABLE PYTHON_MODULE_PATH
                OUTPUT_STRIP_TRAILING_WHITESPACE)

# Copy _CVC4.so and CVC4.py to PYTHON_MODULE_PATH
install(TARGETS ${SWIG_MODULE_CVC4_REAL_NAME}
        DESTINATION ${PYTHON_MODULE_PATH})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CVC4.py
        DESTINATION ${PYTHON_MODULE_PATH})
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback