Skip to content

Commit b1fb769

Browse files
committed
Include cadical in some CI workflows
1 parent 60c9ef9 commit b1fb769

File tree

7 files changed

+81
-10
lines changed

7 files changed

+81
-10
lines changed

.github/workflows/pull-request-checks.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
run: |
9393
sudo apt-get update
9494
sudo apt-get install --no-install-recommends -yq clang-10 clang++-10 gdb maven jq flex bison libxml2-utils cpanminus ccache z3
95-
make -C src minisat2-download
95+
make -C src minisat2-download cadical-download
9696
cpanm Thread::Pool::Simple
9797
- name: Confirm z3 solver is available and log the version installed
9898
run: z3 --version
@@ -118,7 +118,7 @@ jobs:
118118
run: ccache -z --max-size=500M
119119
- name: Build with make
120120
run: |
121-
make -C src -j2
121+
make -C src -j2 MINISAT2=../../minisat-2.2.1 CADICAL=../../cadical
122122
make -C unit -j2
123123
make -C jbmc/src -j2
124124
make -C jbmc/unit -j2
@@ -223,7 +223,7 @@ jobs:
223223
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV
224224
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
225225
- name: Configure using CMake
226-
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
226+
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -Dsat_impl="minisat2;cadical"
227227
- name: Check that doc task works
228228
run: ninja -C build doc
229229
- name: Zero ccache stats and limit in size
@@ -260,7 +260,7 @@ jobs:
260260
run: |
261261
sudo apt-get update
262262
sudo apt-get install --no-install-recommends -yq clang clang-14 gdb maven jq flex bison libxml2-utils cpanminus ccache z3
263-
make -C src minisat2-download
263+
make -C src minisat2-download cadical-download
264264
cpanm Thread::Pool::Simple
265265
- name: Confirm z3 solver is available and log the version installed
266266
run: z3 --version
@@ -290,7 +290,7 @@ jobs:
290290
make -C src/cpp library_check
291291
- name: Build with make
292292
run: |
293-
make -C src -j2
293+
make -C src -j2 MINISAT2=../../minisat-2.2.1 CADICAL=../../cadical
294294
make -C unit -j2
295295
make -C jbmc/src -j2
296296
make -C jbmc/unit -j2
@@ -348,7 +348,7 @@ jobs:
348348
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV
349349
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
350350
- name: Configure using CMake
351-
run: cmake -S . -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
351+
run: cmake -S . -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -Dsat_impl="minisat2;cadical"
352352
- name: Check that doc task works
353353
run: ninja -C build doc
354354
- name: Zero ccache stats and limit in size
@@ -439,7 +439,7 @@ jobs:
439439
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV
440440
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
441441
- name: Configure using CMake
442-
run: cmake -H. -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
442+
run: cmake -H. -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -Dsat_impl="minisat2;cadical"
443443
- name: Zero ccache stats and limit in size
444444
run: ccache -z --max-size=500M
445445
- name: Build with Ninja
@@ -482,8 +482,8 @@ jobs:
482482
run: ccache -z --max-size=500M
483483
- name: Build using Make
484484
run: |
485-
make -C src minisat2-download
486-
make -C src -j3 CXX="ccache clang++"
485+
make -C src minisat2-download cadical-download
486+
make -C src -j3 CXX="ccache clang++" MINISAT2=../../minisat-2.2.1 CADICAL=../../cadical
487487
make -C jbmc/src -j3 CXX="ccache clang++"
488488
make -C unit "CXX=ccache clang++"
489489
make -C jbmc/unit "CXX=ccache clang++"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jbmc/regression/**/tests-symex-driven-loading.log
7474

7575
# libs downloaded by make [name]-download
7676
minisat*/
77+
cadical*/
7778
glucose-syrup/
7879

7980
# flex/bison generated files

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
1010
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
1111
apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y \
1212
cmake \
13+
make \
1314
ninja-build \
1415
gcc \
1516
g++ \

