@@ -38,6 +38,10 @@ set(booleforce_source
3838set (minibdd_source
3939 ${CMAKE_CURRENT_SOURCE_DIR} /bdd/miniBDD/example.cpp
4040)
41+ set (ipasir_source
42+ ${CMAKE_CURRENT_SOURCE_DIR} /sat/satcheck_ipasir.cpp
43+ )
44+
4145
4246file (GLOB_RECURSE sources "*.cpp" "*.h" )
4347list (REMOVE_ITEM sources
@@ -51,6 +55,7 @@ list(REMOVE_ITEM sources
5155 ${lingeling_source}
5256 ${booleforce_source}
5357 ${minibdd_source}
58+ # ${ipasir_source}
5459)
5560
5661add_library (solvers ${sources} )
@@ -128,6 +133,65 @@ elseif("${sat_impl}" STREQUAL "cadical")
128133 )
129134
130135 target_link_libraries (solvers cadical)
136+ elseif ("${sat_impl} " STREQUAL "ipasir-cadical" )
137+ message (STATUS "Building with IPASIR solver linking against: CaDiCaL" )
138+
139+ download_project(PROJ cadical
140+ URL https://github.com/arminbiere/cadical/archive/rel-1.4.0.tar.gz
141+ PATCH_COMMAND true
142+ COMMAND ./configure CXX=g++
143+ URL_MD5 9bad586a82995a1d95d1197d445a353a
144+ )
145+
146+ message (STATUS "Building CaDiCaL" )
147+ execute_process (COMMAND make WORKING_DIRECTORY ${cadical_SOURCE_DIR} )
148+
149+ target_compile_definitions (solvers PUBLIC
150+ SATCHECK_IPASIR HAVE_IPASIR IPASIR=${cadical_SOURCE_DIR} /src
151+ )
152+
153+ add_library (cadical_ipasir STATIC IMPORTED )
154+ set_property (TARGET cadical_ipasir
155+ PROPERTY IMPORTED_LOCATION ${cadical_SOURCE_DIR} /build /libcadical.a
156+ )
157+
158+ target_include_directories (solvers
159+ PUBLIC
160+ ${cadical_SOURCE_DIR} /src
161+ )
162+ target_link_libraries (solvers cadical_ipasir)
163+ elseif ("${sat_impl} " STREQUAL "ipasir-custom" )
164+ message (STATUS "Building with IPASIR solver linking: custom solver provided" )
165+
166+ if (NOT DEFINED IPASIR)
167+ message (FATAL_ERROR
168+ "IPASIR solver source code not provided. Please use -DIPASIR=<location> "
169+ "with <location> being the path to the IPASIR solver source code."
170+ )
171+ endif ()
172+
173+ if (NOT DEFINED IPASIR_LIB)
174+ message (FATAL_ERROR
175+ "IPASIR solver library not provided. Please use -DIPASIR_LIB=<location> "
176+ "with <location> being the path to the IPASIR solver precompiled static "
177+ "library."
178+ )
179+ endif ()
180+
181+ target_compile_definitions (solvers PUBLIC
182+ SATCHECK_IPASIR HAVE_IPASIR IPASIR=${IPASIR}
183+ )
184+
185+ add_library (ipasir_custom STATIC IMPORTED )
186+ set_property (TARGET ipasir_custom
187+ PROPERTY IMPORTED_LOCATION ${IPASIR_LIB}
188+ )
189+
190+ target_include_directories (solvers
191+ PUBLIC
192+ ${IPASIR}
193+ )
194+ target_link_libraries (solvers ipasir_custom pthread)
131195endif ()
132196
133197if (CMAKE_USE_CUDD)
0 commit comments