option(USE_READLINE "Use readline for better interactive support")
option(USE_SYMFPU "Use SymFPU for floating point support")
+# Custom install directories for dependencies
+# If no directory is provided by the user, we first check if the dependency was
+# installed via the corresponding contrib/get-* script and if not found, we
+# check the intalled system version. If the user provides a directory we
+# immediately fail if the dependency was not found at the specified location.
+set(ABC_DIR "" CACHE STRING "Set ABC install directory")
+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(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")
+
# Supported language bindings
option(BUILD_BINDINGS_JAVA "Build Java bindings" OFF)
option(BUILD_BINDINGS_PYTHON "Build Python bindings" OFF)
#-----------------------------------------------------------------------------#
find_package(PythonInterp REQUIRED)
+
+set(ANTLR_HOME ${ANTLR_DIR})
find_package(ANTLR REQUIRED)
+set(GMP_HOME ${GMP_DIR})
find_package(GMP REQUIRED)
cvc4_link_library(${GMP_LIBRARIES})
include_directories(${GMP_INCLUDE_DIR})
endif()
if(USE_ABC)
+ set(ABC_HOME "${ABC_DIR}")
find_package(ABC REQUIRED)
cvc4_link_library(${ABC_LIBRARIES})
include_directories(${ABC_INCLUDE_DIR})
endif()
if(USE_CADICAL)
+ set(CaDiCaL_HOME ${CADICAL_DIR})
find_package(CaDiCaL REQUIRED)
cvc4_link_library(${CaDiCaL_LIBRARIES})
include_directories(${CaDiCaL_INCLUDE_DIR})
if(THREADS_HAVE_PTHREAD_ARG)
add_c_cxx_flag(-pthread)
endif()
+ set(CryptoMiniSat_HOME ${CRYPTOMINISAT_DIR})
find_package(CryptoMiniSat REQUIRED)
cvc4_link_library(${CryptoMiniSat_LIBRARIES})
include_directories(${CryptoMiniSat_INCLUDE_DIR})
if(USE_GLPK)
set(GPL_LIBS "${GPL_LIBS} glpk")
+ set(GLPK_HOME ${GLPK_DIR})
find_package(GLPK REQUIRED)
cvc4_link_library(${GLPK_LIBRARIES})
include_directories(${GLPK_INCLUDE_DIR})
if(USE_LFSC)
set(RUN_REGRESSION_ARGS ${RUN_REGRESSION_ARGS} --with-lfsc)
+ set(LFSC_HOME ${LFSC_DIR})
find_package(LFSC REQUIRED)
include_directories(${LFSC_INCLUDE_DIR})
add_definitions(-DCVC4_USE_LFSC)
endif()
if(USE_SYMFPU)
+ set(SymFPU_HOME ${SYMFPU_DIR})
find_package(SymFPU REQUIRED)
include_directories(${SymFPU_INCLUDE_DIR})
add_definitions(-DCVC4_USE_SYMFPU)
message("")
message("ABC : ${USE_ABC}")
message("CaDiCaL : ${USE_CADICAL}")
-message("Cryptominisat : ${USE_CRYPTOMINISAT}")
+message("CryptoMiniSat : ${USE_CRYPTOMINISAT}")
message("GLPK : ${USE_GLPK}")
message("LFSC : ${USE_LFSC}")
#message("MP library : ${mplibrary}")
# ABC_LIBRARIES - Libraries needed to use ABC
# ABC_ARCH_FLAGS - Platform specific compile flags
-set(ABC_DEFAULT_HOME "${PROJECT_SOURCE_DIR}/abc/alanmi-abc-53f39c11b58d")
+# Check default location of ABC built with contrib/get-abc.
+if(NOT ABC_HOME)
+ set(ABC_HOME ${PROJECT_SOURCE_DIR}/abc/alanmi-abc-53f39c11b58d)
+endif()
+
+# Note: We don't check the system version since ABC does not provide a default
+# install rule.
find_path(ABC_INCLUDE_DIR
NAMES base/abc/abc.h
- PATHS ${ABC_DEFAULT_HOME}/src)
+ PATHS ${ABC_HOME}/src
+ NO_DEFAULT_PATH)
find_library(ABC_LIBRARIES
NAMES abc
- PATHS ${ABC_DEFAULT_HOME})
+ PATHS ${ABC_HOME}
+ NO_DEFAULT_PATH)
find_program(ABC_ARCH_FLAGS_PROG
NAMES arch_flags
- PATHS ${ABC_DEFAULT_HOME})
+ PATHS ${ABC_HOME}
+ NO_DEFAULT_PATH)
if(ABC_ARCH_FLAGS_PROG)
execute_process(COMMAND ${ABC_ARCH_FLAGS_PROG}
# ANTLR_INCLUDE_DIR - the ANTLR include directory
# ANTLR_LIBRARIES - Libraries needed to use ANTLR
+
+# Check default location of ANTLR built with contrib/get-antlr-3.4.
+# If the user provides a directory we will not search the default paths and
+# fail if ANTLR was not found in the specified directory.
+if(NOT ANTLR_HOME)
+ set(ANTLR_HOME ${PROJECT_SOURCE_DIR}/antlr-3.4)
+ set(CHECK_SYSTEM_VERSION TRUE)
+endif()
+
find_program(ANTLR_BINARY
NAMES antlr3
- PATHS "${PROJECT_SOURCE_DIR}/antlr-3.4/bin"
- )
-
+ PATHS ${ANTLR_HOME}/bin
+ NO_DEFAULT_PATH)
find_path(ANTLR_INCLUDE_DIR
NAMES antlr3.h
- PATHS "${PROJECT_SOURCE_DIR}/antlr-3.4/include"
- )
-
+ PATHS ${ANTLR_HOME}/include
+ NO_DEFAULT_PATH)
find_library(ANTLR_LIBRARIES
- NAMES antlr3c libantlr3c
- PATHS "${PROJECT_SOURCE_DIR}/antlr-3.4/lib"
- )
+ NAMES antlr3c antlr3c-static
+ PATHS ${ANTLR_HOME}/lib
+ NO_DEFAULT_PATH)
+
+if(CHECK_SYSTEM_VERSION)
+ find_program(ANTLR_BINARY NAMES antlr3)
+ find_path(ANTLR_INCLUDE_DIR NAMES antlr3.h)
+ find_library(ANTLR_LIBRARIES NAMES antlr3c)
+endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
# CaDiCaL_INCLUDE_DIR - the CaDiCaL include directory
# CaDiCaL_LIBRARIES - Libraries needed to use CaDiCaL
+
+# Check default location of CaDiCaL built with contrib/get-cadical.
+# If the user provides a directory we will not search the default paths and
+# fail if CaDiCaL was not found in the specified directory.
+if(NOT CaDiCaL_HOME)
+ set(CaDiCaL_HOME ${PROJECT_SOURCE_DIR}/cadical)
+ set(CHECK_SYSTEM_VERSION TRUE)
+endif()
+
find_path(CaDiCaL_INCLUDE_DIR
NAMES cadical.hpp
- PATHS "${PROJECT_SOURCE_DIR}/cadical/src")
+ PATHS ${CaDiCaL_HOME}/src
+ NO_DEFAULT_PATH)
find_library(CaDiCaL_LIBRARIES
NAMES cadical
- PATHS "${PROJECT_SOURCE_DIR}/cadical/build")
+ PATHS ${CaDiCaL_HOME}/build
+ NO_DEFAULT_PATH)
+
+if(CHECK_SYSTEM_VERSION)
+ find_path(CaDiCaL_INCLUDE_DIR NAMES cadical.hpp)
+ find_library(CaDiCaL_LIBRARIES NAMES cadical)
+endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CaDiCaL
# CryptoMiniSat_INCLUDE_DIR - the CryptoMiniSat include directory
# CryptoMiniSat_LIBRARIES - Libraries needed to use CryptoMiniSat
+
+# Check default location of CryptoMiniSat built with contrib/get-cryptominisat.
+# If the user provides a directory we will not search the default paths and
+# fail if CryptoMiniSat was not found in the specified directory.
+if(NOT CryptoMiniSat_HOME)
+ set(CryptoMiniSat_HOME ${PROJECT_SOURCE_DIR}/cryptominisat5/install)
+ set(CHECK_SYSTEM_VERSION TRUE)
+endif()
+
find_path(CryptoMiniSat_INCLUDE_DIR
NAMES cryptominisat5/cryptominisat.h
- PATHS "${PROJECT_SOURCE_DIR}/cryptominisat5/install/include")
+ PATHS ${CryptoMiniSat_HOME}/include
+ NO_DEFAULT_PATH)
find_library(CryptoMiniSat_LIBRARIES
NAMES cryptominisat5
- PATHS "${PROJECT_SOURCE_DIR}/cryptominisat5/install/lib")
+ PATHS ${CryptoMiniSat_HOME}/lib
+ NO_DEFAULT_PATH)
+
+if(CHECK_SYSTEM_VERSION)
+ find_path(CryptoMiniSat_INCLUDE_DIR NAMES cryptominisat5/cryptominisat.h)
+ find_library(CryptoMiniSat_LIBRARIES NAMES cryptominisat5)
+endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CryptoMiniSat
# GLPK_INCLUDE_DIR - the GLPK include directory
# GLPK_LIBRARIES - Libraries needed to use GLPK
-set(GLPK_DEFAULT_HOME ${PROJECT_SOURCE_DIR}/glpk-cut-log)
+
+# Check default location of GLPK built with contrib/get-glpk-cut-log.
+# If the user provides a directory we will not search the default paths and
+# fail if GLPK was not found in the specified directory.
+if(NOT GLPK_HOME)
+ set(GLPK_HOME ${PROJECT_SOURCE_DIR}/glpk-cut-log)
+ set(CHECK_SYSTEM_VERSION TRUE)
+endif()
find_path(GLPK_INCLUDE_DIR
NAMES glpk.h
- PATHS ${GLPK_DEFAULT_HOME}/include
+ PATHS ${GLPK_HOME}/include
NO_DEFAULT_PATH)
find_library(GLPK_LIBRARIES
NAMES glpk
- PATHS ${GLPK_DEFAULT_HOME}/lib
+ PATHS ${GLPK_HOME}/lib
NO_DEFAULT_PATH)
+if(CHECK_SYSTEM_VERSION)
+ find_path(GLPK_INCLUDE_DIR NAMES glpk.h)
+ find_library(GLPK_LIBRARIES NAMES glpk)
+endif()
-# Check if we really have GLPK-cut-log
+# Check if we really have GLPK-cut-log.
if(GLPK_INCLUDE_DIR)
include(CheckSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${GLPK_INCLUDE_DIR})
# GMP_INCLUDE_DIR - the GMP include directory
# GMP_LIBRARIES - Libraries needed to use GMP
-find_path(GMP_INCLUDE_DIR NAMES gmp.h)
-find_library(GMP_LIBRARIES NAMES gmp libgmp)
+
+# 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)
# LFSC_INCLUDE_DIR - the LFSC include directory
# LFSC_LIBRARIES - Libraries needed to use LFSC
+
+# Check default location of LFSC built with contrib/get-lfsc.
+# If the user provides a directory we will not search the default paths and
+# fail if LFSC was not found in the specified directory.
+if(NOT LFSC_HOME)
+ set(LFSC_HOME ${PROJECT_SOURCE_DIR}/lfsc-checker/install)
+ set(CHECK_SYSTEM_VERSION TRUE)
+endif()
+
find_path(LFSC_INCLUDE_DIR
NAMES lfscc.h
- PATHS "${PROJECT_SOURCE_DIR}/lfsc-checker/install/include")
+ PATHS ${LFSC_HOME}/include
+ NO_DEFAULT_PATH)
find_library(LFSC_LIBRARIES
NAMES lfscc
- PATHS "${PROJECT_SOURCE_DIR}/lfsc-checker/install/lib")
+ PATHS ${LFSC_HOME}/lib
+ NO_DEFAULT_PATH)
+
+if(CHECK_SYSTEM_VERSION)
+ find_path(LFSC_INCLUDE_DIR NAMES lfscc.h)
+ find_library(LFSC_LIBRARIES NAMES lfscc)
+endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LFSC
# SymFPU_FOUND - system has SymFPU lib
# SymFPU_INCLUDE_DIR - the SymFPU include directory
+
+# Check default location of SymFPU built with contrib/get-symfpu.
+# If the user provides a directory we will not search the default paths and
+# fail if SymFPU was not found in the specified directory.
+if(NOT SymFPU_HOME)
+ set(SymFPU_HOME ${PROJECT_SOURCE_DIR}/symfpu-CVC4)
+ set(CHECK_SYSTEM_VERSION TRUE)
+endif()
+
find_path(SymFPU_INCLUDE_DIR
NAMES symfpu/core/unpackedFloat.h
- PATHS "${PROJECT_SOURCE_DIR}/symfpu-CVC4")
+ PATHS ${SymFPU_HOME}
+ NO_DEFAULT_PATH)
+
+if(CHECK_SYSTEM_VERSION)
+ find_path(SymFPU_INCLUDE_DIR NAMES symfpu/core/unpackedFloat.h)
+endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SymFPU DEFAULT_MSG SymFPU_INCLUDE_DIR)