pax_global_header00006660000000000000000000000064146621774240014527gustar00rootroot0000000000000052 comment=393cdfba3735d334bb4e6525500b8a0280dd41e6 boolector-3.2.4/000077500000000000000000000000001466217742400135255ustar00rootroot00000000000000boolector-3.2.4/AUTHORS000066400000000000000000000024371466217742400146030ustar00rootroot00000000000000The main authors and developers of Boolector are: Armin Biere (Johannes Kepler University Linz), 2007-2018. Robert Brummayer (Johannes Kepler University Linz), 2007-2009. Aina Niemetz (Johannes Kepler University Linz, Stanford University), 2012-2021. Mathias Preiner (Johannes Kepler University Linz, Stanford University), 2012-2021. The copyright of Boolector is held by these individuals and the affiliated institutions at the time of their contributions. The main authors of BtorMBT are Armin Biere (Johannes Kepler University), 2013-2016. Aina Niemetz (Johannes Kepler University Linz, Stanford University), 2013-2021. Mathias Preiner (Johannes Kepler University Linz, Stanford University), 2013-2021. Christian Reisenberger (Johannes Kepler University Linz), 2013. The copyright of BtorMBT is held by these individuals and the affiliated institutions at the time of their contributions. The main authors of BtorUntrace are Aina Niemetz (Johannes Kepler University Linz, Stanford University), 2013-2021. Mathias Preiner (Johannes Kepler University Linz, Stanford University), 2013-2021. Christian Reisenberger (Johannes Kepler University Linz), 2013. The copyright of BtorUntrace is held by these individuals and the affiliated institutions at the time of their contributions. boolector-3.2.4/CMakeLists.txt000066400000000000000000000351551466217742400162760ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # cmake_minimum_required(VERSION 3.3) #-----------------------------------------------------------------------------# project(boolector) set(VERSION "3.2.4") string(TIMESTAMP TIME) #-----------------------------------------------------------------------------# set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/deps/install") #-----------------------------------------------------------------------------# include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) macro(add_c_flag flag) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") message(STATUS "Configuring with C flag '${flag}'") endmacro() macro(add_cxx_flag flag) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") message(STATUS "Configuring with CXX flag '${flag}'") endmacro() macro(add_c_cxx_flag flag) add_c_flag(${flag}) add_cxx_flag(${flag}) endmacro() macro(add_check_c_flag flag) string(REGEX REPLACE "[-=]" "_" flagname ${flag}) check_c_compiler_flag("${flag}" HAVE_FLAG${flagname}) if(HAVE_FLAG${flagname}) add_c_flag(${flag}) endif() endmacro() macro(add_check_cxx_flag flag) string(REGEX REPLACE "[-=]" "_" flagname ${flag}) check_cxx_compiler_flag("${flag}" HAVE_FLAG${flagname}) if(HAVE_FLAG${flagname}) add_cxx_flag(${flag}) endif() endmacro() macro(add_check_c_cxx_flag flag) add_check_c_flag(${flag}) add_check_cxx_flag(${flag}) endmacro() macro(add_required_cxx_flag flag) string(REGEX REPLACE "[-=]" "_" flagnamename ${flag}) check_cxx_compiler_flag("${flag}" HAVE_FLAG${flagname}) if (NOT HAVE_FLAG${flagname}) message(FATAL_ERROR "Required compiler flag ${flag} not supported") endif() add_cxx_flag(${flag}) endmacro() macro(add_required_c_flag flag) string(REGEX REPLACE "[-=]" "_" flagname ${flag}) check_c_compiler_flag("${flag}" HAVE_FLAG${flagname}) if (NOT HAVE_FLAG${flagname}) message(FATAL_ERROR "Required compiler flag ${flag} not supported") endif() add_c_flag(${flag}) endmacro() macro(add_required_c_cxx_flag flag) add_required_c_flag(${flag}) add_required_cxx_flag(${flag}) endmacro() # 3-valued option IGNORE/OFF/ON macro(option3vl var description) set(${var} IGNORE CACHE STRING "${description}") # Provide drop down menu options in cmake-gui set_property(CACHE ${var} PROPERTY STRINGS IGNORE ON OFF) endmacro() # Set option only if it still has initial value IGNORE (do not overwrite user # configurations) macro(set_option var value) if(${var} STREQUAL "IGNORE") set(${var} ${value}) endif() endmacro() #-----------------------------------------------------------------------------# set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) message(STATUS "LIB directory is '${CMAKE_BINARY_DIR}/lib'") message(STATUS "BIN directory is '${CMAKE_BINARY_DIR}/bin'") #-----------------------------------------------------------------------------# option3vl(ASAN "Compile with ASAN support") option3vl(UBSAN "Compile with UBSan support") option3vl(CHECK "Enable assertions even for optimized compilation") option3vl(GCOV "Compile with coverage support") option3vl(GPROF "Compile with profiling support") option3vl(LOG "Compile with logging support (default for Debug builds)") option3vl(PYTHON "Build Python API") option3vl(TIME_STATS "Compile with time statistics") option3vl(TESTING "Configure unit and regression testing") option3vl(USE_CADICAL "Use and link with CaDiCaL") option3vl(USE_CMS "Use and link with CryptoMiniSat") option3vl(USE_LINGELING "Use and link with Lingeling (default)") option3vl(USE_MINISAT "Use and link with MiniSat") option3vl(USE_PICOSAT "Use and link with PicoSAT") option(ONLY_CADICAL "Only use CaDiCaL" OFF) option(ONLY_CMS "Only use CryptoMiniSat" OFF) option(ONLY_LINGELING "Only use Lingeling" OFF) option(ONLY_MINISAT "Only use MiniSat" OFF) option(ONLY_PICOSAT "Only use PicoSAT" OFF) option(USE_PYTHON2 "Prefer Python 2.7" ) option(USE_PYTHON3 "Prefer Python 3" ) option(USE_GMP "Use GMP for bit-vector implementation" OFF) #-----------------------------------------------------------------------------# # Automatically build shared libraries if Python bindings are enabled. if(PYTHON) if(USE_PYTHON2) find_package(PythonInterp 2.7 REQUIRED) elseif(USE_PYTHON3) find_package(PythonInterp 3 REQUIRED) else() find_package(PythonInterp REQUIRED) endif() # Explicitly check for a compatible version of Python libs. find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH} REQUIRED) # Produce a python module that only links against system libraries. SAT # solvers and libboolector should be included in the module itself. if(NOT BUILD_SHARED_LIBS) add_check_c_cxx_flag("-fPIC") # Disable MiniSat since the static library is not compiled with -fPIC by # default. message(STATUS "Disabling MiniSat for static Python builds. " "Use --shared if you need MiniSat.") set_option(USE_MINISAT OFF) endif() endif() if(ASAN) # -fsanitize=address requires CMAKE_REQUIRED_FLAGS to be explicitely set, # otherwise the -fsanitize=address check will fail while linking. set(CMAKE_REQUIRED_FLAGS -fsanitize=address) add_required_c_cxx_flag("-fsanitize=address") unset(CMAKE_REQUIRED_FLAGS) add_check_c_cxx_flag("-fno-omit-frame-pointer") add_required_c_cxx_flag("-fsanitize-recover=address") set(BUILD_SHARED_LIBS ON) endif() if(UBSAN) add_required_c_cxx_flag("-fsanitize=undefined") set(BUILD_SHARED_LIBS ON) endif() if(NOT BUILD_SHARED_LIBS) set(CMAKE_FIND_LIBRARY_SUFFIXES .a) endif() #-----------------------------------------------------------------------------# # Default values for 3-valued options set_option(USE_CADICAL ON) set_option(USE_CMS ON) set_option(USE_LINGELING ON) set_option(USE_MINISAT ON) set_option(USE_PICOSAT ON) #-----------------------------------------------------------------------------# # Note: Do not set these flags the cmake way as we need them for generating # btorconfig.h and they are else not yet added to CMAKE_C(XX)_FLAGS at # file generation time (configure_file). add_required_c_flag("-std=gnu99") add_required_cxx_flag("-std=gnu++11") add_check_c_cxx_flag("-W") add_check_c_cxx_flag("-Wall") add_check_c_cxx_flag("-Wextra") add_check_c_cxx_flag("-Wredundant-decls") foreach(flag ${FLAGS}) add_required_c_cxx_flag("${flag}") endforeach() if(IS_WINDOWS_BUILD) add_definitions("-DBTOR_WINDOWS_BUILD") endif() #-----------------------------------------------------------------------------# set(build_types Debug Release) if(NOT CMAKE_BUILD_TYPE) message(STATUS "No build type set, options are: ${build_types}") set(CMAKE_BUILD_TYPE Release CACHE STRING "Options are: ${build_types}" FORCE) # Provide drop down menu options in cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${build_types}) endif() message(STATUS "Building ${CMAKE_BUILD_TYPE} build") if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_required_c_cxx_flag("-g") add_check_c_cxx_flag("-g3") add_check_c_cxx_flag("-ggdb") set_option(LOG ON) set_option(TESTING ON) set_option(TIME_STATS ON) elseif(CMAKE_BUILD_TYPE STREQUAL "Release") add_check_c_cxx_flag("-O3") if(NOT CHECK) add_definitions("-DNDEBUG") endif() set_option(LOG OFF) set_option(TIME_STATS OFF) endif() #-----------------------------------------------------------------------------# if(GCOV) include(CodeCoverage) APPEND_COVERAGE_COMPILER_FLAGS() setup_target_for_coverage_lcov( NAME coverage EXECUTABLE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test DEPENDENCIES boolector-bin) endif() if(GPROF) add_required_c_cxx_flag("-pg") endif() if(NOT LOG) add_definitions("-DNBTORLOG") endif() include(CheckSignals) if(HAVE_SIGNALS) add_definitions("-DBTOR_HAVE_SIGNALS") endif() include(CheckTimeUtils) if(NOT HAVE_TIME_UTILS) set(TIME_STATS OFF) endif() if(TIME_STATS) add_definitions("-DBTOR_TIME_STATISTICS") endif() include(CheckNoExportDynamic) #-----------------------------------------------------------------------------# if(ONLY_CADICAL) set(USE_CMS OFF) set(USE_LINGELING OFF) set(USE_MINISAT OFF) set(USE_PICOSAT OFF) set(USE_CADICAL ON) elseif(ONLY_CMS) set(USE_CADICAL OFF) set(USE_LINGELING OFF) set(USE_MINISAT OFF) set(USE_PICOSAT OFF) set(USE_CMS ON) elseif(ONLY_LINGELING) set(USE_CADICAL OFF) set(USE_CMS OFF) set(USE_MINISAT OFF) set(USE_PICOSAT OFF) set(USE_LINGELING ON) elseif(ONLY_MINISAT) set(USE_CADICAL OFF) set(USE_CMS OFF) set(USE_LINGELING OFF) set(USE_PICOSAT OFF) set(USE_MINISAT ON) elseif(ONLY_PICOSAT) set(USE_CADICAL OFF) set(USE_CMS OFF) set(USE_LINGELING OFF) set(USE_MINISAT OFF) set(USE_PICOSAT ON) endif() #-----------------------------------------------------------------------------# find_package(Btor2Tools REQUIRED) if(NOT IS_WINDOWS_BUILD) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads) if(Threads_FOUND) set(LIBRARIES ${LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) add_definitions("-DBTOR_HAVE_PTHREADS") endif() endif() if(USE_GMP) find_package(GMP) if(GMP_FOUND) add_definitions("-DBTOR_USE_GMP") endif() endif() if(USE_LINGELING) find_package(Lingeling) endif() if(USE_CADICAL) find_package(CaDiCaL) endif() if(USE_CMS) find_package(CryptoMiniSat) endif() if(USE_PICOSAT) find_package(PicoSAT) endif() if(USE_MINISAT) find_package(MiniSat) endif() if(NOT USE_LINGELING AND NOT USE_CADICAL AND NOT USE_CMS AND NOT USE_PICOSAT AND NOT USE_MINISAT) message(FATAL_ERROR "No SAT solver configured") elseif(NOT Lingeling_FOUND AND NOT CaDiCaL_FOUND AND NOT CryptoMiniSat_FOUND AND NOT PicoSAT_FOUND AND NOT MiniSat_FOUND) message(FATAL_ERROR "No SAT solver found") endif() if(Lingeling_FOUND) if(NOT Lingeling_INCLUDE_DIR) message(FATAL_ERROR "Lingeling headers not found") else() add_definitions("-DBTOR_USE_LINGELING") endif() endif() if(CaDiCaL_FOUND) if(NOT CaDiCaL_INCLUDE_DIR) message(FATAL_ERROR "CaDiCaL headers not found") else() add_definitions("-DBTOR_USE_CADICAL") endif() endif() if(CryptoMiniSat_FOUND) if(NOT CryptoMiniSat_INCLUDE_DIR) message(FATAL_ERROR "CryptoMiniSat headers not found") else() add_definitions("-DBTOR_USE_CMS") endif() endif() if(PicoSAT_FOUND) if(NOT PicoSAT_INCLUDE_DIR) message(FATAL_ERROR "PicoSAT headers not found") else() add_definitions("-DBTOR_USE_PICOSAT") endif() endif() if(MiniSat_FOUND) if(NOT MiniSat_INCLUDE_DIR) message(FATAL_ERROR "MiniSAT headers not found") else() add_definitions("-DBTOR_USE_MINISAT") endif() endif() #-----------------------------------------------------------------------------# # Extract info from Git for btorconfig.h find_package(Git) set(GIT_DIRTY "") set(GIT_SHA1 "") set(GIT_BRANCH "") if(GIT_FOUND) # Get current git branch, result is != 0 if this is not a git repository execute_process( COMMAND ${GIT_EXECUTABLE} -C ${PROJECT_SOURCE_DIR} rev-parse --abbrev-ref HEAD RESULT_VARIABLE GIT_RESULT OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET ) if("${GIT_RESULT}" STREQUAL "0") set(GIT_BRANCH "${GIT_BRANCH}-") # Extract sha1 of HEAD execute_process( COMMAND ${GIT_EXECUTABLE} -C ${PROJECT_SOURCE_DIR} rev-parse HEAD OUTPUT_VARIABLE GIT_SHA1 OUTPUT_STRIP_TRAILING_WHITESPACE ) # Result is != 0 if worktree is dirty execute_process( COMMAND ${GIT_EXECUTABLE} -C ${PROJECT_SOURCE_DIR} diff --quiet RESULT_VARIABLE GIT_RESULT ) if(NOT "${GIT_RESULT}" STREQUAL "0") set(GIT_DIRTY "-dirty") endif() endif() endif() # TODO: definitions added via add_definititions configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/btorconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/btorconfig.h) #-----------------------------------------------------------------------------# # Regression tests if(TESTING) enable_testing() endif() #-----------------------------------------------------------------------------# # Source directories include_directories(src ${CMAKE_CURRENT_BINARY_DIR}/src) add_subdirectory(src) if(TESTING) add_subdirectory(test) endif() if(PYTHON) add_subdirectory(src/api/python) endif() add_subdirectory(examples/api/c) #-----------------------------------------------------------------------------# set(ARCHIVE_NAME "boolector-${VERSION}") add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | xz > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.xz WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) #-----------------------------------------------------------------------------# # Install config and configversion for Boolector to add support for # find_package(Boolector). include(CMakePackageConfigHelpers) write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/BoolectorConfigVersion.cmake VERSION ${VERSION} COMPATIBILITY SameMajorVersion ) # Install the config, configversion and custom find modules install(FILES ${CMAKE_CURRENT_LIST_DIR}/cmake/BoolectorConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/BoolectorConfigVersion.cmake DESTINATION lib/cmake/Boolector ) #-----------------------------------------------------------------------------# # Print Boolector configuration if(NOT WIN32) string(ASCII 27 Esc) set(Green "${Esc}[32m") set(Blue "${Esc}[34m") set(ResetColor "${Esc}[m") endif() macro(config_info msg value) message(STATUS "${Blue}${msg}: ${Green}${value}${ResetColor}") endmacro() macro(config_info_bool msg value) if(${value}) config_info("${msg}" "yes") else() config_info("${msg}" "no") endif() endmacro() config_info("Build type" "${CMAKE_BUILD_TYPE}") config_info_bool("Shared build" "${BUILD_SHARED_LIBS}") config_info_bool("ASAN support" ASAN) config_info_bool("UBSAN support" UBSAN) config_info_bool("Assertions enabled" CHECK) config_info_bool("Testing" TESTING) config_info_bool("gcov support" GCOV) config_info_bool("gprof support" GPROF) config_info_bool("Logging support" LOG) config_info_bool("Python bindings" PYTHON) config_info_bool("Time statistics" TIME_STATS) config_info_bool("CaDiCaL" CaDiCaL_FOUND) config_info_bool("CryptoMiniSat" CryptoMiniSat_FOUND) config_info_bool("Lingeling" Lingeling_FOUND) config_info_bool("MiniSat" MiniSat_FOUND) config_info_bool("PicoSAT" PicoSAT_FOUND) config_info_bool("GMP" USE_GMP) boolector-3.2.4/COMPILING_WINDOWS.md000066400000000000000000000166751466217742400166210ustar00rootroot00000000000000# Boolector installation steps on Windows ### Important preamble These steps document what is necessary to build a 64-bit version of `pyboolector.pyd` on 64-bit Windows. They also do not guarantee the correctness of other parts of Boolector (e.g., the main `boolector.exe`). To ensure the portability of `pyboolector.pyd`, every effort is made in this guide to avoid building Boolector with Cygwin (e.g., we wish to avoid a dependency on `cygwin1.dll`, which could affect the portability of `pyboolector.pyd`). Given this, the guide is written to use the MinGW-W64 "cross-compiler". These notes are purposefully very detailed to allow for someone to go from a completely fresh Windows 10 installation to a working version of Boolector. Finally, some of Boolector's dependencies have been _heavily_ modified to allow them to build on Windows. This means that functionality such as timeouts might be completely inoperable on Windows. ## Dependencies ### MinGW Install MinGW-W64 from here: * You should select the "MinGW-W64 Online Installer" (`MinGW-W64-install.exe`). The following options are recommended and have been tested when writing this guide: * Version: 8.1.0 * Architecture: x86_64 * Threads: win32 * Exception: seh (default) * Build revision: 0 (default) When selecting the threading model, only the `win32` threading model has been validated -- the POSIX model has not been tested at all. On Windows, Boolector's make system has been modified to statically link, expecting the `win32` model. ### MSYS Install MSYS from here: * It is important to select the 64-bit installation option (`msys2-x86_64-.exe`). There are no further choices to be made when installing MSYS. Once MSYS is installed, start an MSYS shell, and run `pacman -Syuu`. Once this is complete, it will ask you to close the shell. Close MSYS, re-open it and re-run `pacman -Syuu` again. Once it is complete the second time, close and re-open MSYS. This process needs to be performed twice to allow for MSYS to first update itself, and then update its packages. Now install the following: * `pacman -S --needed make git vim wget patch tar` ### Python 3.8 Install the most recent 64-bit Python 3.8 from here: * You should download the "Windows x86-64 executable installer". If you wish to avoid Python being installed into your AppData folder, you should choose to customise the installation, and select "Install for all users" (recommended for the purposes of following these instructions). Update your `%PATH%` variable to include both the path to `python.exe` and to the `Scripts` sub-directory of the Python installation. These paths will look something like: * `C:\Program Files\Python38` * `C:\Program Files\Python38\Scripts` If you installed Python for only the current user, the paths will look something like: * `C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python38` * `C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python38\scripts` You need to ensure that these paths appear *before* `%USERPROFILE%\AppData\Local\Microsoft\WindowsApps`, otherwise Window's "wrapper" to _install_ Python will get invoked. Once your `%PATH%` is set correctly, start `cmd` and run the following: * `python -m pip install --upgrade pip` * `python -m pip install --upgrade cython` If you installed Python system-wide (e.g., in to the default path of `C:\Program Files\Python38`), you should ensure that the above commands are run inside of an administrative `cmd`, such that the packages get installed into the global Python installation. ### CMake The version of CMake that comes with MSYS does not correctly support MSYS Makefiles (strangely). You should download the most recent version of CMake from here: * Downloading "Windows win64-x64 ZIP" (`cmake--win64-x64.zip`) is sufficient. You do not need the installer. When this is downloaded, extract the zip, but _remember the path you extracted it to_! You will need it later to the set the variable `CMAKE_DIR`. The rest of this guide assumes you have extracted CMake to the root of your `C:` drive. ## Building Boolector ### Configuring Boolector's build environment Now that you have installed all of the necessary dependencies for Boolector, we need to configure our build environment. Start an MSYS shell, enter the directory you wish to build Boolector in, and create a file called `vars.sh`. The file should have the following content: ```bash #!/bin/bash set -eu # **Important** # # If you installed Python for only the current user, pay particular attention # to the value of `PYTHON_DIR`. Before calling `cygpath -u`, call `cygpath -d` # to remove the space. # export PYTHON_DIR=$(cygpath -u $(cygpath -d "C:\Program Files\Python38")) export CMAKE_DIR=$(cygpath -u "C:\cmake-3.17.3-win64-x64") export MINGW_DIR=$(cygpath -u "C:\Program Files\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64") export PATH=${PYTHON_DIR}:${PATH} export PATH=${PYTHON_DIR}/Scripts:${PATH} export PATH=${CMAKE_DIR}/bin:${PATH} export PATH=${MINGW_DIR}/bin:${PATH} export DEBUG_FLAG="" export COMPARCH=64 export EXTRA_FLAGS="-static-libstdc++ -static-libgcc" # -DMS_WIN64 is required so the Python headers properly detect a 64-bit build export COMPFLAGS="${EXTRA_FLAGS} -I${PYTHON_DIR}/include -m${COMPARCH} -DMS_WIN64" if [ -z "$DEBUG_FLAG" ]; then COMPFLAGS="-O3 -DNDEBUG ${COMPFLAGS}" fi export CFLAGS="${COMPFLAGS} -std=gnu11" export CXXFLAGS="${COMPFLAGS} -std=gnu++11" export PYTHON_INCLUDE="${COMPFLAGS}" export LDFLAGS="${EXTRA_FLAGS} -L${PYTHON_DIR}/lib" export CC="gcc" export CXX="g++" set +eu # EOF ``` Once you have created this file, you should run `source vars.sh`. You should now check the following: * `which gcc` * `which python` * `which cmake` * `which cython` If any of these do not appear to look right, or return incorrect values, you need to check your contents of `vars.sh` -- pay special attention to `CMAKE_DIR` and `MINGW_DIR`! ### Obtaining Boolector Now that you have configured your environment, you should obtain a copy of Boolector: * `git clone https://github.com/Boolector/boolector` ### Building Boolector The following steps will allow you to build Boolector from the above clone: ```bash #!/bin/bash set -eu cd boolector # # Download, patch and build Boolector's dependencies # ./contrib/setup-picosat.sh ./contrib/setup-lingeling.sh ./contrib/setup-cadical.sh ./contrib/setup-btor2tools.sh # # Modify pyboolector.pyx to be "more Windows compatible" # ./contrib/fix_cython_windows.sh # # Build Boolector # mkdir build cd build cmake .. -DPYTHON=ON -DIS_WINDOWS_BUILD=1 -G "MSYS Makefiles" make -j12 cd .. # EOF ``` _Notes:_ * On Windows, the above `setup` scripts automatically patch the version of Boolector's dependencies to enable them to compile with Windows -- as per the start of this guide, these changes may dramatically change Boolector's behaviour. * The use of `-G "MSYS Makefiles"` is _highly_ essential to allow you to build Boolector on Windows. ### Testing Boolector Now that you have built `pyboolector.pyd`, you can test it: ```bash #!/bin/bash # this script presumes it is run from the root of the Boolector clone export PYTHONPATH=$(cygpath -d $(readlink -f build/lib)) python examples/api/python/api_usage_examples.py # EOF ``` If you get uncaught exceptions on `splice`, then you probably did not run `./contrib/fix_cython_windows.sh` before building. boolector-3.2.4/COPYING000066400000000000000000000023661466217742400145670ustar00rootroot00000000000000Boolector is a Satisfiability Modulo Theories (SMT) Solver for bit-vectors, arrays and uninterpreted functions. Copyright (C) 2007-2021 by its authors and contributors and their institutional affiliations as listed in file AUTHORS. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. boolector-3.2.4/NEWS000066400000000000000000000436631466217742400142400ustar00rootroot00000000000000news for final release 3.2.4 -------------------------------------------------------------------------------- This is the final release of Boolector. Active development and maintenance has stopped. Boolector was succeeded by Bitwuzla (https://github.com/bitwuzla/bitwuzla). news for release 3.2.3 since 3.2.2 -------------------------------------------------------------------------------- + new API calls - boolector_get_value + fix printing of constant arrays for get-value + build PyPi packages for Python version <=3.12 news for release 3.2.2 since 3.2.1 -------------------------------------------------------------------------------- + fix issues in btormc + fix issue with get-value for Boolean variables + fix issue with get_failed_assumptions in combination with push/pop + fix get-unsat-assumptions printing + export enums for setting options (option values) + get-model is now SMT-LIB standard compliant + PyPi packages for Boolector + remove obsolete CL option --smt2-model (use -m --output-format=smt2 instead) news for release 3.2.1 since 3.2.0 -------------------------------------------------------------------------------- + initial version of Dockerfile for Boolector (thanks to Andrew V. Jones) + fix issue with infinite recursion in Python API (thanks to Andrew V. Jones) + fix issue with dumping constant arrays + fix issue with reset assumptions and checking of failed assumptions + fix witness printing in btormc news for release 3.2.0 since 3.1.0 -------------------------------------------------------------------------------- + new dumper CNF printer (enable with CLI option -dd and API option BTOR_OPT_PRINT_DIMACS) + fix issue with model construction for constant arrays + boolector_sat is not automatically called on smt2 input anymore, must be explicitly called via (check-sat) in the input file + smt2: - support for parsing constant arrays - support for :global-declarations + API changes: - boolector_ror and boolector_rol now allow same bit-width for both operands + new API calls - boolector_roli - boolector_rori news for release 3.1.0 since 3.0.0 -------------------------------------------------------------------------------- + build system: - requires now cmake >= 3.3 - exports library interface for using find_package(Boolector) in cmake projects + support for custom abort callback function (called on abort instead of actually aborting) + Python API now throws Python exceptions on abort conditions (e.g., when underlying C API is misused) + command line options that previously expected integer values denoting enum values are now configured with strings denoting the particular modes that can be selected; -=help and --=help allow to print detailed help messages for these modes + fixed issue in SMT2 parser to correctly print echo commands (thanks to Dominik Klumpp) + fixed race condition in Cython dependencies (thanks to Marco Gario) + patches and documentation for building Boolector on Windows (thanks to Andrew V. Jones) + support/use termination function feature of CaDiCaL (thanks to Andrew V. Jones) + various fixes to contrib dependecy scripts (thanks to Serge Bazanski) + new API calls - boolector_copy_sort - boolector_min_signed - boolector_max_signed - boolector_is_bv_const_zero - boolector_is_bv_const_one - boolector_is_bv_const_ones - boolector_is_bv_const_min_signed - boolector_is_bv_const_max_signed + CaDiCaL is now default SAT engine + support for constant arrays + support for GMP as bit-vector implementation + support for CyproMiniSat - supports multi-threading via option --sat-engine-n-threads + switched to Google test as testing framework + CLI options changed (replaced ':' with a '-') + BtorMC improvements (HWMCC'19 version) - k-induction engine with simple path constraints + Poolector Python script used in SMT-COMP'19 news for release 3.0.0 since 2.4.1 -------------------------------------------------------------------------------- + new build system, requires cmake >= 2.8 - setup-*.sh scripts for dependencies (btor2parser, SAT solvers) in contrib + support for quantified bit-vectors (BV) + new bounded model checker BtorMC + support for new format BTOR2 + support for CaDiCaL as SAT back-end + name of the Python module changed to pyboolector + SMT2 support for: - echo - declare-const - check-sat-assuming - get-unsat-assumptions - set-option :produce-unsat-assumptions - set-option :produce-assertions - set-logic ALL + new API calls - boolector_constd - boolector_consth - boolector_copyright - boolector_exists - boolector_forall - boolector_get_failed_assumptions - boolector_repeat - boolector_pop - boolector_push - boolector_version + removed obsolete API calls - boolector_set_sat_solver_lingeling - boolector_set_sat_solver_minisat - boolector_set_sat_solver_picosat + changes in API calls - boolector_srl, boolector_sll and boolector_sra now supports operands with the same bit-width (SMT-LIB v2 compatible) + various improvements and extensions of btormbt news for release 2.4.1 since 2.4.0 -------------------------------------------------------------------------------- + sequential portfolio combination of bit-blasting and SLS engine (option --fun:presls) analogous to combination with PROP engine (option --fun:preprop) + fixed: dumping smt2 nodes in incremental mode news for release 2.4.0 since 2.3.1 -------------------------------------------------------------------------------- + refactored, extended and improved btormbt + new API functions: - boolector_is_uf + dumping smt2 nodes in incremental mode is now also possible if Boolector compiled with assertions + fixed another issue with get-value (thanks to Praveen Gundaram) + refactored model printing + command line option changes: - --incremental-all -> --incremental-smt1 + optimized lemma generation of function solver news for release 2.3.1 since 2.3.0 -------------------------------------------------------------------------------- * fixed an issue with model printing (get-value) (thanks to Levent Erkok) news for release 2.3.0 since 2.2.0 -------------------------------------------------------------------------------- * new QF_BV engines + SLS engine + PROP engine + AIGPROP engine * fixed an issue with model generation and lambda extraction (thanks to Tim Blazytko) * fixed an issue in boolector_int (thanks to Niklas) * fixed issue with printing BTOR models * improved and extended option handling + boolector_get_opt_val -> boolector_get_opt * many under-the-hood changes, refactoring, improvements * API changes: + boolector_*_opt* now takes enum BtorOption instead of char* as argument + renamed: - boolector_get_opt_val -> boolector_get_opt + the following functions now take BoolectorSort: instead of int as argument: - boolector_zero, - boolector_ones, - boolector_one, - boolector_int, - boolector_array, - boolector_param + the following functions now return uint32_t instead of int: - boolector_get_width - boolector_get_index_width - boolector_get_fun_arity - boolector_get_opt (was boolector_get_opt_val) - boolector_get_opt_min - boolector_get_opt_max - boolector_get_opt_dflt + the following functions now return bool instead of int: - boolector_is_const - boolector_is_var - boolector_is_array - boolector_is_array_var - boolector_is_param - boolector_is_bound_param - boolector_is_fun - boolector_is_equal_sort - boolector_failed + the following options now return BtorOption instead of const char * - boolector_first_opt - boolector_next_opt * new API functions: + boolector_unsigned_int + boolector_get_sort + boolector_fun_get_domain_sort + boolector_fun_get_codomain_sort + boolector_match_node_by_symbol + boolector_is_array_sort + boolector_is_bitvec_sort + boolector_is_fun_sort + boolector_has_opt * dumping: new behavior: + boolector_dump_* does not simplify the formula before dumping anymore (call boolector_simplify prior to dumping explicitely if necessary) + when dumping via the CL, the observable dumping behavior did not change (formula is simplified prior to dumping) news for release 2.2.0 since 2.1.1 -------------------------------------------------------------------------------- * refactored a lot of code + refactored and extended btormbt + refactored and improved array/lambda engine + refactored and extended lambda extraction * removed SMT1 dumper (parsing SMT1 still supported) * fixed push/pop support in SMT2 with model generation enabled (thanks to James Bornholt) * fixed an issue with model generation (thanks to Mikoláš Janota) * fixed issues with failed assumptions * API changes: + boolector_get_bits now requires to free returned bit strings via boolector_free_bits (analogous to boolector_bv_assignment) + removed boolector_dump_smt1 and boolector_dump_smt1_node + removed deprecated functions boolector_enable_model_gen, boolector_generate_model_for_all_reads, boolector_enable_inc_usage, boolector_set_rewrite_level, boolector_set_verbosity, boolector_set_loglevel, boolector_get_symbol_of_var news for release 2.1.1 since 2.0.7 -------------------------------------------------------------------------------- * added support for array extensionality * added lambda extraction (enabled by default) * added model based testing tools btormbt and btoruntrace * reduced memory footprint * improved performance of cloning * added support for push/pop in SMT-LIBv2 parser * added support for :print-success in SMT-LIBv2 parser * added support for dumping BV formulas in AIGER format (replaces synthebtor) * API changes/additions: + added boolector_fixate_assumptions + added boolector_reset_assumptions + added boolector_dump_aiger_ascii + added boolector_dump_aiger_binary + changed boolector_*_sort - now takes BoolectorSort instead of BoolectorSort* as arguments * adpated and updated Python API to support new API - Assert(), Assume(), and Failed() now support variable number of arguments news for release 2.0.7 since 2.0.6 -------------------------------------------------------------------------------- * added option to (en|di)sable use of Boolector exit codes * fixed help message issues * fixed option handling issues * fixed caching bug in model generation * fixed issues with lambda hashing * improved SMT dumpers news for release 2.0.6 since 2.0.5 -------------------------------------------------------------------------------- * fixed printing issues in interactive SMT2 mode * SMT2 parser now exits immediately after (exit) command was read news for release 2.0.5 since 2.0.4 -------------------------------------------------------------------------------- * add support for termination callbacks (C and python API) * smt2 parser: added option :regular-output-channel * fixed smt2 interactivity issues * fixed issue in Python API with Python 2.7 compatibility (__div__) * fixed segmentation fault in SMT2 model printer news for release 2.0.4 since 2.0.3 -------------------------------------------------------------------------------- * fixed bug in compare function for pointer hashing * fixed performance issues when computing scores for don't care reasoning * added smt2 models (get-value, get-model) * fixed some issues in the Python API (thanks to Ryan Goulden) * improved dumping of SMT2 formulas news for release 2.0.3 since 2.0.1 -------------------------------------------------------------------------------- * fixed segmentation fault in back annotation for 'synthebtor' * reenabled verbosity output for SAT solvers during search * removed stale empty lines in triple verbose output * fixed compilation issues with gcc/g++ 4.4 news for release 2.0.1 since 2.0.0 -------------------------------------------------------------------------------- * fixes bug in model generation news for release 2.0.0 since 1.6.0 -------------------------------------------------------------------------------- * General: + Boolector python API + cloning support + support for uninterpreted functions + new improved model generation, supports two modes now: - --model-gen=1 or -m: generate model for all asserted expressions (same as model generation in previous versions) - --model-gen=2 or -m -m: generate model for all created expressions + fixed several rewriting bugs + refactored a lot of code + new output format for models * Optimizations: + re-enabled and fixed unconstrained optimization + don't care reasoning on bit vector skeleton - dual propagation optimization - justification optimization * API changes: + API functions return node of type BoolectorNode instead of BtorNode + new option handling + can be set via environment variables + set options via boolector_set_opt + new options - for a complete list of options please refer to the documentation of boolector_set_opt + deprecated functions: - boolector_get_symbol_of_var -> use boolector_get_symbol (...) the following functions are obsolete with boolector_set_opt - boolector_enable_model_gen -> use boolector_set_opt ("model_gen", 1) - boolector_generate_model_for_all_reads -> use boolector_set_opt ("model_gen", 2) - boolector_enable_inc_usage -> use boolector_set_opt ("incremental", 1) - boolector_set_rewrite_level -> use boolector_set_opt ("rewrite_level", ...) - boolector_set_verbosity -> use boolector_set_opt ("verbosity", ...) - boolector_set_loglevel -> use boolector_set_opt ("loglevel", ...) + new API functions to create uninterpreted functions - boolector_uf - boolector_bool_sort - boolector_bitvec_sort - boolector_fun_sort + limited boolector_sat calls - set lemmas on demand limit - set conflict limit for SAT solver * Notes: + If uninterpreted functions occur in the formula it is not possible to dump the formula to BTOR 1.2 format (this will be fixed with BTOR 2.0). news for release 1.6.0 since 1.5.119 -------------------------------------------------------------------------------- * extensionality support disabled * support for macros and lambdas * model based testing 'btormbt' * API tracing and untracing with 'btoruntrace' * improved quality of SMT2 parse error messages * added missing semantic checks in SMT2 parser news for release 1.5.119 since 1.5.118 -------------------------------------------------------------------------------- * fixed '{boolector,btor}_set_sat_solver (if MiniSAT and/or PicoSAT are not not enabled at compile time) news for release 1.5.118 since 1.5.116 -------------------------------------------------------------------------------- * '--solver=...' command line option and 'boolector_set_sat_solver' * delayed Lingeling preprocessing using 'simpdelay' news for release 1.5.116 since 1.5.115 -------------------------------------------------------------------------------- * examples compilable again * fixed assertions in 'booolector.c' * support for new reentrant PicoSAT API (since PicoSAT version 953) news for release 1.5.115 since 1.5.13 -------------------------------------------------------------------------------- * added 'bvcomp' * boolean top-level skeleton simplification * use of 'lglclone' in incremental mode * added some more rewriting * removed 3VL code * removed PrecoSAT, basicbtor * in-depth, look-ahead, interval * incremental SMTLIB1 interface * added MiniSAT support * rebuilding AIGs / Expressions * more compact SMTLIB1 parsing * symbolic lemmas instead of direct CNF encoding * more compact AIG to CNF translation * gzip/bzip2/7z compressed input files * time out option * SMTLIB 2 support news for release 1.5.13 since 1.4.1 -------------------------------------------------------------------------------- * new incremental mode for multiple formulas in SMT benchmarks * integration of MiniSAT * SMT parser demotes logic if possible * better control of best suitable solver in main application * generic incremental SAT glue logic * integration of Lingeling news for release 1.4.1 since 1.4 -------------------------------------------------------------------------------- * MacOS port * disabled unconstrained optimization news for release 1.4 since 1.3 -------------------------------------------------------------------------------- * hid API change in 'picosat_add' for older version of PicoSAT * fixed EOF issue reading an empty file from stdin * removed old license references news for release 1.3 since 1.2 -------------------------------------------------------------------------------- * first source code release * fixed a rewriting bug by uncommenting simplification code news for release 1.2 since 1.1 -------------------------------------------------------------------------------- * improved rewriting * PrecoSAT now standard solver for non-incremental usage, PicoSAT used otherwise news for release 1.1 since 1.0 -------------------------------------------------------------------------------- * improved handling of unconstrained variables and arrays * improved rewriting engine * removed command line switch for refinement limit * fixed bug where Boolector could report 'unknown' in regular (non-bmc) mode * fixed minor caching problem on AIG layer * fixed other bugs news for release 1.0 since 0.7 -------------------------------------------------------------------------------- * public C API * documentation and examples * improved SMT parser (:formula can now be an fvar). news for release 0.7 since 0.6 -------------------------------------------------------------------------------- * fixed model generation bugs * improved under-approximation * added support for bvcomp (SMT-LIB) news for release 0.6 since 0.5 -------------------------------------------------------------------------------- * fixed model generation bugs * fixed rewriting bug * support for new under-approximation techniques news for release 0.5 since 0.4 -------------------------------------------------------------------------------- * faster model generation * support for array models * support for under-approximation techniques for bit-vector variables and reads boolector-3.2.4/README.md000066400000000000000000000170441466217742400150120ustar00rootroot00000000000000[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Build Status](https://dev.azure.com/Boolector/Boolector/_apis/build/status/Boolector.boolector?branchName=master)](https://dev.azure.com/Boolector/Boolector/_build/latest?definitionId=1&branchName=master) # Boolector Boolector is a Satisfiability Modulo Theories (SMT) solver for the theories of fixed-size bit-vectors, arrays and uninterpreted functions. It supports the [SMT-LIB](http://www.smt-lib.org) logics BV, [QF_ABV](http://smtlib.cs.uiowa.edu/logics-all.shtml#QF_ABV), [QF_AUFBV](http://smtlib.cs.uiowa.edu/logics-all.shtml#QF_AUFBV), [QF_BV](http://smtlib.cs.uiowa.edu/logics-all.shtml#QF_BV) and [QF_UFBV](http://smtlib.cs.uiowa.edu/logics-all.shtml#QF_UFBV). Boolector provides a rich C and Python API and supports incremental solving, both with the SMT-LIB commands push and pop, and as solving under assumptions. The documentation of its API can be found [here](https://boolector.github.io/docs). ## Website More information about Boolector is available at: https://boolector.github.io ## Download The latest version of Boolector is available on GitHub: https://github.com/boolector/boolector ## Installation ### On macOS (or Linux) via Homebrew ``` brew install boolector ``` Note: this installation doesn't come with Python bindings and it uses Lingeling as backend. ## Prerequisites To build Boolector from source you need: * cmake >= 3.3 * gcc/clang * g++/clang++ To build the python module `pyboolector` you further need: * Cython >= 0.22 ## Build Boolector can be built with support for the SAT solvers [CaDiCaL](https://github.com/arminbiere/cadical), [CryptoMiniSat](https://github.com/msoos/cryptominisat), [Lingeling](http://fmv.jku.at/lingeling), [MiniSAT](https://github.com/niklasso/minisat), and [PicoSAT](http://fmv.jku.at/picosat). To build and setup these solvers you can use the scripts `setup-{cadical,cms,lingeling,minisat,picosat}.sh` in the `contrib` directory. Optionally, you can place any of these solvers in a directory on the same level as the Boolector source directory or provide a path to `configure.sh`. You can build Boolector with support for multiple SAT solvers. Note that using MiniSAT will force `libboolector.a` to depend not only on `libz.so` but also on `libstdc++.so`. Thus, if you want to link `libboolector.a` with MiniSAT backend against your own programs, you need to use `-lz -lstdc++` as linking options. Boolector has one other external dependency, the [BTOR2 format tools package](https://github.com/boolector/btor2tools). As with the SAT solvers, you can either use the provided script `setup-btor2tools.sh` in `contrib` or clone the BTOR2Tools repository into directory `btor2tools` on the same level as the Boolector repository or provide a path to `configure.sh`. ### Linux and Unix-like OS Assume that we build Boolector with support for Lingeling: ``` # Download and build Boolector git clone https://github.com/boolector/boolector cd boolector # Download and build Lingeling ./contrib/setup-lingeling.sh # Download and build BTOR2Tools ./contrib/setup-btor2tools.sh # Build Boolector ./configure.sh && cd build && make ``` All binaries (boolector, btormc, btormbt, btoruntrace) are generated into directory `boolector/build/bin`, and all libraries (libboolector.a, libboolector.so) are generated into directory `boolector/build/lib`. For more build configuration options of Boolector, see `configure.sh -h`. To build Boolector with Python bindings you need to install [Cython](http://cython.org/), and `btor2tools` and SAT solvers must be compiled with flag `-fPIC` (see build instructions of these tools for more details on how to build as shared library). The provided setup-\*.sh scripts automatically compile all dependencies with `-fPIC`. Then, from Boolector's root directory configure and build Boolector as follows: ``` ./configure.sh --python cd build make ``` To build the API documentation of Boolector, it is required to install [Sphinx](http://www.sphinx-doc.org) (>= version 1.2). Then build Boolector and issue: ``` cd doc make html ``` The documentation is then generated into `doc/_build/html`. Make sure to build Boolector with Python bindings, else the documentation of its Python API will not be included. ### Linking against Boolector in CMake projects Boolector's build system provides a CMake package configuration, which can be used by the `find_package()` command to provide information about Boolector's include directories, libraries and it's dependencies. After installing Boolector you can issue the following commands in your CMake project to link against Boolector. ``` find_package(Boolector) target_link_libraries( Boolector::boolector) ``` ### Windows For building and usage of Boolector on Windows, please see [COMPILING_WINDOWS.md](https://github.com/Boolector/boolector/blob/master/COMPILING_WINDOWS.md). ## Usage For a list of command line options, refer to `boolector -h`. For examples and instructions on how to use Boolector's C API, refer to `examples/api/c` and the [API documentation](https://boolector.github.io/docs). To build all examples in `examples/api/c` issue: ``` cd build make examples ``` For examples and instructions on how to use Boolector's Python API, refer to `examples/api/python/api_usage_examples.py` and the [API documentation](https://boolector.github.io/docs). To run `api_usage_examples.py`, from Boolector's root directory issue: ``` PYTHONPATH="build/lib" python examples/api/python/api_usage_examples.py ``` ## Contributing Boolector is distributed under the MIT license (see [COPYING](https://github.com/Boolector/boolector/blob/master/COPYING) file). By submitting a contribution you automatically accept the conditions described in [COPYING](https://github.com/Boolector/boolector/blob/master/COPYING). Additionally, we ask you to certify that you have the right to submit such contributions. To manage this process we use a mechanism known as [Developer Certificate of Origin](https://developercertificate.org), which can be acknowledged by signing-off your commits with `git commit -s`. We require all pull requests to be squashed into a single commit and signed-off. ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` boolector-3.2.4/THANKS000066400000000000000000000015041466217742400144400ustar00rootroot00000000000000Thanks to: + Sergiusz Bazanski a fix in the contrib/setup-* scripts in 2019. + Nina Engelhardt for fixing --stop-first handling in btormc in 2020. + Marco Gario for fixing a race condition in the build system in 2018. + Felix Griesau for a fix in the contrib/setup-* scripts in 2020. + Jannis Harder for fixing instructions and scripts for building Boolector for 64-bit Windows in 2020. + Andrew V. Jones for - setting up a patch set for building Boolector for Windows in 2019 - fixes in contrib/setup-* scripts and the build system in 2019 - adding termination support for CaDiCaL in 2019 - fixing instructions and scripts for building Boolector for 64-bit Windows in 2020 - providing a Dockerfile for Boolector in 2020 - fixes/additions in Boolector's C and Python API in 2019 and 2020 - fixing #136 in 2020 boolector-3.2.4/azure-pipelines.yml000066400000000000000000000057361466217742400173770ustar00rootroot00000000000000variables: CCACHE_DIR: $(Pipeline.Workspace)/ccache # cpython versions to build wheels for. PYTHON_VERSIONS: cp36 cp37 cp38 cp39 cp310 cp311 cp312 jobs: - job: Linux pool: vmImage: 'ubuntu-latest' strategy: matrix: production: btorConfig: '' btorConfigEnv: '' production_clang: btorConfig: '' btorConfigEnv: 'CC=clang CXX=clang++' debug: btorConfig: '-g' btorConfigEnv: '' debug_gmp: btorConfig: '-g --gmp' btorConfigEnv: '' python3: needCython: true btorConfig: '--python --py3' btorConfigEnv: '' steps: - bash: | sudo apt-get install ccache -y echo "##vso[task.prependpath]/usr/lib/ccache" displayName: 'Install ccache' - task: CacheBeta@0 inputs: key: $(Agent.OS) path: $(CCACHE_DIR) displayName: ccache - script: sudo pip install -U cython condition: eq(variables.needCython, true) displayName: 'Install Cython' - script: | ./contrib/setup-btor2tools.sh ./contrib/setup-cadical.sh ./contrib/setup-lingeling.sh ./contrib/setup-cms.sh displayName: 'Setup dependencies' - script: $(btorConfigEnv) ./configure.sh $(btorConfig) displayName: 'Configure Boolector' - script: make -j $(nproc) workingDirectory: 'build' displayName: 'Build Boolector' - script: ctest -j$(nproc) --output-on-failure workingDirectory: 'build' displayName: 'Run CTest' - job: macOS pool: vmImage: 'macos-latest' strategy: matrix: production: btorConfig: '' btorConfigEnv: '' production_clang: btorConfig: '' btorConfigEnv: 'CC=clang CXX=clang++' debug: btorConfig: '-g' btorConfigEnv: '' debug_gmp: btorConfig: '-g --gmp' btorConfigEnv: '' #python3: # needCython: true # btorConfig: '--python --py3' # btorConfigEnv: '' steps: - script: echo "##vso[task.setvariable variable=ncpus]$(sysctl -n hw.logicalcpu)" displayName: 'Determine number of CPUs' - bash: | brew install ccache echo "##vso[task.prependpath]/usr/local/opt/ccache/libexec" displayName: 'Install ccache' - task: CacheBeta@0 inputs: key: $(Agent.OS) path: $(CCACHE_DIR) displayName: ccache - script: sudo pip3 install cython condition: eq(variables.needCython, true) displayName: 'Install Cython' - script: | brew remove boost ./contrib/setup-btor2tools.sh ./contrib/setup-cadical.sh ./contrib/setup-lingeling.sh ./contrib/setup-cms.sh displayName: 'Setup dependencies' - script: $(btorConfigEnv) ./configure.sh $(btorConfig) displayName: 'Configure Boolector' - script: make -j $(ncpus) workingDirectory: 'build' displayName: 'Build Boolector' - script: ctest -j$(ncpus) --output-on-failure workingDirectory: 'build' displayName: 'Run CTest' - template: pypi/azure-pipelines-pypi.yml boolector-3.2.4/cmake/000077500000000000000000000000001466217742400146055ustar00rootroot00000000000000boolector-3.2.4/cmake/BoolectorConfig.cmake000066400000000000000000000004351466217742400206670ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # include("${CMAKE_CURRENT_LIST_DIR}/BoolectorTargets.cmake") boolector-3.2.4/cmake/CheckNoExportDynamic.cmake000066400000000000000000000006741466217742400216370ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Check if the linker flag no-export-dynamic is supported include(CheckCSourceCompiles) set(CMAKE_REQUIRED_FLAGS "-Wl,--no-export-dynamic") check_c_compiler_flag("" HAVE_NO_EXPORT_DYNAMIC) unset(CMAKE_REQUIRED_FLAGS) boolector-3.2.4/cmake/CheckSignals.cmake000066400000000000000000000012511466217742400201440ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Check if signals are available. include(CheckCSourceCompiles) CHECK_C_SOURCE_COMPILES( " #include #include static void catchsig(int sig) { (void) sig; } int main () { alarm (0); (void) signal (SIGALRM, catchsig); (void) signal (SIGINT, catchsig); (void) signal (SIGSEGV, catchsig); (void) signal (SIGABRT, catchsig); (void) signal (SIGTERM, catchsig); (void) signal (SIGBUS, catchsig); return 0; } " HAVE_SIGNALS ) boolector-3.2.4/cmake/CheckTimeUtils.cmake000066400000000000000000000012101466217742400204560ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Check if functions required for time statistics are available. include(CheckCSourceCompiles) CHECK_C_SOURCE_COMPILES( " #include #include #include int main () { struct rusage u; (void) getrusage(RUSAGE_SELF, &u); struct timespec ts; (void) clock_gettime (CLOCK_THREAD_CPUTIME_ID, &ts); struct timeval tv; (void) gettimeofday (&tv, 0); return 0; } " HAVE_TIME_UTILS ) boolector-3.2.4/cmake/CodeCoverage.cmake000066400000000000000000000267171466217742400201520ustar00rootroot00000000000000# Copyright (c) 2012 - 2017, Lars Bilke # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # 3. Neither the name of the copyright holder nor the names of its contributors # may be used to endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # CHANGES: # # 2012-01-31, Lars Bilke # - Enable Code Coverage # # 2013-09-17, Joakim Söderberg # - Added support for Clang. # - Some additional usage instructions. # # 2016-02-03, Lars Bilke # - Refactored functions to use named parameters # # 2017-06-02, Lars Bilke # - Merged with modified version from github.com/ufz/ogs # # # USAGE: # # 1. Copy this file into your cmake modules path. # # 2. Add the following line to your CMakeLists.txt: # include(CodeCoverage) # # 3. Append necessary compiler flags: # APPEND_COVERAGE_COMPILER_FLAGS() # # 4. If you need to exclude additional directories from the report, specify them # using the COVERAGE_LCOV_EXCLUDES variable before calling SETUP_TARGET_FOR_COVERAGE_LCOV. # Example: # set(COVERAGE_LCOV_EXCLUDES 'dir1/*' 'dir2/*') # # 5. Use the functions described below to create a custom make target which # runs your test executable and produces a code coverage report. # # 6. Build a Debug build: # cmake -DCMAKE_BUILD_TYPE=Debug .. # make # make my_coverage_target # include(CMakeParseArguments) # Check prereqs find_program( GCOV_PATH gcov ) find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl) find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat ) find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test) find_program( SIMPLE_PYTHON_EXECUTABLE python ) if(NOT GCOV_PATH) message(FATAL_ERROR "gcov not found! Aborting...") endif() # NOT GCOV_PATH if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang") if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3) message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...") endif() elseif(NOT CMAKE_COMPILER_IS_GNUCXX) message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") endif() set(COVERAGE_COMPILER_FLAGS "-g -O0 --coverage -fprofile-arcs -ftest-coverage" CACHE INTERNAL "") set(CMAKE_CXX_FLAGS_COVERAGE ${COVERAGE_COMPILER_FLAGS} CACHE STRING "Flags used by the C++ compiler during coverage builds." FORCE ) set(CMAKE_C_FLAGS_COVERAGE ${COVERAGE_COMPILER_FLAGS} CACHE STRING "Flags used by the C compiler during coverage builds." FORCE ) set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "" CACHE STRING "Flags used for linking binaries during coverage builds." FORCE ) set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "" CACHE STRING "Flags used by the shared libraries linker during coverage builds." FORCE ) mark_as_advanced( CMAKE_CXX_FLAGS_COVERAGE CMAKE_C_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE CMAKE_SHARED_LINKER_FLAGS_COVERAGE ) if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading") endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" if(CMAKE_C_COMPILER_ID STREQUAL "GNU") link_libraries(gcov) else() set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") endif() # Defines a target for running and collection code coverage information # Builds dependencies, runs the given executable and outputs reports. # NOTE! The executable should always have a ZERO as exit code otherwise # the coverage generation will not complete. # # SETUP_TARGET_FOR_COVERAGE_LCOV( # NAME testrunner_coverage # New target name # EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR # DEPENDENCIES testrunner # Dependencies to build first # ) function(SETUP_TARGET_FOR_COVERAGE_LCOV) set(options NONE) set(oneValueArgs NAME) set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(NOT LCOV_PATH) message(FATAL_ERROR "lcov not found! Aborting...") endif() # NOT LCOV_PATH if(NOT GENHTML_PATH) message(FATAL_ERROR "genhtml not found! Aborting...") endif() # NOT GENHTML_PATH # Setup target add_custom_target(${Coverage_NAME} # Cleanup lcov COMMAND ${LCOV_PATH} --directory . --zerocounters # Create baseline to make sure untouched files show up in the report COMMAND ${LCOV_PATH} -c -i -d . -o ${Coverage_NAME}.base # Run tests COMMAND ${Coverage_EXECUTABLE} # Capturing lcov counters and generating report COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info # add baseline counters COMMAND ${LCOV_PATH} -a ${Coverage_NAME}.base -a ${Coverage_NAME}.info --output-file ${Coverage_NAME}.total COMMAND ${LCOV_PATH} --remove ${Coverage_NAME}.total ${COVERAGE_LCOV_EXCLUDES} --output-file ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.base ${Coverage_NAME}.total ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned WORKING_DIRECTORY ${PROJECT_BINARY_DIR} DEPENDS ${Coverage_DEPENDENCIES} COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." ) # Show where to find the lcov info report add_custom_command(TARGET ${Coverage_NAME} POST_BUILD COMMAND ; COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info." ) # Show info where to find the report add_custom_command(TARGET ${Coverage_NAME} POST_BUILD COMMAND ; COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." ) endfunction() # SETUP_TARGET_FOR_COVERAGE_LCOV # Defines a target for running and collection code coverage information # Builds dependencies, runs the given executable and outputs reports. # NOTE! The executable should always have a ZERO as exit code otherwise # the coverage generation will not complete. # # SETUP_TARGET_FOR_COVERAGE_GCOVR_XML( # NAME ctest_coverage # New target name # EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR # DEPENDENCIES executable_target # Dependencies to build first # ) function(SETUP_TARGET_FOR_COVERAGE_GCOVR_XML) set(options NONE) set(oneValueArgs NAME) set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(NOT SIMPLE_PYTHON_EXECUTABLE) message(FATAL_ERROR "python not found! Aborting...") endif() # NOT SIMPLE_PYTHON_EXECUTABLE if(NOT GCOVR_PATH) message(FATAL_ERROR "gcovr not found! Aborting...") endif() # NOT GCOVR_PATH # Combine excludes to several -e arguments set(GCOVR_EXCLUDES "") foreach(EXCLUDE ${COVERAGE_GCOVR_EXCLUDES}) list(APPEND GCOVR_EXCLUDES "-e") list(APPEND GCOVR_EXCLUDES "${EXCLUDE}") endforeach() add_custom_target(${Coverage_NAME} # Run tests ${Coverage_EXECUTABLE} # Running gcovr COMMAND ${GCOVR_PATH} --xml -r ${PROJECT_SOURCE_DIR} ${GCOVR_EXCLUDES} --object-directory=${PROJECT_BINARY_DIR} -o ${Coverage_NAME}.xml WORKING_DIRECTORY ${PROJECT_BINARY_DIR} DEPENDS ${Coverage_DEPENDENCIES} COMMENT "Running gcovr to produce Cobertura code coverage report." ) # Show info where to find the report add_custom_command(TARGET ${Coverage_NAME} POST_BUILD COMMAND ; COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml." ) endfunction() # SETUP_TARGET_FOR_COVERAGE_GCOVR_XML # Defines a target for running and collection code coverage information # Builds dependencies, runs the given executable and outputs reports. # NOTE! The executable should always have a ZERO as exit code otherwise # the coverage generation will not complete. # # SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML( # NAME ctest_coverage # New target name # EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR # DEPENDENCIES executable_target # Dependencies to build first # ) function(SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML) set(options NONE) set(oneValueArgs NAME) set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(NOT SIMPLE_PYTHON_EXECUTABLE) message(FATAL_ERROR "python not found! Aborting...") endif() # NOT SIMPLE_PYTHON_EXECUTABLE if(NOT GCOVR_PATH) message(FATAL_ERROR "gcovr not found! Aborting...") endif() # NOT GCOVR_PATH # Combine excludes to several -e arguments set(GCOVR_EXCLUDES "") foreach(EXCLUDE ${COVERAGE_GCOVR_EXCLUDES}) list(APPEND GCOVR_EXCLUDES "-e") list(APPEND GCOVR_EXCLUDES "${EXCLUDE}") endforeach() add_custom_target(${Coverage_NAME} # Run tests ${Coverage_EXECUTABLE} # Create folder COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${Coverage_NAME} # Running gcovr COMMAND ${GCOVR_PATH} --html --html-details -r ${PROJECT_SOURCE_DIR} ${GCOVR_EXCLUDES} --object-directory=${PROJECT_BINARY_DIR} -o ${Coverage_NAME}/index.html WORKING_DIRECTORY ${PROJECT_BINARY_DIR} DEPENDS ${Coverage_DEPENDENCIES} COMMENT "Running gcovr to produce HTML code coverage report." ) # Show info where to find the report add_custom_command(TARGET ${Coverage_NAME} POST_BUILD COMMAND ; COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." ) endfunction() # SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML function(APPEND_COVERAGE_COMPILER_FLAGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE) message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}") endfunction() # APPEND_COVERAGE_COMPILER_FLAGS boolector-3.2.4/cmake/FindBtor2Tools.cmake000066400000000000000000000014701466217742400204230ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Find Btor2Tools # Btor2Tools_FOUND - found Btor2Tools lib # Btor2Tools_INCLUDE_DIR - the Btor2Tools include directory # Btor2Tools_LIBRARIES - Libraries needed to use Btor2Tools find_path(Btor2Tools_INCLUDE_DIR NAMES btor2parser.h) find_library(Btor2Tools_LIBRARIES NAMES btor2parser) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Btor2Tools DEFAULT_MSG Btor2Tools_INCLUDE_DIR Btor2Tools_LIBRARIES) mark_as_advanced(Btor2Tools_INCLUDE_DIR Btor2Tools_LIBRARIES) if(Btor2Tools_LIBRARIES) message(STATUS "Found Btor2Tools library: ${Btor2Tools_LIBRARIES}") endif() boolector-3.2.4/cmake/FindCaDiCaL.cmake000066400000000000000000000013761466217742400175770ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Find CaDiCaL # CaDiCaL_FOUND - found CaDiCaL lib # CaDiCaL_INCLUDE_DIR - the CaDiCaL include directory # CaDiCaL_LIBRARIES - Libraries needed to use CaDiCaL find_path(CaDiCaL_INCLUDE_DIR NAMES ccadical.h) find_library(CaDiCaL_LIBRARIES NAMES cadical) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(CaDiCaL DEFAULT_MSG CaDiCaL_INCLUDE_DIR CaDiCaL_LIBRARIES) mark_as_advanced(CaDiCaL_INCLUDE_DIR CaDiCaL_LIBRARIES) if(CaDiCaL_LIBRARIES) message(STATUS "Found CaDiCaL library: ${CaDiCaL_LIBRARIES}") endif() boolector-3.2.4/cmake/FindCryptoMiniSat.cmake000066400000000000000000000015771466217742400211670ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Find CryptoMiniSat # CryptoMiniSat_FOUND - found CryptoMiniSat lib # CryptoMiniSat_INCLUDE_DIR - the CryptoMiniSat include directory # CryptoMiniSat_LIBRARIES - Libraries needed to use CryptoMiniSat find_path(CryptoMiniSat_INCLUDE_DIR NAMES cryptominisat5/cryptominisat.h) find_library(CryptoMiniSat_LIBRARIES NAMES cryptominisat5) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(CryptoMiniSat DEFAULT_MSG CryptoMiniSat_INCLUDE_DIR CryptoMiniSat_LIBRARIES) mark_as_advanced(CryptoMiniSat_INCLUDE_DIR CryptoMiniSat_LIBRARIES) if(CryptoMiniSat_LIBRARIES) message(STATUS "Found CryptoMiniSat library: ${CryptoMiniSat_LIBRARIES}") endif() boolector-3.2.4/cmake/FindCython.cmake000066400000000000000000000046751466217742400176700ustar00rootroot00000000000000#.rst: # FindCython # ---------- # # Find ``cython`` executable. # # This module defines the following variables: # # ``CYTHON_EXECUTABLE`` # path to the ``cython`` program # # ``CYTHON_VERSION`` # version of ``cython`` # # ``CYTHON_FOUND`` # true if the program was found # # See also UseCython.cmake # #============================================================================= # Copyright 2011 Kitware, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #============================================================================= # Use the Cython executable that lives next to the Python executable # if it is a local installation. find_package(PythonInterp) if(PYTHONINTERP_FOUND) get_filename_component(_python_path ${PYTHON_EXECUTABLE} PATH) find_program(CYTHON_EXECUTABLE NAMES cython cython.bat cython3 HINTS ${_python_path} DOC "path to the cython executable") else() find_program(CYTHON_EXECUTABLE NAMES cython cython.bat cython3 DOC "path to the cython executable") endif() if(CYTHON_EXECUTABLE) set(CYTHON_version_command ${CYTHON_EXECUTABLE} --version) execute_process(COMMAND ${CYTHON_version_command} OUTPUT_VARIABLE CYTHON_version_output ERROR_VARIABLE CYTHON_version_error RESULT_VARIABLE CYTHON_version_result OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT ${CYTHON_version_result} EQUAL 0) set(_error_msg "Command \"${CYTHON_version_command}\" failed with") set(_error_msg "${_error_msg} output:\n${CYTHON_version_error}") message(SEND_ERROR "${_error_msg}") else() if("${CYTHON_version_output}" MATCHES "^[Cc]ython version ([^,]+)") set(CYTHON_VERSION "${CMAKE_MATCH_1}") endif() endif() endif() include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cython REQUIRED_VARS CYTHON_EXECUTABLE) mark_as_advanced(CYTHON_EXECUTABLE) include(UseCython) boolector-3.2.4/cmake/FindGMP.cmake000066400000000000000000000023651466217742400170410ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Find GMP # GMP_FOUND - system has GMP lib # GMP_INCLUDE_DIR - the GMP include directory # GMP_LIBRARIES - Libraries needed to use GMP # Check default location of GMP built with contrib/get-gmp. # If the user provides a directory we will not search the default paths and # fail if GMP was not found in the specified directory. if(NOT GMP_HOME) set(GMP_HOME ${PROJECT_SOURCE_DIR}/gmp-6.1.2) set(CHECK_SYSTEM_VERSION TRUE) endif() find_path(GMP_INCLUDE_DIR NAMES gmp.h gmpxx.h PATHS ${GMP_HOME}/include NO_DEFAULT_PATH) find_library(GMP_LIBRARIES NAMES gmp PATHS ${GMP_HOME}/lib NO_DEFAULT_PATH) if(CHECK_SYSTEM_VERSION) find_path(GMP_INCLUDE_DIR NAMES gmp.h gmpxx.h) find_library(GMP_LIBRARIES NAMES gmp) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES) if(GMP_LIBRARIES) message(STATUS "Found GMP libs: ${GMP_LIBRARIES}") endif() boolector-3.2.4/cmake/FindGoogleTest.cmake000066400000000000000000000034671466217742400204760ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Find GTest # # GTest_FOUND - Found GTest # GTest::GTest - GTest library find_package(GTest 1.12.1) if(NOT GTest_FOUND OR NOT TARGET GTest::gtest_main) include(ExternalProject) set(GTest_VERSION "1.12.1") ExternalProject_Add( GTest-EP PREFIX "${CMAKE_BINARY_DIR}/deps" URL https://github.com/google/googletest/archive/refs/tags/release-${GTest_VERSION}.tar.gz URL_HASH SHA1=cdddd449d4e3aa7bd421d4519c17139ea1890fe7 DOWNLOAD_NAME gtest.tar.gz CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= BUILD_COMMAND ${CMAKE_COMMAND} --build . --target gtest --target gtest_main BUILD_BYPRODUCTS /lib/libgtest.a /lib/libgtest_main.a LOG_DOWNLOAD ON LOG_UPDATE ON LOG_CONFIGURE ON LOG_BUILD ON LOG_INSTALL ON LOG_OUTPUT_ON_FAILURE TRUE ) set(GTest_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/include/") set(GTest_MAIN_LIBRARY "${CMAKE_BINARY_DIR}/deps/lib/libgtest_main.a") set(GTest_LIBRARY "${CMAKE_BINARY_DIR}/deps/lib/libgtest.a") file(MAKE_DIRECTORY "${GTest_INCLUDE_DIR}") add_library(GTest::gtest_main STATIC IMPORTED GLOBAL) set_target_properties(GTest::gtest_main PROPERTIES IMPORTED_LOCATION "${GTest_MAIN_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GTest_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "${GTest_LIBRARY}" ) set(GTest_FOUND TRUE) add_dependencies(GTest::gtest_main GTest-EP) message(STATUS "Building GTest ${GTest_VERSION}: ${GTest_MAIN_LIBRARY}") mark_as_advanced(GTest_FOUND) mark_as_advanced(GTest_INCLUDE_DIR) mark_as_advanced(GTest_LIBRARIES) endif() boolector-3.2.4/cmake/FindLingeling.cmake000066400000000000000000000014311466217742400203170ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Find Lingeling # Lingeling_FOUND - found Lingeling lib # Lingeling_INCLUDE_DIR - the Lingeling include directory # Lingeling_LIBRARIES - Libraries needed to use Lingeling find_path(Lingeling_INCLUDE_DIR NAMES lglib.h) find_library(Lingeling_LIBRARIES NAMES lgl) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Lingeling DEFAULT_MSG Lingeling_INCLUDE_DIR Lingeling_LIBRARIES) mark_as_advanced(Lingeling_INCLUDE_DIR Lingeling_LIBRARIES) if(Lingeling_LIBRARIES) message(STATUS "Found Lingeling library: ${Lingeling_LIBRARIES}") endif() boolector-3.2.4/cmake/FindMiniSat.cmake000066400000000000000000000014151466217742400177550ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Find MiniSAT # MiniSat_FOUND - found MiniSat lib # MiniSat_INCLUDE_DIR - the MiniSat include directory # MiniSat_LIBRARIES - Libraries needed to use MiniSat find_path(MiniSat_INCLUDE_DIR NAMES minisat/simp/SimpSolver.h) find_library(MiniSat_LIBRARIES NAMES minisat) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(MiniSat DEFAULT_MSG MiniSat_INCLUDE_DIR MiniSat_LIBRARIES) mark_as_advanced(MiniSat_INCLUDE_DIR MiniSat_LIBRARIES) if(MiniSat_LIBRARIES) message(STATUS "Found MiniSat library: ${MiniSat_LIBRARIES}") endif() boolector-3.2.4/cmake/FindPicoSAT.cmake000066400000000000000000000013751466217742400176600ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # # Find PicoSAT # PicoSAT_FOUND - found PicoSAT lib # PicoSAT_INCLUDE_DIR - the PicoSAT include directory # PicoSAT_LIBRARIES - Libraries needed to use PicoSAT find_path(PicoSAT_INCLUDE_DIR NAMES picosat.h) find_library(PicoSAT_LIBRARIES NAMES picosat) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PicoSAT DEFAULT_MSG PicoSAT_INCLUDE_DIR PicoSAT_LIBRARIES) mark_as_advanced(PicoSAT_INCLUDE_DIR PicoSAT_LIBRARIES) if(PicoSAT_LIBRARIES) message(STATUS "Found PicoSAT library: ${PicoSAT_LIBRARIES}") endif() boolector-3.2.4/cmake/FindPythonExtensions.cmake000066400000000000000000000450201466217742400217520ustar00rootroot00000000000000#.rst # Define functions to create Python modules and executables. # # This file defines CMake functions to build Python extension modules and # stand-alone executables. To use it, first include this file. # # find_package(PythonExtensions) # # The following variables are defined: # :: # # PYTHON_PREFIX - absolute path to the current Python # distribution's prefix # PYTHON_SITE_PACKAGES_DIR - absolute path to the current Python # distribution's site-packages directory # PYTHON_RELATIVE_SITE_PACKAGES_DIR - path to the current Python # distribution's site-packages directory # relative to its prefix # PYTHON_SEPARATOR - separator string for file path # components. Equivalent to ``os.sep`` in # Python. # PYTHON_PATH_SEPARATOR - separator string for PATH-style # environment variables. Equivalent to # ``os.pathsep`` in Python. # # The following functions are defined: # # python_extension_module( # [LINKED_MODULES_VAR ] # [FORWARD_DECL_MODULES_VAR ]) # # For libraries meant to be used as Python extension modules, either dynamically # loaded or directly linked. Amend the configuration of the library target # (created using ``add_library``) with additional options needed to build and # use the referenced library as a Python extension module. # # Only extension modules that are configured to be built as MODULE libraries can # be runtime-loaded through the standard Python import mechanism. All other # modules can only be included in standalone applications that are written to # expect their presence. In addition to being linked against the libraries for # these modules, such applications must forward declare their entry points and # initialize them prior to use. To generate these forward declarations and # initializations, see ``python_modules_header``. # # If ```` does not refer to a target, then it is assumed to refer to an # extension module that is not linked at all, but compiled along with other # source files directly into an executable. Adding these modules does not cause # any library configuration modifications, and they are not added to the list of # linked modules. They still must be forward declared and initialized, however, # and so are added to the forward declared modules list. # # Options: # # ``LINKED_MODULES_VAR `` # Name of the variable referencing a list of extension modules whose libraries # must be linked into the executables of any stand-alone applications that use # them. By default, the global property ``PY_LINKED_MODULES_LIST`` is used. # # ``FORWARD_DECL_MODULES_VAR `` # Name of the variable referencing a list of extension modules whose entry # points must be forward declared and called by any stand-alone applications # that use them. By default, the global property # ``PY_FORWARD_DECL_MODULES_LIST`` is used. # # # python_standalone_executable() # # For standalone executables that initialize their own Python runtime # (such as when building source files that include one generated by Cython with # the --embed option). Amend the configuration of the executable target # (created using ``add_executable``) with additional options needed to properly # build the referenced executable. # # python_modules_header( [HeaderFilename] # [FORWARD_DECL_MODULES_LIST ] # [HEADER_OUTPUT_VAR ] # [INCLUDE_DIR_OUTPUT_VAR ]) # # Generate a header file that contains the forward declarations and # initialization routines for the given list of Python extension modules. # ```` is the logical name for the header file (no file extensions). # ```` is the actual destination filename for the header file # (e.g.: decl_modules.h). # # If only ```` is provided, and it ends in the ".h" extension, then it # is assumed to be the ````. The filename of the header file # without the extension is used as the logical name. If only ```` is # provided, and it does not end in the ".h" extension, then the # ```` is assumed to ``.h``. # # The exact contents of the generated header file depend on the logical # ````. It should be set to a value that corresponds to the target # application, or for the case of multiple applications, some identifier that # conveyes its purpose. It is featured in the generated multiple inclusion # guard as well as the names of the generated initialization routines. # # The generated header file includes forward declarations for all listed # modules, as well as implementations for the following class of routines: # # ``int _(void)`` # Initializes the python extension module, ````. Returns an integer # handle to the module. # # ``void _LoadAllPythonModules(void)`` # Initializes all listed python extension modules. # # ``void CMakeLoadAllPythonModules(void);`` # Alias for ``_LoadAllPythonModules`` whose name does not depend on # ````. This function is excluded during preprocessing if the # preprocessing macro ``EXCLUDE_LOAD_ALL_FUNCTION`` is defined. # # ``void Py_Initialize_Wrapper();`` # Wrapper arpund ``Py_Initialize()`` that initializes all listed python # extension modules. This function is excluded during preprocessing if the # preprocessing macro ``EXCLUDE_PY_INIT_WRAPPER`` is defined. If this # function is generated, then ``Py_Initialize()`` is redefined to a macro # that calls this function. # # Options: # # ``FORWARD_DECL_MODULES_LIST `` # List of extension modules for which to generate forward declarations of # their entry points and their initializations. By default, the global # property ``PY_FORWARD_DECL_MODULES_LIST`` is used. # ``HEADER_OUTPUT_VAR `` # Name of the variable to set to the path to the generated header file. By # default, ```` is used. # # ``INCLUDE_DIR_OUTPUT_VAR `` # Name of the variable to set to the path to the directory containing the # generated header file. By default, ``_INCLUDE_DIRS`` is used. # # Defined variables: # # ```` # The path to the generated header file # # ```` # Directory containing the generated header file # # Example usage: # # .. code-block:: cmake # # find_package(PythonInterp) # find_package(PythonLibs) # find_package(PythonExtensions) # find_package(Cython) # find_package(Boost COMPONENTS python) # # # Simple Cython Module -- no executables # add_cython_target(_module.pyx) # add_library(_module MODULE ${_module}) # python_extension_module(_module) # # # Mix of Cython-generated code and C++ code using Boost Python # # Stand-alone executable -- no modules # include_directories(${Boost_INCLUDE_DIRS}) # add_cython_target(main.pyx CXX EMBED_MAIN) # add_executable(main boost_python_module.cxx ${main}) # target_link_libraries(main ${Boost_LIBRARIES}) # python_standalone_executable(main) # # # stand-alone executable with three extension modules: # # one statically linked, one dynamically linked, and one loaded at runtime # # # # Freely mixes Cython-generated code, code using Boost-Python, and # # hand-written code using the CPython API. # # # module1 -- statically linked # add_cython_target(module1.pyx) # add_library(module1 STATIC ${module1}) # python_extension_module(module1 # LINKED_MODULES_VAR linked_module_list # FORWARD_DECL_MODULES_VAR fdecl_module_list) # # # module2 -- dynamically linked # include_directories({Boost_INCLUDE_DIRS}) # add_library(module2 SHARED boost_module2.cxx) # target_link_libraries(module2 ${Boost_LIBRARIES}) # python_extension_module(module2 # LINKED_MODULES_VAR linked_module_list # FORWARD_DECL_MODULES_VAR fdecl_module_list) # # # module3 -- loaded at runtime # add_cython_target(module3a.pyx) # add_library(module1 MODULE ${module3a} module3b.cxx) # target_link_libraries(module3 ${Boost_LIBRARIES}) # python_extension_module(module3 # LINKED_MODULES_VAR linked_module_list # FORWARD_DECL_MODULES_VAR fdecl_module_list) # # # application executable -- generated header file + other source files # python_modules_header(modules # FORWARD_DECL_MODULES_LIST ${fdecl_module_list}) # include_directories(${modules_INCLUDE_DIRS}) # # add_cython_target(mainA) # add_cython_target(mainC) # add_executable(main ${mainA} mainB.cxx ${mainC} mainD.c) # # target_link_libraries(main ${linked_module_list} ${Boost_LIBRARIES}) # python_standalone_executable(main) # #============================================================================= # Copyright 2011 Kitware, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #============================================================================= find_package(PythonInterp REQUIRED) find_package(PythonLibs) include(targetLinkLibrariesWithDynamicLookup) set(_command " import distutils.sysconfig import itertools import os import os.path import site import sys result = None rel_result = None candidate_lists = [] try: candidate_lists.append((distutils.sysconfig.get_python_lib(),)) except AttributeError: pass try: candidate_lists.append(site.getsitepackages()) except AttributeError: pass try: candidate_lists.append((site.getusersitepackages(),)) except AttributeError: pass candidates = itertools.chain.from_iterable(candidate_lists) for candidate in candidates: rel_candidate = os.path.relpath( candidate, sys.prefix) if not rel_candidate.startswith(\"..\"): result = candidate rel_result = rel_candidate break sys.stdout.write(\";\".join(( os.sep, os.pathsep, sys.prefix, result, rel_result, ))) ") execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "${_command}" OUTPUT_VARIABLE _list RESULT_VARIABLE _result) list(GET _list 0 _item) set(PYTHON_SEPARATOR "${_item}") mark_as_advanced(PYTHON_SEPARATOR) list(GET _list 1 _item) set(PYTHON_PATH_SEPARATOR "${_item}") mark_as_advanced(PYTHON_PATH_SEPARATOR) list(GET _list 2 _item) set(PYTHON_PREFIX "${_item}") mark_as_advanced(PYTHON_PREFIX) list(GET _list 3 _item) set(PYTHON_SITE_PACKAGES_DIR "${_item}") mark_as_advanced(PYTHON_SITE_PACKAGES_DIR) list(GET _list 4 _item) set(PYTHON_RELATIVE_SITE_PACKAGES_DIR "${_item}") mark_as_advanced(PYTHON_RELATIVE_SITE_PACKAGES_DIR) function(python_extension_module _target) set(one_ops LINKED_MODULES_VAR FORWARD_DECL_MODULES_VAR) cmake_parse_arguments(_args "" "${one_ops}" "" ${ARGN}) set(_lib_type "NA") if(TARGET ${_target}) get_property(_lib_type TARGET ${_target} PROPERTY TYPE) endif() set(_is_non_lib TRUE) set(_is_static_lib FALSE) if(_lib_type STREQUAL "STATIC_LIBRARY") set(_is_static_lib TRUE) set(_is_non_lib FALSE) endif() set(_is_shared_lib FALSE) if(_lib_type STREQUAL "SHARED_LIBRARY") set(_is_shared_lib TRUE) set(_is_non_lib FALSE) endif() set(_is_module_lib FALSE) if(_lib_type STREQUAL "MODULE_LIBRARY") set(_is_module_lib TRUE) set(_is_non_lib FALSE) endif() if(_is_static_lib OR _is_shared_lib OR _is_non_lib) if(_is_static_lib OR _is_shared_lib) if(_args_LINKED_MODULES_VAR) set(${_args_LINKED_MODULES_VAR} ${${_args_LINKED_MODULES_VAR}} ${_target} PARENT_SCOPE) else() set_property(GLOBAL APPEND PROPERTY PY_LINKED_MODULES_LIST ${_target}) endif() endif() if(_args_FORWARD_DECL_MODULES_VAR) set(${_args_FORWARD_DECL_MODULES_VAR} ${${_args_FORWARD_DECL_MODULES_VAR}} ${_target} PARENT_SCOPE) else() set_property(GLOBAL APPEND PROPERTY PY_FORWARD_DECL_MODULES_LIST ${_target}) endif() endif() if(NOT _is_non_lib) include_directories("${PYTHON_INCLUDE_DIRS}") endif() if(_is_module_lib) set_target_properties(${_target} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}") endif() if(_is_module_lib OR _is_shared_lib) if(_is_module_lib AND WIN32 AND NOT CYGWIN) set_target_properties(${_target} PROPERTIES SUFFIX ".pyd") endif() target_link_libraries_with_dynamic_lookup(${_target} ${PYTHON_LIBRARIES}) endif() endfunction() function(python_standalone_executable _target) include_directories(${PYTHON_INCLUDE_DIRS}) target_link_libraries(${_target} ${PYTHON_LIBRARIES}) endfunction() function(python_modules_header _name) set(one_ops FORWARD_DECL_MODULES_LIST HEADER_OUTPUT_VAR INCLUDE_DIR_OUTPUT_VAR) cmake_parse_arguments(_args "" "${one_ops}" "" ${ARGN}) list(GET _args_UNPARSED_ARGUMENTS 0 _arg0) # if present, use arg0 as the input file path if(_arg0) set(_source_file ${_arg0}) # otherwise, must determine source file from name, or vice versa else() get_filename_component(_name_ext "${_name}" EXT) # if extension provided, _name is the source file if(_name_ext) set(_source_file ${_name}) get_filename_component(_name "${_source_file}" NAME_WE) # otherwise, assume the source file is ${_name}.h else() set(_source_file ${_name}.h) endif() endif() if(_args_FORWARD_DECL_MODULES_LIST) set(static_mod_list ${_args_FORWARD_DECL_MODULES_LIST}) else() get_property(static_mod_list GLOBAL PROPERTY PY_FORWARD_DECL_MODULES_LIST) endif() string(REPLACE "." "_" _header_name "${_name}") string(TOUPPER ${_header_name} _header_name_upper) set(_header_name_upper "_${_header_name_upper}_H") set(generated_file ${CMAKE_CURRENT_BINARY_DIR}/${_source_file}) set(generated_file_tmp "${generated_file}.in") file(WRITE ${generated_file_tmp} "/* Created by CMake. DO NOT EDIT; changes will be lost. */\n") set(_chunk "") set(_chunk "${_chunk}#ifndef ${_header_name_upper}\n") set(_chunk "${_chunk}#define ${_header_name_upper}\n") set(_chunk "${_chunk}\n") set(_chunk "${_chunk}#include \n") set(_chunk "${_chunk}\n") set(_chunk "${_chunk}#ifdef __cplusplus\n") set(_chunk "${_chunk}extern \"C\" {\n") set(_chunk "${_chunk}#endif /* __cplusplus */\n") set(_chunk "${_chunk}\n") set(_chunk "${_chunk}#if PY_MAJOR_VERSION < 3\n") file(APPEND ${generated_file_tmp} "${_chunk}") foreach(_module ${static_mod_list}) file(APPEND ${generated_file_tmp} "PyMODINIT_FUNC init${PYTHON_MODULE_PREFIX}${_module}(void);\n") endforeach() file(APPEND ${generated_file_tmp} "#else /* PY_MAJOR_VERSION >= 3*/\n") foreach(_module ${static_mod_list}) file(APPEND ${generated_file_tmp} "PyMODINIT_FUNC PyInit_${PYTHON_MODULE_PREFIX}${_module}(void);\n") endforeach() set(_chunk "") set(_chunk "${_chunk}#endif /* PY_MAJOR_VERSION >= 3*/\n\n") set(_chunk "${_chunk}#ifdef __cplusplus\n") set(_chunk "${_chunk}}\n") set(_chunk "${_chunk}#endif /* __cplusplus */\n") set(_chunk "${_chunk}\n") file(APPEND ${generated_file_tmp} "${_chunk}") foreach(_module ${static_mod_list}) set(_import_function "${_header_name}_${_module}") set(_prefixed_module "${PYTHON_MODULE_PREFIX}${_module}") set(_chunk "") set(_chunk "${_chunk}int ${_import_function}(void)\n") set(_chunk "${_chunk}{\n") set(_chunk "${_chunk} static char name[] = \"${_prefixed_module}\";\n") set(_chunk "${_chunk} #if PY_MAJOR_VERSION < 3\n") set(_chunk "${_chunk} return PyImport_AppendInittab(") set(_chunk "${_chunk}name, init${_prefixed_module});\n") set(_chunk "${_chunk} #else /* PY_MAJOR_VERSION >= 3 */\n") set(_chunk "${_chunk} return PyImport_AppendInittab(") set(_chunk "${_chunk}name, PyInit_${_prefixed_module});\n") set(_chunk "${_chunk} #endif /* PY_MAJOR_VERSION >= 3 */\n") set(_chunk "${_chunk}}\n\n") file(APPEND ${generated_file_tmp} "${_chunk}") endforeach() file(APPEND ${generated_file_tmp} "void ${_header_name}_LoadAllPythonModules(void)\n{\n") foreach(_module ${static_mod_list}) file(APPEND ${generated_file_tmp} " ${_header_name}_${_module}();\n") endforeach() file(APPEND ${generated_file_tmp} "}\n\n") set(_chunk "") set(_chunk "${_chunk}#ifndef EXCLUDE_LOAD_ALL_FUNCTION\n") set(_chunk "${_chunk}void CMakeLoadAllPythonModules(void)\n") set(_chunk "${_chunk}{\n") set(_chunk "${_chunk} ${_header_name}_LoadAllPythonModules();\n") set(_chunk "${_chunk}}\n") set(_chunk "${_chunk}#endif /* !EXCLUDE_LOAD_ALL_FUNCTION */\n\n") set(_chunk "${_chunk}#ifndef EXCLUDE_PY_INIT_WRAPPER\n") set(_chunk "${_chunk}static void Py_Initialize_Wrapper()\n") set(_chunk "${_chunk}{\n") set(_chunk "${_chunk} ${_header_name}_LoadAllPythonModules();\n") set(_chunk "${_chunk} Py_Initialize();\n") set(_chunk "${_chunk}}\n") set(_chunk "${_chunk}#define Py_Initialize Py_Initialize_Wrapper\n") set(_chunk "${_chunk}#endif /* !EXCLUDE_PY_INIT_WRAPPER */\n\n") set(_chunk "${_chunk}#endif /* !${_header_name_upper} */\n") file(APPEND ${generated_file_tmp} "${_chunk}") # with configure_file() cmake complains that you may not use a file created # using file(WRITE) as input file for configure_file() execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${generated_file_tmp}" "${generated_file}" OUTPUT_QUIET ERROR_QUIET) set(_header_output_var ${_name}) if(_args_HEADER_OUTPUT_VAR) set(_header_output_var ${_args_HEADER_OUTPUT_VAR}) endif() set(${_header_output_var} ${generated_file} PARENT_SCOPE) set(_include_dir_var ${_name}_INCLUDE_DIRS) if(_args_INCLUDE_DIR_OUTPUT_VAR) set(_include_dir_var ${_args_INCLUDE_DIR_OUTPUT_VAR}) endif() set(${_include_dirs_var} ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) endfunction() boolector-3.2.4/cmake/Toolchain-mingw-win32.cmake000066400000000000000000000015151466217742400216100ustar00rootroot00000000000000# Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # SET(CMAKE_SYSTEM_NAME Windows) # which compilers to use for C and C++ SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc) SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres) # here is the target environment located SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) #set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) #set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(IS_WINDOWS_BUILD TRUE) boolector-3.2.4/cmake/UseCython.cmake000066400000000000000000000333241466217742400175350ustar00rootroot00000000000000#.rst # Define a function to create Cython modules. # # For more information on the Cython project, see http://cython.org/. # "Cython is a language that makes writing C extensions for the Python language # as easy as Python itself." # # This file defines a CMake function to build a Cython Python module. # To use it, first include this file. # # include(UseCython) # # The following functions are defined: # # add_cython_target( [] # [EMBED_MAIN] # [C | CXX] # [PY2 | PY3] # [OUTPUT_VAR ]) # # Create a custom rule to generate the source code for a Python extension module # using cython. ```` is the name of the new target, and ```` # is the path to a cython source file. Note that, despite the name, no new # targets are created by this function. Instead, see ``OUTPUT_VAR`` for # retrieving the path to the generated source for subsequent targets. # # If only ```` is provided, and it ends in the ".pyx" extension, then it # is assumed to be the ````. The name of the input without the # extension is used as the target name. If only ```` is provided, and it # does not end in the ".pyx" extension, then the ```` is assumed to # be ``.pyx``. # # The Cython include search path is amended with any entries found in the # ``INCLUDE_DIRECTORIES`` property of the directory containing the # ```` file. Use ``iunclude_directories`` to add to the Cython # include search path. # # Options: # # ``EMBED_MAIN`` # Embed a main() function in the generated output (for stand-alone # applications that initialize their own Python runtime). # # ``C | CXX`` # Force the generation of either a C or C++ file. By default, a C file is # generated, unless the C language is not enabled for the project; in this # case, a C++ file is generated by default. # # ``PY2 | PY3`` # Force compilation using either Python-2 or Python-3 syntax and code # semantics. By default, Python-2 syntax and semantics are used if the major # version of Python found is 2. Otherwise, Python-3 syntax and sematics are # used. # # ``OUTPUT_VAR `` # Set the variable ```` in the parent scope to the path to the # generated source file. By default, ```` is used as the output # variable name. # # Defined variables: # # ```` # The path of the generated source file. # # # Example usage: # # .. code-block:: cmake # # find_package(Cython) # # # Note: In this case, either one of these arguments may be omitted; their # # value would have been inferred from that of the other. # add_cython_target(cy_code cy_code.pyx) # # add_library(cy_code MODULE ${cy_code}) # target_link_libraries(cy_code ...) # # Cache variables that effect the behavior include: # # ``CYTHON_ANNOTATE`` # whether to create an annotated .html file when compiling # # ``CYTHON_FLAGS`` # additional flags to pass to the Cython compiler # # See also FindCython.cmake # #============================================================================= # Copyright 2011 Kitware, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #============================================================================= # Configuration options. set(CYTHON_ANNOTATE OFF CACHE BOOL "Create an annotated .html file when compiling *.pyx.") set(CYTHON_FLAGS "" CACHE STRING "Extra flags to the cython compiler.") mark_as_advanced(CYTHON_ANNOTATE CYTHON_FLAGS) find_package(PythonLibs REQUIRED) set(CYTHON_CXX_EXTENSION "cxx") set(CYTHON_C_EXTENSION "c") get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES) function(add_cython_target _name) set(options EMBED_MAIN C CXX PY2 PY3) set(options1 OUTPUT_VAR) cmake_parse_arguments(_args "${options}" "${options1}" "" ${ARGN}) list(GET _args_UNPARSED_ARGUMENTS 0 _arg0) # if provided, use _arg0 as the input file path if(_arg0) set(_source_file ${_arg0}) # otherwise, must determine source file from name, or vice versa else() get_filename_component(_name_ext "${_name}" EXT) # if extension provided, _name is the source file if(_name_ext) set(_source_file ${_name}) get_filename_component(_name "${_source_file}" NAME_WE) # otherwise, assume the source file is ${_name}.pyx else() set(_source_file ${_name}.pyx) endif() endif() set(_embed_main FALSE) if("C" IN_LIST languages) set(_output_syntax "C") elseif("CXX" IN_LIST languages) set(_output_syntax "CXX") else() message(FATAL_ERROR "Either C or CXX must be enabled to use Cython") endif() if("${PYTHONLIBS_VERSION_STRING}" MATCHES "^2.") set(_input_syntax "PY2") else() set(_input_syntax "PY3") endif() if(_args_EMBED_MAIN) set(_embed_main TRUE) endif() if(_args_C) set(_output_syntax "C") endif() if(_args_CXX) set(_output_syntax "CXX") endif() if(_args_PY2) set(_input_syntax "PY2") endif() if(_args_PY3) set(_input_syntax "PY3") endif() set(embed_arg "") if(_embed_main) set(embed_arg "--embed") endif() set(cxx_arg "") set(extension "c") if(_output_syntax STREQUAL "CXX") set(cxx_arg "--cplus") set(extension "cxx") endif() set(py_version_arg "") if(_input_syntax STREQUAL "PY2") set(py_version_arg "-2") elseif(_input_syntax STREQUAL "PY3") set(py_version_arg "-3") endif() set(generated_file "${CMAKE_CURRENT_BINARY_DIR}/${_name}.${extension}") set_source_files_properties(${generated_file} PROPERTIES GENERATED TRUE) set(_output_var ${_name}) if(_args_OUTPUT_VAR) set(_output_var ${_args_OUTPUT_VAR}) endif() set(${_output_var} ${generated_file} PARENT_SCOPE) file(RELATIVE_PATH generated_file_relative ${CMAKE_BINARY_DIR} ${generated_file}) set(comment "Generating ${_output_syntax} source ${generated_file_relative}") set(cython_include_directories "") set(pxd_dependencies "") set(c_header_dependencies "") # Get the include directories. get_source_file_property(pyx_location ${_source_file} LOCATION) get_filename_component(pyx_path ${pyx_location} PATH) get_directory_property(cmake_include_directories DIRECTORY ${pyx_path} INCLUDE_DIRECTORIES) list(APPEND cython_include_directories ${cmake_include_directories}) # Determine dependencies. # Add the pxd file with the same basename as the given pyx file. get_filename_component(pyx_file_basename ${_source_file} NAME_WE) unset(corresponding_pxd_file CACHE) find_file(corresponding_pxd_file ${pyx_file_basename}.pxd PATHS "${pyx_path}" ${cmake_include_directories} NO_DEFAULT_PATH) if(corresponding_pxd_file) list(APPEND pxd_dependencies "${corresponding_pxd_file}") endif() # pxd files to check for additional dependencies set(pxds_to_check "${_source_file}" "${pxd_dependencies}") set(pxds_checked "") set(number_pxds_to_check 1) while(number_pxds_to_check GREATER 0) foreach(pxd ${pxds_to_check}) list(APPEND pxds_checked "${pxd}") list(REMOVE_ITEM pxds_to_check "${pxd}") # look for C headers file(STRINGS "${pxd}" extern_from_statements REGEX "cdef[ ]+extern[ ]+from.*$") foreach(statement ${extern_from_statements}) # Had trouble getting the quote in the regex string(REGEX REPLACE "cdef[ ]+extern[ ]+from[ ]+[\"]([^\"]+)[\"].*" "\\1" header "${statement}") unset(header_location CACHE) find_file(header_location ${header} PATHS ${cmake_include_directories}) if(header_location) list(FIND c_header_dependencies "${header_location}" header_idx) if(${header_idx} LESS 0) list(APPEND c_header_dependencies "${header_location}") endif() endif() endforeach() # check for pxd dependencies # Look for cimport statements. set(module_dependencies "") file(STRINGS "${pxd}" cimport_statements REGEX cimport) foreach(statement ${cimport_statements}) if(${statement} MATCHES from) string(REGEX REPLACE "from[ ]+([^ ]+).*" "\\1" module "${statement}") else() string(REGEX REPLACE "cimport[ ]+([^ ]+).*" "\\1" module "${statement}") endif() list(APPEND module_dependencies ${module}) endforeach() # check for pxi dependencies # Look for include statements. set(include_dependencies "") file(STRINGS "${pxd}" include_statements REGEX include) foreach(statement ${include_statements}) string(REGEX REPLACE "include[ ]+[\"]([^\"]+)[\"].*" "\\1" module "${statement}") list(APPEND include_dependencies ${module}) endforeach() list(REMOVE_DUPLICATES module_dependencies) list(REMOVE_DUPLICATES include_dependencies) # Add modules to the files to check, if appropriate. foreach(module ${module_dependencies}) unset(pxd_location CACHE) find_file(pxd_location ${module}.pxd PATHS "${pyx_path}" ${cmake_include_directories} NO_DEFAULT_PATH) if(pxd_location) list(FIND pxds_checked ${pxd_location} pxd_idx) if(${pxd_idx} LESS 0) list(FIND pxds_to_check ${pxd_location} pxd_idx) if(${pxd_idx} LESS 0) list(APPEND pxds_to_check ${pxd_location}) list(APPEND pxd_dependencies ${pxd_location}) endif() # if it is not already going to be checked endif() # if it has not already been checked endif() # if pxd file can be found endforeach() # for each module dependency discovered # Add includes to the files to check, if appropriate. foreach(_include ${include_dependencies}) unset(pxi_location CACHE) find_file(pxi_location ${_include} PATHS "${pyx_path}" ${cmake_include_directories} NO_DEFAULT_PATH) if(pxi_location) list(FIND pxds_checked ${pxi_location} pxd_idx) if(${pxd_idx} LESS 0) list(FIND pxds_to_check ${pxi_location} pxd_idx) if(${pxd_idx} LESS 0) list(APPEND pxds_to_check ${pxi_location}) list(APPEND pxd_dependencies ${pxi_location}) endif() # if it is not already going to be checked endif() # if it has not already been checked endif() # if include file can be found endforeach() # for each include dependency discovered endforeach() # for each include file to check list(LENGTH pxds_to_check number_pxds_to_check) endwhile() # Set additional flags. set(annotate_arg "") if(CYTHON_ANNOTATE) set(annotate_arg "--annotate") endif() set(no_docstrings_arg "") if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") set(no_docstrings_arg "--no-docstrings") endif() set(cython_debug_arg "") set(embed_pos_arg "") set(line_directives_arg "") if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") set(cython_debug_arg "--gdb") set(embed_pos_arg "--embed-positions") set(line_directives_arg "--line-directives") endif() # Include directory arguments. list(REMOVE_DUPLICATES cython_include_directories) set(include_directory_arg "") foreach(_include_dir ${cython_include_directories}) set(include_directory_arg ${include_directory_arg} "--include-dir" "${_include_dir}") endforeach() list(REMOVE_DUPLICATES pxd_dependencies) list(REMOVE_DUPLICATES c_header_dependencies) # Add the command to run the compiler. add_custom_command(OUTPUT ${generated_file} COMMAND ${CYTHON_EXECUTABLE} ARGS ${cxx_arg} ${include_directory_arg} ${py_version_arg} ${embed_arg} ${annotate_arg} # We always want to generate docstrings # ${no_docstrings_arg} ${cython_debug_arg} ${embed_pos_arg} ${line_directives_arg} ${CYTHON_FLAGS} ${pyx_location} --output-file ${generated_file} DEPENDS ${_source_file} ${pxd_dependencies} IMPLICIT_DEPENDS ${_output_syntax} ${c_header_dependencies} COMMENT ${comment}) # NOTE(opadron): I thought about making a proper target, but after trying it # out, I decided that it would be far too convenient to use the same name as # the target for the extension module (e.g.: for single-file modules): # # ... # add_cython_target(_module.pyx) # add_library(_module ${_module}) # ... # # The above example would not be possible since the "_module" target name # would already be taken by the cython target. Since I can't think of a # reason why someone would need the custom target instead of just using the # generated file directly, I decided to leave this commented out. # # add_custom_target(${_name} DEPENDS ${generated_file}) # Remove their visibility to the user. set(corresponding_pxd_file "" CACHE INTERNAL "") set(header_location "" CACHE INTERNAL "") set(pxd_location "" CACHE INTERNAL "") endfunction() boolector-3.2.4/cmake/targetLinkLibrariesWithDynamicLookup.cmake000066400000000000000000000344521466217742400251130ustar00rootroot00000000000000# # - This module provides the function # target_link_libraries_with_dynamic_lookup which can be used to # "weakly" link a loadable module. # # Link a library to a target such that the symbols are resolved at # run-time not link-time. This should be used when compiling a # loadable module when the symbols should be resolve from the run-time # environment where the module is loaded, and not a specific system # library. # # Specifically, for OSX it uses undefined dynamic_lookup. This is # similar to using "-shared" on Linux where undefined symbols are # ignored. # # Additionally, the linker is checked to see if it supports undefined # symbols when linking a shared library. If it does then the library # is not linked when specified with this function. # # http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/ # # # The following functions are defined: # # _get_target_type( ) # # **INTERNAL** Shorthand for querying an abbreviated version of the target type # of the given ````. ```` is set to "STATIC" for a # STATIC_LIBRARY, "SHARED" for a SHARED_LIBRARY, "MODULE" for a MODULE_LIBRARY, # and "EXE" for an EXECUTABLE. # # Defined variables: # # ```` # The abbreviated version of the ````'s type. # # # _test_weak_link_project( # # # ) # # **INTERNAL** Attempt to compile and run a test project where a target of type # ```` is weakly-linked against a dependency of type ````. # ```` can be one of "STATIC", "SHARED", "MODULE", or "EXE". # ```` can be one of "STATIC", "SHARED", or "MODULE". # # Defined variables: # # ```` # Whether the current C toolchain can produce a working target binary of type # ```` that is weakly-linked against a dependency target of type # ````. # # ```` # List of flags to add to the linker command to produce a working target # binary of type ```` that is weakly-linked against a dependency # target of type ````. # # # check_dynamic_lookup( # # # ) # # Check if the linker requires a command line flag to allow leaving symbols # unresolved when producing a target of type ```` that is # weakly-linked against a dependency of type ````. ```` # can be one of "STATIC", "SHARED", "MODULE", or "EXE". ```` can be # one of "STATIC", "SHARED", or "MODULE". The result is cached between # invocations and recomputed only when the value of CMake's linker flag list # changes; ``CMAKE_STATIC_LINKER_FLAGS`` if ```` is "STATIC", and # ``CMAKE_SHARED_LINKER_FLAGS`` otherwise. # # # Defined variables: # # ```` # Whether the current C toolchain supports weak-linking for target binaries of # type ```` that are weakly-linked against a dependency target of # type ````. # # ```` # List of flags to add to the linker command to produce a working target # binary of type ```` that is weakly-linked against a dependency # target of type ````. # # ``HAS_DYNAMIC_LOOKUP__`` # Cached, global alias for ```` # # ``DYNAMIC_LOOKUP_FLAGS__`` # Cached, global alias for ```` # # # target_link_libraries_with_dynamic_lookup( []) # # Like proper linking, except that the given ```` are not necessarily # linked. Instead, the ```` is produced in a manner that allows for # symbols unresolved within it to be resolved at runtime, presumably by the # given ````. If such a target can be produced, the provided # ```` are not actually linked. On platforms that do not support # weak-linking, this function works just like ``target_link_libraries``. function(_get_target_type result_var target) set(target_type "SHARED_LIBRARY") if(TARGET ${target}) get_property(target_type TARGET ${target} PROPERTY TYPE) endif() set(result "STATIC") if(target_type STREQUAL "STATIC_LIBRARY") set(result "STATIC") endif() if(target_type STREQUAL "SHARED_LIBRARY") set(result "SHARED") endif() if(target_type STREQUAL "MODULE_LIBRARY") set(result "MODULE") endif() if(target_type STREQUAL "EXECUTABLE") set(result "EXE") endif() set(${result_var} ${result} PARENT_SCOPE) endfunction() function(_test_weak_link_project target_type lib_type can_weak_link_var project_name) set(gnu_ld_ignore "-Wl,--unresolved-symbols=ignore-all") set(osx_dynamic_lookup "-undefined dynamic_lookup") set(no_flag "") foreach(link_flag_spec gnu_ld_ignore osx_dynamic_lookup no_flag) set(link_flag "${${link_flag_spec}}") set(test_project_dir "${PROJECT_BINARY_DIR}/CMakeTmp") set(test_project_dir "${test_project_dir}/${project_name}") set(test_project_dir "${test_project_dir}/${link_flag_spec}") set(test_project_dir "${test_project_dir}/${target_type}") set(test_project_dir "${test_project_dir}/${lib_type}") set(test_project_src_dir "${test_project_dir}/src") set(test_project_bin_dir "${test_project_dir}/build") file(MAKE_DIRECTORY ${test_project_src_dir}) file(MAKE_DIRECTORY ${test_project_bin_dir}) set(mod_type "STATIC") set(link_mod_lib TRUE) set(link_exe_lib TRUE) set(link_exe_mod FALSE) if("${target_type}" STREQUAL "EXE") set(link_exe_lib FALSE) set(link_exe_mod TRUE) else() set(mod_type "${target_type}") endif() if("${mod_type}" STREQUAL "MODULE") set(link_mod_lib FALSE) endif() file(WRITE "${test_project_src_dir}/CMakeLists.txt" " cmake_minimum_required(VERSION ${CMAKE_VERSION}) project(${project_name} C) include_directories(${test_project_src_dir}) add_library(number ${lib_type} number.c) add_library(counter ${mod_type} counter.c) ") if("${mod_type}" STREQUAL "MODULE") file(APPEND "${test_project_src_dir}/CMakeLists.txt" " set_target_properties(counter PROPERTIES PREFIX \"\") ") endif() if(link_mod_lib) file(APPEND "${test_project_src_dir}/CMakeLists.txt" " target_link_libraries(counter number) ") elseif(NOT link_flag STREQUAL "") file(APPEND "${test_project_src_dir}/CMakeLists.txt" " set_target_properties(counter PROPERTIES LINK_FLAGS \"${link_flag}\") ") endif() file(APPEND "${test_project_src_dir}/CMakeLists.txt" " add_executable(main main.c) ") if(link_exe_lib) file(APPEND "${test_project_src_dir}/CMakeLists.txt" " target_link_libraries(main number) ") elseif(NOT link_flag STREQUAL "") file(APPEND "${test_project_src_dir}/CMakeLists.txt" " target_link_libraries(main \"${link_flag}\") ") endif() if(link_exe_mod) file(APPEND "${test_project_src_dir}/CMakeLists.txt" " target_link_libraries(main counter) ") else() file(APPEND "${test_project_src_dir}/CMakeLists.txt" " target_link_libraries(main \"${CMAKE_DL_LIBS}\") ") endif() file(WRITE "${test_project_src_dir}/number.c" " #include static int _number; void set_number(int number) { _number = number; } int get_number() { return _number; } ") file(WRITE "${test_project_src_dir}/number.h" " #ifndef _NUMBER_H #define _NUMBER_H extern void set_number(int); extern int get_number(void); #endif ") file(WRITE "${test_project_src_dir}/counter.c" " #include int count() { int result = get_number(); set_number(result + 1); return result; } ") file(WRITE "${test_project_src_dir}/counter.h" " #ifndef _COUNTER_H #define _COUNTER_H extern int count(void); #endif ") file(WRITE "${test_project_src_dir}/main.c" " #include #include #include ") if(NOT link_exe_mod) file(APPEND "${test_project_src_dir}/main.c" " #include ") endif() file(APPEND "${test_project_src_dir}/main.c" " int my_count() { int result = get_number(); set_number(result + 1); return result; } int main(int argc, char **argv) { int result; ") if(NOT link_exe_mod) file(APPEND "${test_project_src_dir}/main.c" " void *counter_module; int (*count)(void); counter_module = dlopen(\"./counter.so\", RTLD_LAZY | RTLD_GLOBAL); if(!counter_module) goto error; count = dlsym(counter_module, \"count\"); if(!count) goto error; ") endif() file(APPEND "${test_project_src_dir}/main.c" " result = count() != 0 ? EXIT_FAILURE : my_count() != 1 ? EXIT_FAILURE : my_count() != 2 ? EXIT_FAILURE : count() != 3 ? EXIT_FAILURE : count() != 4 ? EXIT_FAILURE : count() != 5 ? EXIT_FAILURE : my_count() != 6 ? EXIT_FAILURE : EXIT_SUCCESS; ") if(NOT link_exe_mod) file(APPEND "${test_project_src_dir}/main.c" " goto done; error: fprintf(stderr, \"Error occured:\\n %s\\n\", dlerror()); result = 1; done: if(counter_module) dlclose(counter_module); ") endif() file(APPEND "${test_project_src_dir}/main.c" " return result; } ") set(_rpath_arg) if(APPLE AND ${CMAKE_VERSION} VERSION_GREATER 2.8.11) set(_rpath_arg "-DCMAKE_MACOSX_RPATH='${CMAKE_MACOSX_RPATH}'") endif() try_compile(project_compiles "${test_project_bin_dir}" "${test_project_src_dir}" "${project_name}" CMAKE_FLAGS "-DCMAKE_SHARED_LINKER_FLAGS='${CMAKE_SHARED_LINKER_FLAGS}'" ${_rpath_arg} OUTPUT_VARIABLE compile_output) set(project_works 1) set(run_output) if(project_compiles) execute_process(COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} "${test_project_bin_dir}/main" WORKING_DIRECTORY "${test_project_bin_dir}" RESULT_VARIABLE project_works OUTPUT_VARIABLE run_output ERROR_VARIABLE run_output) endif() set(test_description "Weak Link ${target_type} -> ${lib_type} (${link_flag_spec})") if(project_works EQUAL 0) set(project_works TRUE) message(STATUS "Performing Test ${test_description} - Success") else() set(project_works FALSE) message(STATUS "Performing Test ${test_description} - Failed") file(APPEND ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing Test ${test_description} failed with the " "following output:\n" "BUILD\n-----\n${compile_output}\nRUN\n---\n${run_output}\n") endif() set(${can_weak_link_var} ${project_works} PARENT_SCOPE) if(project_works) set(${project_name} ${link_flag} PARENT_SCOPE) break() endif() endforeach() endfunction() function(check_dynamic_lookup target_type lib_type has_dynamic_lookup_var link_flags_var) # hash the CMAKE_FLAGS passed and check cache to know if we need to rerun if("${target_type}" STREQUAL "STATIC") string(MD5 cmake_flags_hash "${CMAKE_STATIC_LINKER_FLAGS}") else() string(MD5 cmake_flags_hash "${CMAKE_SHARED_LINKER_FLAGS}") endif() set(cache_var "HAS_DYNAMIC_LOOKUP_${target_type}_${lib_type}") set(cache_hash_var "HAS_DYNAMIC_LOOKUP_${target_type}_${lib_type}_hash") set(result_var "DYNAMIC_LOOKUP_FLAGS_${target_type}_${lib_type}") if( NOT DEFINED ${cache_hash_var} OR NOT "${${cache_hash_var}}" STREQUAL "${cmake_flags_hash}") unset(${cache_var} CACHE) endif() if(NOT DEFINED ${cache_var}) set(skip_test FALSE) if(NOT CMAKE_CROSSCOMPILING) set(skip_test TRUE) elseif(CMAKE_CROSSCOMPILING AND CMAKE_CROSSCOMPILING_EMULATOR) set(skip_test TRUE) endif() if(skip_test) set(has_dynamic_lookup FALSE) set(link_flags) else() _test_weak_link_project(${target_type} ${lib_type} has_dynamic_lookup link_flags) endif() set(caveat " (when linking ${target_type} against ${lib_type})") set(${cache_var} "${has_dynamic_lookup}" CACHE BOOL "linker supports dynamic lookup for undefined symbols${caveat}") set(${result_var} "${link_flags}" CACHE BOOL "linker flags for dynamic lookup${caveat}") set(${cache_hash_var} "${cmake_flags_hash}" CACHE INTERNAL "hashed flags for ${cache_var} check") endif() set(${has_dynamic_lookup_var} "${${cache_var}}" PARENT_SCOPE) set(${link_flags_var} "${${result_var}}" PARENT_SCOPE) endfunction() function(target_link_libraries_with_dynamic_lookup target) _get_target_type(target_type ${target}) set(link_props) set(link_items) set(link_libs) foreach(lib ${ARGN}) _get_target_type(lib_type ${lib}) check_dynamic_lookup(${target_type} ${lib_type} has_dynamic_lookup dynamic_lookup_flags) if(has_dynamic_lookup) if(dynamic_lookup_flags) if("${target_type}" STREQUAL "EXE") list(APPEND link_items "${dynamic_lookup_flags}") else() list(APPEND link_props "${dynamic_lookup_flags}") endif() endif() else() list(APPEND link_libs "${lib}") endif() endforeach() if(link_props) list(REMOVE_DUPLICATES link_props) endif() if(link_items) list(REMOVE_DUPLICATES link_items) endif() if(link_libs) list(REMOVE_DUPLICATES link_libs) endif() if(link_props) set_target_properties(${target} PROPERTIES LINK_FLAGS "${link_props}") endif() set(links "${link_items}" "${link_libs}") if(links) target_link_libraries(${target} "${links}") endif() endfunction() boolector-3.2.4/configure.sh000077500000000000000000000144301466217742400160470ustar00rootroot00000000000000#!/bin/sh #--------------------------------------------------------------------------# BUILDDIR=build #--------------------------------------------------------------------------# asan=no ubsan=no debug=no check=no log=no shared=no prefix= path= gmp=no testing=unknown lingeling=unknown minisat=unknown picosat=unknown cadical=unknown cms=unknown gcov=no gprof=no python=no py2=no py3=no timestats=no # Enable macOS universal binaries univeral=no ninja=no flags="" #--------------------------------------------------------------------------# usage () { cat < ...] where