scripts/cadical-1.4.1-patch

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
diff --git a/scripts/make-build-header.sh b/scripts/make-build-header.sh
2+
index e8f6746..1290024 100755
3+
--- a/scripts/make-build-header.sh
4+
+++ b/scripts/make-build-header.sh
5+
@@ -20,7 +20,7 @@ warning () {
6+
7+
#--------------------------------------------------------------------------#
8+
9+
-[ ! -f VERSION -a ! -f ../VERSION ] && \
10+
+[ ! -f VERSION.txt -a ! -f ../VERSION.txt ] && \
11+
die "needs to be called from build sub-directory"
12+
13+
[ -f makefile ] || \
14+
@@ -29,7 +29,7 @@ warning "could not find 'makefile'"
15+
#--------------------------------------------------------------------------#
16+
# The version.
17+
#
18+
-VERSION="`cat ../VERSION`"
19+
+VERSION="`cat ../VERSION.txt`"
20+
if [ x"$VERSION" = x ]
21+
then
22+
warning "could not determine 'VERSION'"
23+
diff --git a/src/lookahead.cpp b/src/lookahead.cpp
24+
index 9e8a16b..3d5721a 100644
25+
--- a/src/lookahead.cpp
26+
+++ b/src/lookahead.cpp
27+
@@ -390,6 +390,7 @@ int Internal::lookahead_probing() {
28+
CubesWithStatus Internal::generate_cubes(int depth, int min_depth) {
29+
if (!active() || depth == 0) {
30+
CubesWithStatus cubes;
31+
+ cubes.status = 0;
32+
cubes.cubes.push_back(std::vector<int>());
33+
return cubes;
34+
}

scripts/cadical_CMakeLists.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
file(GLOB sources "src/*.cpp" "src/*.hpp" "src/*.h")
2+
# Remove "app" sources from list
3+
list(REMOVE_ITEM sources
4+
"${CMAKE_CURRENT_SOURCE_DIR}/src/cadical.cpp"
5+
"${CMAKE_CURRENT_SOURCE_DIR}/src/mobical.cpp"
6+
)
7+
8+
add_library(cadical ${sources})
9+
10+
# Pass -DNBUILD to disable including the version information, which is not
11+
# needed since cbmc doesn't run the cadical binary
12+
target_compile_options(cadical PUBLIC -DNBUILD)
13+
14+
set_target_properties(
15+
cadical
16+
PROPERTIES
17+
CXX_STANDARD 11
18+
CXX_STANDARD_REQUIRED true
19+
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Developer ID Application: Daniel Kroening"
20+
)
21+
22+
target_include_directories(cadical
23+
PUBLIC
24+
${CMAKE_CURRENT_SOURCE_DIR}/src
25+
)
26+
27+
target_link_libraries(cadical util)

src/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,11 @@ cadical-download:
177177
@$(TAR) xfz $(cadical_release).tar.gz
178178
@rm -Rf ../cadical
179179
@mv cadical-$(cadical_release) ../cadical
180-
@cd ../cadical && CXX=$(CXX) ./configure -O3 -s && make -j
180+
@(cd ../cadical; patch -p1 < ../scripts/cadical-1.4.1-patch)
181+
@(cd ../cadical && ./configure)
182+
# Need to rename VERSION so that it isn't picked up by `#include<version>` on
183+
# macOS which is case insensitive
184+
@(cd ../cadical && mv VERSION VERSION.txt)
181185
@$(RM) $(cadical_release).tar.gz
182186

183187
doc :

src/solvers/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ ifneq ($(CADICAL),)
6666
CADICAL_INCLUDE=-I $(CADICAL)/src
6767
CADICAL_LIB=$(CADICAL)/build/libcadical$(LIBEXT)
6868
CP_CXXFLAGS += -DHAVE_CADICAL
69+
CLEANFILES += $(CADICAL_LIB) $(patsubst %$(OBJEXT), %$(DEPEXT), $(CADICAL_LIB))
6970
endif
7071

7172
SRC = $(BOOLEFORCE_SRC) \
@@ -275,6 +276,9 @@ endif
275276
solvers$(LIBEXT): $(OBJ) $(SOLVER_LIB)
276277
$(LINKLIB)
277278

279+
../../cadical/build/libcadical$(LIBEXT):
280+
$(MAKE) $(MAKEARGS) -C $(CADICAL)/build libcadical.a CXX="$(CXX)" CXXFLAGS="$(CP_CXXFLAGS)"
281+
278282
-include smt2/smt2_solver$(DEPEXT)
279283

280284
smt2_solver$(EXEEXT): $(OBJ) smt2/smt2_solver$(OBJEXT) \

0 commit comments

Comments
 (0)