cmake_minimum_required(VERSION 3.1)
-if(POLICY CMP0075)
- cmake_policy(SET CMP0075 NEW)
-endif()
-
#-----------------------------------------------------------------------------#
+# Project configuration
project(cvc4)
-# Major component of the version of CVC4.
-set(CVC4_MAJOR 1)
-# Minor component of the version of CVC4.
-set(CVC4_MINOR 7)
-# Release component of the version of CVC4.
-set(CVC4_RELEASE 0)
+set(CVC4_MAJOR 1) # Major component of the version of CVC4.
+set(CVC4_MINOR 8) # Minor component of the version of CVC4.
+set(CVC4_RELEASE 0) # Release component of the version of CVC4.
+
# Extraversion component of the version of CVC4.
set(CVC4_EXTRAVERSION "-prerelease")
+# Shared library versioning. Increment SOVERSION for every new CVC4 release.
+set(CVC4_SOVERSION 6)
+
# Full release string for CVC4.
if(CVC4_RELEASE)
set(CVC4_RELEASE_STRING
set(CVC4_RELEASE_STRING "${CVC4_MAJOR}.${CVC4_MINOR}${CVC4_EXTRAVERSION}")
endif()
-# Define to the full name of this package.
-set(PACKAGE_NAME "${PROJECT_NAME}")
-
-# Shared library versioning. Increment SOVERSION for every new CVC4 release.
-set(CVC4_VERSION "${CVC4_MAJOR}.${CVC4_MINOR}.${CVC4_RELEASE}")
-set(CVC4_SOVERSION 5)
-
-#### These defines are only use in autotools make files, will likely be
-#### replaced with corresponding CPack stuff
-## Define to the full name and version of this package.
-#set(PACKAGE_STRING "${PROJECT_NAME} ${CVC4_RELEASE_STRING}")
-## Define to the one symbol short name of this package.
-#set(PACKAGE_TARNAME "${PROJECT_NAME}")
-## Define to the home page for this package.
-#set(PACKAGE_URL "")
-## Define to the version of this package.
-#set(PACKAGE_VERSION "${CVC4_RELEASE_STRING}")
-## Define to the address where bug reports for this package should be sent.
-#set(PACKAGE_BUGREPORT "cvc4-bugs@cs.stanford.edu")
-
-#-----------------------------------------------------------------------------#
-
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
-#-----------------------------------------------------------------------------#
-# Macros
-
-include(CheckCCompilerFlag)
-include(CheckCXXCompilerFlag)
+# Generate compile_commands.json, which can be used for various code completion
+# plugins.
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
-macro(add_c_flag flag)
- if(CMAKE_C_FLAGS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
- else()
- set(CMAKE_C_FLAGS "${flag}")
- endif()
- message(STATUS "Configuring with C flag '${flag}'")
-endmacro()
-
-macro(add_cxx_flag flag)
- if(CMAKE_CXX_FLAGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
- else()
- set(CMAKE_CXX_FLAGS "${flag}")
- endif()
- 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()
-
-# CVC4 Boolean options are three-valued to detect if an option was set by the
-# user. The available values are: IGNORE (default), ON, OFF
-# Default options do not override options that were set by the user, i.e.,
-# cvc4_set_option only sets an option if it's value is still IGNORE.
-# This e.g., allows the user to disable proofs for debug builds (where proofs
-# are enabled by default).
-macro(cvc4_option 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()
-
-# Only set option if the user did not set an option.
-macro(cvc4_set_option var value)
- if(${var} STREQUAL "IGNORE")
- set(${var} ${value})
- endif()
-endmacro()
-
-# Prepend 'prepand_value' to each element of the list 'in_list'. The result
-# is stored in 'out_list'.
-function(list_prepend in_list prepand_value out_list)
- foreach(_elem ${${in_list}})
- list(APPEND ${out_list} "${prepand_value}${_elem}")
- endforeach()
- set(${out_list} ${${out_list}} PARENT_SCOPE)
-endfunction()
+# Embed the installation prefix as an RPATH in the executable such that the
+# linker can find our libraries (such as libcvc4parser) when executing the cvc4
+# binary. This is for example useful when installing CVC4 with a custom prefix
+# on macOS (e.g. when using homebrew in a non-standard directory). If we do not
+# set this option, then the linker will not be able to find the required
+# libraries when trying to run CVC4.
+#
+# More information on RPATH in CMake:
+# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
+set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
#-----------------------------------------------------------------------------#
-# libcvc4 macros
-
-# Collect all libraries that must be linked against libcvc4. These will be
-# actually linked in src/CMakeLists.txt with target_link_libaries(...).
-macro(libcvc4_link_libraries library)
- set(LIBCVC4_LIBRARIES ${LIBCVC4_LIBRARIES} ${library})
-endmacro()
-
-# Collect all include directories that are required for libcvc4. These will be
-# actually included in src/CMakeLists.txt with target_include_directories(...).
-macro(libcvc4_include_directories dirs)
- set(LIBCVC4_INCLUDES ${LIBCVC4_INCLUDES} ${dirs})
-endmacro()
-
-# Collect all source files that are required to build libcvc4 in LIBCVC4_SRCS
-# or LIBCVC4_GEN_SRCS. If GENERATED is the first argument the sources are
-# added to LIBCVC4_GEN_SRCS. All sources are prepended with the absolute
-# current path path. CMAKE_CURRENT_BINARY_DIR is prepended
-# to generated source files.
-macro(libcvc4_add_sources)
- set(_sources ${ARGV})
-
- # Check if the first argument is GENERATED.
- list(GET _sources 0 _generated)
- if(${_generated} STREQUAL "GENERATED")
- list(REMOVE_AT _sources 0)
- set(_cur_path ${CMAKE_CURRENT_BINARY_DIR})
- set(_append_to LIBCVC4_GEN_SRCS)
- else()
- set(_cur_path ${CMAKE_CURRENT_SOURCE_DIR})
- set(_append_to LIBCVC4_SRCS)
- endif()
-
- # Prepend source files with current path.
- foreach(_src ${_sources})
- list(APPEND ${_append_to} "${_cur_path}/${_src}")
- endforeach()
-
- file(RELATIVE_PATH
- _rel_path "${PROJECT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}")
- # Make changes to list ${_append_to} visible to the parent scope if not
- # called from src/.
- # Note: ${_append_to} refers to the variable name whereas ${${_append_to}}
- # refers to the contents of the variable.
- if(_rel_path)
- set(${_append_to} ${${_append_to}} PARENT_SCOPE)
- endif()
-endmacro()
+include(Helpers)
#-----------------------------------------------------------------------------#
# User options
# General build options
#
-# >> 3-valued: INGORE ON OFF
+# >> 3-valued: IGNORE ON OFF
# > allows to detect if set by user (default: IGNORE)
# > only necessary for options set for build types
cvc4_option(ENABLE_ASAN "Enable ASAN build")
cvc4_option(ENABLE_UNIT_TESTING "Enable unit testing")
cvc4_option(ENABLE_VALGRIND "Enable valgrind instrumentation")
cvc4_option(ENABLE_SHARED "Build as shared library")
+cvc4_option(ENABLE_STATIC_BINARY
+ "Build static binaries with statically linked system libraries")
# >> 2-valued: ON OFF
# > for options where we don't need to detect if set by user (default: OFF)
option(ENABLE_BEST "Enable dependencies known to give best performance")
# Optional dependencies
#
-# >> 3-valued: INGORE ON OFF
+# >> 3-valued: IGNORE ON OFF
# > allows to detect if set by user (default: IGNORE)
# > only necessary for options set for ENABLE_BEST
cvc4_option(USE_ABC "Use ABC for AIG bit-blasting")
# > for options where we don't need to detect if set by user (default: OFF)
option(USE_CADICAL "Use CaDiCaL SAT solver")
option(USE_CRYPTOMINISAT "Use CryptoMiniSat SAT solver")
+option(USE_DRAT2ER "Include drat2er for making eager BV proofs")
option(USE_LFSC "Use LFSC proof checker")
option(USE_SYMFPU "Use SymFPU for floating point support")
+option(USE_PYTHON2 "Prefer using Python 2 (for Python bindings)")
+option(USE_PYTHON3 "Prefer using Python 3 (for Python bindings)")
# Custom install directories for dependencies
# If no directory is provided by the user, we first check if the dependency was
set(ANTLR_DIR "" CACHE STRING "Set ANTLR3 install directory")
set(CADICAL_DIR "" CACHE STRING "Set CaDiCaL install directory")
set(CRYPTOMINISAT_DIR "" CACHE STRING "Set CryptoMiniSat install directory")
+set(CXXTEST_DIR "" CACHE STRING "Set CxxTest install directory")
+set(DRAT2ER_DIR "" CACHE STRING "Set drat2er install directory")
set(GLPK_DIR "" CACHE STRING "Set GLPK install directory")
set(GMP_DIR "" CACHE STRING "Set GMP install directory")
set(LFSC_DIR "" CACHE STRING "Set LFSC install directory")
set(SYMFPU_DIR "" CACHE STRING "Set SymFPU install directory")
+# Prepend binaries with prefix on make install
+set(PROGRAM_PREFIX "" CACHE STRING "Program prefix on make install")
+
# Supported language bindings
option(BUILD_BINDINGS_JAVA "Build Java bindings")
option(BUILD_BINDINGS_PYTHON "Build Python bindings")
set(OPTIMIZATION_LEVEL 3)
set(GPL_LIBS "")
-set(BUILD_TYPES Production Debug Testing Competition)
-
#-----------------------------------------------------------------------------#
-# CVC4 build variables
+# Determine number of threads available, used to configure (default) parallel
+# execution of custom test targets (can be overriden with ARGS=-jN).
-set(CVC4_DEBUG 0)
-set(CVC4_BUILD_PROFILE_PRODUCTION 0)
-set(CVC4_BUILD_PROFILE_DEBUG 0)
-set(CVC4_BUILD_PROFILE_TESTING 0)
-set(CVC4_BUILD_PROFILE_COMPETITION 0)
+include(ProcessorCount)
+ProcessorCount(CTEST_NTHREADS)
+if(CTEST_NTHREADS EQUAL 0)
+ set(CTEST_NTHREADS 1)
+endif()
#-----------------------------------------------------------------------------#
# Build types
+# Note: Module CodeCoverage requires the name of the debug build to conform
+# to cmake standards (first letter uppercase).
+set(BUILD_TYPES Production Debug Testing Competition)
+
if(ENABLE_ASAN)
set(CMAKE_BUILD_TYPE Debug)
endif()
# 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")
- include(ConfigDebug)
-elseif(CMAKE_BUILD_TYPE STREQUAL "Production")
- include(ConfigProduction)
-elseif(CMAKE_BUILD_TYPE STREQUAL "Testing")
- include(ConfigTesting)
-elseif(CMAKE_BUILD_TYPE STREQUAL "Competition")
- include(ConfigCompetition)
+# Check if specified build type is valid.
+list(FIND BUILD_TYPES ${CMAKE_BUILD_TYPE} FOUND_BUILD_TYPE)
+if(${FOUND_BUILD_TYPE} EQUAL -1)
+ message(FATAL_ERROR
+ "'${CMAKE_BUILD_TYPE}' is not a valid build type. "
+ "Available builds are: ${BUILD_TYPES}")
endif()
+message(STATUS "Building ${CMAKE_BUILD_TYPE} build")
+include(Config${CMAKE_BUILD_TYPE})
+
#-----------------------------------------------------------------------------#
# Compiler flags
add_check_c_cxx_flag("-O${OPTIMIZATION_LEVEL}")
+add_check_c_cxx_flag("-Wall")
add_check_c_flag("-fexceptions")
add_check_c_cxx_flag("-Wno-deprecated")
add_check_cxx_flag("-Wsuggest-override")
add_check_cxx_flag("-Wnon-virtual-dtor")
+# Temporarily disable -Wclass-memaccess to suppress 'no trivial copy-assignment'
+# cdlist.h warnings. Remove when fixed.
+add_check_cxx_flag("-Wno-class-memaccess")
+
#-----------------------------------------------------------------------------#
# Option defaults (three-valued options (cvc4_option(...)))
+#
+# These options are only set if their value is IGNORE. Otherwise, the user
+# already set the option, which we don't want to overwrite.
-cvc4_set_option(ENABLE_PORTFOLIO OFF)
-cvc4_set_option(ENABLE_SHARED ON)
-cvc4_set_option(ENABLE_VALGRIND OFF)
-cvc4_set_option(USE_ABC OFF)
-cvc4_set_option(USE_GLPK OFF)
-cvc4_set_option(USE_READLINE OFF)
+if(ENABLE_STATIC_BINARY)
+ cvc4_set_option(ENABLE_SHARED OFF)
+else()
+ cvc4_set_option(ENABLE_SHARED ON)
+endif()
#-----------------------------------------------------------------------------#
# Set options for best configuration
-if (ENABLE_BEST)
+if(ENABLE_BEST)
cvc4_set_option(USE_ABC ON)
+ cvc4_set_option(USE_CADICAL ON)
cvc4_set_option(USE_CLN ON)
+ cvc4_set_option(USE_CRYPTOMINISAT ON)
cvc4_set_option(USE_GLPK ON)
cvc4_set_option(USE_READLINE ON)
endif()
-#-----------------------------------------------------------------------------#
+# Only enable unit testing if assertions are enabled. Otherwise, unit tests
+# that expect AssertionException to be thrown will fail.
+if(NOT ENABLE_ASSERTIONS)
+ set(ENABLE_UNIT_TESTING OFF)
+endif()
+#-----------------------------------------------------------------------------#
+# Shared/static libraries
+#
# This needs to be set before any find_package(...) command since we want to
# search for static libraries with suffix .a.
-if(NOT ENABLE_SHARED)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
- set(CMAKE_EXE_LINKER_FLAGS "-static")
+
+if(ENABLE_SHARED)
+ set(BUILD_SHARED_LIBS ON)
+ if(ENABLE_STATIC_BINARY)
+ set(ENABLE_STATIC_BINARY OFF)
+ message(WARNING "Disabling static binary since shared build is enabled.")
+ endif()
+else()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(BUILD_SHARED_LIBS OFF)
+ # This is required to force find_package(Boost) to use static libraries.
+ set(Boost_USE_STATIC_LIBS ON)
+ cvc4_set_option(ENABLE_STATIC_BINARY ON)
+
+ # Never build unit tests as static binaries, otherwise we'll end up with
+ # ~300MB per unit test.
+ if(ENABLE_UNIT_TESTING)
+ message(WARNING "Disabling unit tests since static build is enabled.")
+ set(ENABLE_UNIT_TESTING OFF)
+ endif()
endif()
#-----------------------------------------------------------------------------#
# Enable the ctest testing framework
+# This needs to be enabled here rather than in subdirectory test in order to
+# allow calling ctest from the root build directory.
enable_testing()
#-----------------------------------------------------------------------------#
+# Check GCC version.
+#
+# GCC version 4.5.1 builds MiniSat incorrectly with -O2, which results in
+# incorrect answers.
+
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ execute_process(
+ COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
+ OUTPUT_VARIABLE GCC_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(GCC_VERSION VERSION_EQUAL "4.5.1")
+ message(FATAL_ERROR
+ "GCC 4.5.1's optimizer is known to build MiniSat incorrectly "
+ "(and by extension CVC4).")
+ endif()
+endif()
+
+#-----------------------------------------------------------------------------#
+# Check options, find packages and configure build.
+
+if(USE_PYTHON2)
+ find_package(PythonInterp 2.7 REQUIRED)
+elseif(USE_PYTHON3)
+ find_package(PythonInterp 3 REQUIRED)
+else()
+ find_package(PythonInterp REQUIRED)
+endif()
set(GMP_HOME ${GMP_DIR})
find_package(GMP REQUIRED)
-libcvc4_link_libraries(${GMP_LIBRARIES})
-libcvc4_include_directories(${GMP_INCLUDE_DIR})
if(ENABLE_ASAN)
- set(CMAKE_REQUIRED_LIBRARIES -fsanitize=address)
+ # -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_LIBRARIES)
+ unset(CMAKE_REQUIRED_FLAGS)
add_required_c_cxx_flag("-fno-omit-frame-pointer")
add_check_c_cxx_flag("-fsanitize-recover=address")
endif()
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
add_definitions(-DCVC4_COVERAGE)
- setup_target_for_coverage_lcov(
+ # Note: The ctest command returns a non-zero exit code if tests fail or run
+ # into a timeout. As a consequence, the coverage report is not generated. To
+ # prevent this we always return with exit code 0 after the ctest command has
+ # finished.
+ setup_target_for_coverage_gcovr_html(
NAME coverage
- EXECUTABLE ctest $(ARGS)
- DEPENDENCIES cvc4-bin)
+ EXECUTABLE
+ ctest -j${CTEST_NTHREADS} -LE "example"
+ --output-on-failure $(ARGS) || exit 0
+ DEPENDS
+ build-tests)
endif()
if(ENABLE_DEBUG_CONTEXT_MM)
add_definitions(-DCVC4_DEBUG_CONTEXT_MEMORY_MANAGER)
endif()
-if(ENABLE_DUMPING)
- add_definitions(-DCVC4_DUMPING)
-endif()
-
if(ENABLE_DEBUG_SYMBOLS)
add_check_c_cxx_flag("-ggdb3")
endif()
add_definitions(-DCVC4_MUZZLE)
endif()
+# This check needs to come before the USE_CLN check.
if(ENABLE_PORTFOLIO)
find_package(Boost 1.50.0 REQUIRED COMPONENTS thread)
+ if (ENABLE_DUMPING)
+ message(FATAL_ERROR "Dumping not supported with a portfolio build.")
+ endif()
# Disable CLN for portfolio builds since it is not thread safe (uses an
# unlocked hash table internally).
if(USE_CLN)
set(BOOST_HAS_THREAD_ATTR 1)
endif()
+# This has to be processed after ENABLE_PORTFOLIO (disables dumping support).
+if(ENABLE_DUMPING)
+ add_definitions(-DCVC4_DUMPING)
+endif()
+
if(ENABLE_PROFILING)
add_definitions(-DCVC4_PROFILING)
add_check_c_cxx_flag("-pg")
if(ENABLE_PROOFS)
set(RUN_REGRESSION_ARGS ${RUN_REGRESSION_ARGS} --enable-proof)
add_definitions(-DCVC4_PROOF)
- set(CVC4_PROOF 1)
endif()
if(ENABLE_REPLAY)
if(ENABLE_TRACING)
add_definitions(-DCVC4_TRACING)
- set(CVC4_TRACING 1)
-endif()
-
-if(ENABLE_UNIT_TESTING)
- find_package(CxxTest REQUIRED)
- # Force shared libs for unit tests, static libs with unit tests are not
- # working right now.
- set(ENABLE_SHARED ON)
-endif()
-
-if(ENABLE_SHARED)
- set(BUILD_SHARED_LIBS ON)
endif()
if(ENABLE_STATISTICS)
if(ENABLE_VALGRIND)
find_package(Valgrind REQUIRED)
- libcvc4_include_directories(${Valgrind_INCLUDE_DIR})
add_definitions(-DCVC4_VALGRIND)
endif()
if(USE_ABC)
set(ABC_HOME "${ABC_DIR}")
find_package(ABC REQUIRED)
- libcvc4_link_libraries(${ABC_LIBRARIES})
- libcvc4_include_directories(${ABC_INCLUDE_DIR})
add_definitions(-DCVC4_USE_ABC ${ABC_ARCH_FLAGS})
endif()
if(USE_CADICAL)
set(CaDiCaL_HOME ${CADICAL_DIR})
find_package(CaDiCaL REQUIRED)
- libcvc4_link_libraries(${CaDiCaL_LIBRARIES})
- libcvc4_include_directories(${CaDiCaL_INCLUDE_DIR})
add_definitions(-DCVC4_USE_CADICAL)
endif()
if(USE_CLN)
set(GPL_LIBS "${GPL_LIBS} cln")
find_package(CLN 1.2.2 REQUIRED)
- libcvc4_link_libraries(${CLN_LIBRARIES})
- libcvc4_include_directories(${CLN_INCLUDE_DIR})
set(CVC4_USE_CLN_IMP 1)
set(CVC4_USE_GMP_IMP 0)
else()
endif()
set(CryptoMiniSat_HOME ${CRYPTOMINISAT_DIR})
find_package(CryptoMiniSat REQUIRED)
- libcvc4_link_libraries(${CryptoMiniSat_LIBRARIES})
- libcvc4_include_directories(${CryptoMiniSat_INCLUDE_DIR})
add_definitions(-DCVC4_USE_CRYPTOMINISAT)
endif()
+if(USE_DRAT2ER)
+ set(Drat2Er_HOME ${DRAT2ER_DIR})
+ find_package(Drat2Er REQUIRED)
+ add_definitions(-DCVC4_USE_DRAT2ER)
+endif()
+
if(USE_GLPK)
set(GPL_LIBS "${GPL_LIBS} glpk")
set(GLPK_HOME ${GLPK_DIR})
find_package(GLPK REQUIRED)
- libcvc4_link_libraries(${GLPK_LIBRARIES})
- libcvc4_include_directories(${GLPK_INCLUDE_DIR})
add_definitions(-DCVC4_USE_GLPK)
endif()
set(RUN_REGRESSION_ARGS ${RUN_REGRESSION_ARGS} --with-lfsc)
set(LFSC_HOME ${LFSC_DIR})
find_package(LFSC REQUIRED)
- libcvc4_link_libraries(${LFSC_LIBRARIES})
- libcvc4_include_directories(${LFSC_INCLUDE_DIR})
add_definitions(-DCVC4_USE_LFSC)
- set(CVC4_USE_LFSC 1)
-else()
- set(CVC4_USE_LFSC 0)
endif()
if(USE_READLINE)
+ set(GPL_LIBS "${GPL_LIBS} readline")
find_package(Readline REQUIRED)
set(HAVE_LIBREADLINE 1)
if(Readline_COMPENTRY_FUNC_RETURNS_CHARPTR)
if(USE_SYMFPU)
set(SymFPU_HOME ${SYMFPU_DIR})
find_package(SymFPU REQUIRED)
- libcvc4_include_directories(${SymFPU_INCLUDE_DIR})
add_definitions(-DCVC4_USE_SYMFPU)
set(CVC4_USE_SYMFPU 1)
else()
set(CVC4_GPL_DEPS 1)
endif()
-#-----------------------------------------------------------------------------#
-
-include(GetGitRevisionDescription)
-get_git_head_revision(GIT_REFSPEC GIT_SHA1)
-git_local_changes(GIT_IS_DIRTY)
-if(${GIT_IS_DIRTY} STREQUAL "DIRTY")
- set(GIT_IS_DIRTY "true")
-else()
- set(GIT_IS_DIRTY "false")
-endif()
-
-execute_process(
- COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
- OUTPUT_VARIABLE GIT_BRANCH
- OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-
#-----------------------------------------------------------------------------#
# Generate CVC4's cvc4autoconfig.h header
include(ConfigureCVC4)
-configure_file(cvc4autoconfig.new.h.in cvc4autoconfig.h)
+configure_file(cvc4autoconfig.h.in cvc4autoconfig.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
#-----------------------------------------------------------------------------#
endif()
add_subdirectory(doc)
+add_subdirectory(examples EXCLUDE_FROM_ALL) # excluded from all target
add_subdirectory(src)
+add_subdirectory(test)
if(BUILD_BINDINGS_JAVA OR BUILD_BINDINGS_PYTHON)
add_subdirectory(src/bindings)
endif()
-if(BUILD_BINDINGS_JAVA)
- add_subdirectory(test/java)
-endif()
-
-add_subdirectory(test/regress)
-add_subdirectory(test/system)
-
-if(ENABLE_UNIT_TESTING)
- add_subdirectory(test/unit)
-endif()
-
#-----------------------------------------------------------------------------#
# Print build configuration
-if(CVC4_BUILD_PROFILE_PRODUCTION)
- set(CVC4_BUILD_PROFILE_STRING "production")
-elseif(CVC4_BUILD_PROFILE_DEBUG)
- set(CVC4_BUILD_PROFILE_STRING "debug")
-elseif(CVC4_BUILD_PROFILE_TESTING)
- set(CVC4_BUILD_PROFILE_STRING "testing")
-elseif(CVC4_BUILD_PROFILE_COMPETITION)
- set(CVC4_BUILD_PROFILE_STRING "competition")
-endif()
-# Get all definitions added via add_definitions to print it below
+# Convert build type to lower case.
+string(TOLOWER ${CMAKE_BUILD_TYPE} CVC4_BUILD_PROFILE_STRING)
+
+# Get all definitions added via add_definitions.
get_directory_property(CVC4_DEFINITIONS COMPILE_DEFINITIONS)
string(REPLACE ";" " " CVC4_DEFINITIONS "${CVC4_DEFINITIONS}")
-# Print configuration of 2/3-valued option 'var' with prefix 'str'
-macro(print_config str var)
- if(${var} STREQUAL "ON")
- set(OPT_VAL_STR "on")
- elseif(${var} STREQUAL "OFF")
- set(OPT_VAL_STR "off")
- elseif(${var} STREQUAL "IGNORE")
- set(OPT_VAL_STR "default")
- endif()
- message("${str} ${OPT_VAL_STR}")
-endmacro()
-
message("CVC4 ${CVC4_RELEASE_STRING}")
message("")
message("Build profile : ${CVC4_BUILD_PROFILE_STRING}")
print_config("Valgrind :" ENABLE_VALGRIND)
message("")
print_config("Shared libs :" ENABLE_SHARED)
+print_config("Static binary :" ENABLE_STATIC_BINARY)
print_config("Java bindings :" BUILD_BINDINGS_JAVA)
print_config("Python bindings :" BUILD_BINDINGS_PYTHON)
+print_config("Python2 :" USE_PYTHON2)
+print_config("Python3 :" USE_PYTHON3)
message("")
print_config("Portfolio :" ENABLE_PORTFOLIO)
message("")
print_config("ABC :" USE_ABC)
print_config("CaDiCaL :" USE_CADICAL)
print_config("CryptoMiniSat :" USE_CRYPTOMINISAT)
+print_config("drat2er :" USE_DRAT2ER)
print_config("GLPK :" USE_GLPK)
print_config("LFSC :" USE_LFSC)
if(CRYPTOMINISAT_DIR)
message("CRYPTOMINISAT dir : ${CRYPTOMINISAT_DIR}")
endif()
+if(DRAT2ER_DIR)
+ message("DRAT2ER dir : ${DRAT2ER_DIR}")
+endif()
if(GLPK_DIR)
message("GLPK dir : ${GLPK_DIR}")
endif()
message("CPPLAGS (-D...) : ${CVC4_DEFINITIONS}")
message("CXXFLAGS : ${CMAKE_CXX_FLAGS}")
message("CFLAGS : ${CMAKE_C_FLAGS}")
-#message("LIBS : ${LIBS}")
-#message("LDFLAGS : ${LDFLAGS}")
-#message("")
-#message("libcvc4 version : ${{CVC4_LIBRARY_VERSION}")
-#message("libcvc4parser version : ${CVC4_PARSER_LIBRARY_VERSION}")
-#message("libcvc4compat version : ${CVC4_COMPAT_LIBRARY_VERSION_or_nobuild}")
-#message("libcvc4bindings version: ${CVC4_BINDINGS_LIBRARY_VERSION_or_nobuild}")
-#message("")
+message("")
message("Install prefix : ${CMAKE_INSTALL_PREFIX}")
message("")
"\n"
"If you prefer to license CVC4 under those terms, please configure CVC4 to"
"\n"
- "disable all optional GPLed library dependences (-DENABLE_BSD_ONLY=ON)."
+ "disable all optional GPLed library dependencies (-DENABLE_BSD_ONLY=ON)."
)
else()
message(