1 ###############################################################################
2 # Top contributors (to current version):
3 # Gereon Kremer, Mathias Preiner
5 # This file is part of the cvc5 project.
7 # Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8 # in the top-level source directory and their institutional affiliations.
9 # All rights reserved. See the file COPYING in the top-level source
10 # directory for licensing information.
11 # #############################################################################
14 # CryptoMiniSat_FOUND - system has CryptoMiniSat lib
15 # CryptoMiniSat_INCLUDE_DIR - the CryptoMiniSat include directory
16 # CryptoMiniSat_LIBRARIES - Libraries needed to use CryptoMiniSat
21 find_package(cryptominisat5 ${CryptoMiniSat_FIND_VERSION} QUIET)
23 set(CryptoMiniSat_FOUND_SYSTEM FALSE)
24 if(cryptominisat5_FOUND)
25 set(CryptoMiniSat_VERSION ${cryptominisat5_VERSION})
26 set(CryptoMiniSat_FOUND_SYSTEM TRUE)
27 add_library(CryptoMiniSat INTERFACE IMPORTED GLOBAL)
28 target_link_libraries(CryptoMiniSat INTERFACE cryptominisat5)
29 # TODO(gereon): remove this when
30 # https://github.com/msoos/cryptominisat/pull/645 is merged
31 set_target_properties(
32 CryptoMiniSat PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
33 "${CRYPTOMINISAT5_INCLUDE_DIRS}"
37 if(NOT CryptoMiniSat_FOUND_SYSTEM)
38 set(CryptoMiniSat_VERSION "5.8.0")
40 check_ep_downloaded("CryptoMiniSat-EP")
41 if(NOT CryptoMiniSat-EP_DOWNLOADED)
42 check_auto_download("CryptoMiniSat" "--no-cryptominisat")
45 include(ExternalProject)
47 if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
48 set(LIBFILENAME "libcryptominisat5win")
50 set(LIBFILENAME "libcryptominisat5")
56 URL https://github.com/msoos/cryptominisat/archive/refs/tags/${CryptoMiniSat_VERSION}.tar.gz
57 URL_HASH SHA1=f79dfa1ffc6c9c75b3a33f76d3a89a3df2b3f4c2
59 patch <SOURCE_DIR>/src/packedmatrix.h
60 ${CMAKE_CURRENT_LIST_DIR}/deps-utils/CryptoMiniSat-patch-ba6f76e3.patch
61 CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
62 # make sure not to register with cmake
63 -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON
64 -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
65 -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
66 -DENABLE_ASSERTIONS=OFF
67 -DENABLE_PYTHON_INTERFACE=OFF
68 # disable what is not needed
75 BUILD_BYPRODUCTS <INSTALL_DIR>/${CMAKE_INSTALL_LIBDIR}/libcryptominisat5.a
77 # remove unused stuff to keep folder small
78 ExternalProject_Add_Step(
79 CryptoMiniSat-EP cleanup
81 COMMAND ${CMAKE_COMMAND} -E remove <BINARY_DIR>/cryptominisat5_simple
82 COMMAND ${CMAKE_COMMAND} -E remove <INSTALL_DIR>/bin/cryptominisat5_simple
85 set(CryptoMiniSat_INCLUDE_DIR "${DEPS_BASE}/include/")
86 set(CryptoMiniSat_LIBRARIES "${DEPS_BASE}/${CMAKE_INSTALL_LIBDIR}/${LIBFILENAME}.a")
88 add_library(CryptoMiniSat STATIC IMPORTED GLOBAL)
89 set_target_properties(
90 CryptoMiniSat PROPERTIES IMPORTED_LOCATION "${CryptoMiniSat_LIBRARIES}"
92 set_target_properties(
93 CryptoMiniSat PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
94 "${CryptoMiniSat_INCLUDE_DIR}"
98 set(CryptoMiniSat_FOUND TRUE)
100 mark_as_advanced(CryptoMiniSat_FOUND)
101 mark_as_advanced(CryptoMiniSat_FOUND_SYSTEM)
102 mark_as_advanced(CryptoMiniSat_INCLUDE_DIR)
103 mark_as_advanced(CryptoMiniSat_LIBRARIES)
105 if(CryptoMiniSat_FOUND_SYSTEM)
108 "Found CryptoMiniSat ${CryptoMiniSat_VERSION}: ${CryptoMiniSat_LIBRARIES}"
113 "Building CryptoMiniSat ${CryptoMiniSat_VERSION}: ${CryptoMiniSat_LIBRARIES}"
115 add_dependencies(CryptoMiniSat CryptoMiniSat-EP)