File: CMakeLists.txt

package info (click to toggle)
cvc5 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 87,260 kB
  • sloc: cpp: 383,850; java: 12,207; python: 12,090; sh: 5,679; ansic: 4,729; lisp: 763; perl: 208; makefile: 38
file content (94 lines) | stat: -rw-r--r-- 3,407 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
###############################################################################
# Top contributors (to current version):
#   Daniel Larraz, Yoni Zohar, Andrew Reynolds
#
# This file is part of the cvc5 project.
#
# Copyright (c) 2009-2025 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.
# #############################################################################
#
# The build system configuration.
##

add_custom_target(build-pyapitests)
add_dependencies(build-apitests build-pyapitests)

add_custom_target(pyapitests
  COMMAND ctest --output-on-failure -L "pyapi" -j${CTEST_NTHREADS} $$ARGS
  DEPENDS build-pyapitests)

if(WIN32)
  set(CVC5_PYAPI_TEST_DIR ${CMAKE_BINARY_DIR}/cvc5-pyapi-test)

  set(WHEEL_INSTALL_CMD
       "${Python_EXECUTABLE} -m pip install --prefix ${CVC5_PYAPI_TEST_DIR}")

  # Install the cvc5 Python bindings in the build directory to run tests.
  # On Windows, adding the directory with the Python bindings to PYTHONPATH
  # is not enough because Python only searches for DLL dependencies for
  # extension modules in system paths and the directory containing the PYD file.
  # Specifically, since Python 3.8, PATH and the current working directory are
  # no longer used for this purpose. See:
  #  https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew
  add_custom_command(
    OUTPUT ${CVC5_PYAPI_TEST_DIR}
    COMMAND
      ${CMAKE_COMMAND}
        -DPython_EXECUTABLE=${Python_EXECUTABLE}
        -DRepairwheel_EXECUTABLE=${Repairwheel_EXECUTABLE}
        -DBUILD_DIR=${CMAKE_BINARY_DIR}
        -DDEPS_BASE=${DEPS_BASE}
        -DINSTALL_CMD="${WHEEL_INSTALL_CMD}"
        -P ${CMAKE_SOURCE_DIR}/cmake/install_python_wheel.cmake
    DEPENDS cvc5_python_api
  )

  add_custom_target(setup-cvc5-pyapi DEPENDS ${CVC5_PYAPI_TEST_DIR})

  add_dependencies(build-pyapitests setup-cvc5-pyapi)

  # Get path to the python bindings installed in the build directory
  execute_process(COMMAND
    ${Python_EXECUTABLE} -c
      "import os.path;import sysconfig;\
      print('${CVC5_PYAPI_TEST_DIR}'+\
      sysconfig.get_paths()['platlib'].split(sysconfig.get_config_var('platbase'))[1])"
    OUTPUT_VARIABLE PYTHON_MODULE_PATH
    OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
  set(PYTHON_MODULE_PATH ${CMAKE_BINARY_DIR}/src/api/python)
  add_dependencies(build-pyapitests cvc5_python_api)
endif()

# Add Python bindings API tests.
macro(cvc5_add_python_api_test name dir)
  set(pyname pyapi_${name})
  if("${dir}" STREQUAL "")
    set(test_name api/python/${pyname})
  else()
    set(test_name api/python/${dir}/${pyname})
  endif()
  add_test (NAME ${test_name}
    COMMAND ${Python_EXECUTABLE}
            ${CMAKE_CURRENT_SOURCE_DIR}/${name}.py)
  # directory for importing the python bindings
  set_tests_properties(${test_name}
    PROPERTIES LABELS "api pyapi"
    ENVIRONMENT PYTHONPATH=${PYTHON_MODULE_PATH})
endmacro()

# add specific test files
cvc5_add_python_api_test(boilerplate "")
cvc5_add_python_api_test(ouroborous "")
cvc5_add_python_api_test(reset_assertions "")
cvc5_add_python_api_test(smt2_compliance "")
cvc5_add_python_api_test(two_solvers "")

if (NOT ENABLE_SAFE_MODE AND NOT ENABLE_STABLE_MODE)
  cvc5_add_python_api_test(sep_log_api "")
endif()

add_subdirectory(issues)