Skip to content

Commit

Permalink
feat(cadical): version 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Dec 20, 2024
1 parent 9c10a6d commit 1fc4d19
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 2 deletions.
1 change: 1 addition & 0 deletions cadical/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ v1-9-4 = []
v1-9-5 = []
v2-0-0 = []
v2-1-0 = []
v2-1-1 = []

[dependencies]
anyhow.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions cadical/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ if [ "$1" == "--clean" ]; then cargo clean -p rustsat-cadical > /dev/null; fi
cargo build --features=v2-1-0 &> v210-build.log
echo "v2.1.0 build returned: $?"

echo "Building v2.1.1"
if [ "$1" == "--clean" ]; then cargo clean -p rustsat-cadical > /dev/null; fi
cargo build --features=v2-1-1 &> v211-build.log
echo "v2.1.1 build returned: $?"

echo "Building quiet"
if [ "$1" == "--clean" ]; then cargo clean -p rustsat-cadical > /dev/null; fi
cargo build --features=quiet &> quiet-build.log
Expand Down
12 changes: 10 additions & 2 deletions cadical/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ enum Version {
V194,
V195,
V200,
#[default]
V210,
#[default]
V211,
}

impl Version {
fn determine() -> Self {
if cfg!(feature = "v2-1-0") {
if cfg!(feature = "v2-1-1") {
Version::V211
} else if cfg!(feature = "v2-1-0") {
Version::V210
} else if cfg!(feature = "v2-0-0") {
Version::V200
Expand Down Expand Up @@ -119,6 +122,7 @@ impl Version {
Version::V195 => "refs/tags/rel-1.9.5",
Version::V200 => "refs/tags/rel-2.0.0",
Version::V210 => "refs/tags/rel-2.1.0",
Version::V211 => "refs/tags/rel-2.1.1",
}
}

Expand All @@ -137,6 +141,7 @@ impl Version {
V192 | V193 | V194 | V195 => "v192.patch",
V200 => "v200.patch",
V210 => "v210.patch",
V211 => "v211.patch",
}
}

Expand Down Expand Up @@ -291,6 +296,9 @@ fn build(repo: &str, branch: &str, version: Version) {
cadical_build.define("QUIET", None); // --quiet
#[cfg(feature = "logging")]
cadical_build.define("LOGGING", None); // --log
if version >= Version::V211 && cfg!(target_os = "macos") {
cadical_build.define("NCLOSEFROM", None);
}
if version.has_flip() {
cadical_build.define("FLIP", None);
}
Expand Down
61 changes: 61 additions & 0 deletions cadical/patches/v211.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
From 6e1eb0668de5680d9b3dfe0064026b75e7673895 Mon Sep 17 00:00:00 2001
From: Christoph Jabs <[email protected]>
Date: Fri, 20 Dec 2024 15:21:11 +0200
Subject: [PATCH] extend C api

---
src/cadical.hpp | 2 ++
src/ccadical.cpp | 2 ++
src/ccadical.h | 2 ++
src/solver.cpp | 2 ++
4 files changed, 8 insertions(+)

diff --git a/src/cadical.hpp b/src/cadical.hpp
index 44c3107..8141a4c 100644
--- a/src/cadical.hpp
+++ b/src/cadical.hpp
@@ -922,6 +922,8 @@ public:
//
static void build (FILE *file, const char *prefix = "c ");

+#include "cadical_extension.hpp"
+
private:
//==== start of state ====================================================

diff --git a/src/ccadical.cpp b/src/ccadical.cpp
index 88ab164..8186054 100644
--- a/src/ccadical.cpp
+++ b/src/ccadical.cpp
@@ -186,3 +186,5 @@ void ccadical_conclude (CCaDiCaL *ptr) {
((Wrapper *) ptr)->solver->conclude ();
}
}
+
+#include "ccadical_extension.cpp"
diff --git a/src/ccadical.h b/src/ccadical.h
index 6d1b3ff..a8f1b48 100644
--- a/src/ccadical.h
+++ b/src/ccadical.h
@@ -60,6 +60,8 @@ int ccadical_simplify (CCaDiCaL *);
#define ccadical_sat ccadical_solve
#define ccadical_deref ccadical_val

+#include "ccadical_extension.h"
+
/*------------------------------------------------------------------------*/
#ifdef __cplusplus
}
diff --git a/src/solver.cpp b/src/solver.cpp
index 67c7b08..8a2d725 100644
--- a/src/solver.cpp
+++ b/src/solver.cpp
@@ -1707,3 +1707,5 @@ void Solver::error (const char *fmt, ...) {
}

} // namespace CaDiCaL
+
+#include "solver_extension.cpp"
--
2.46.1

5 changes: 5 additions & 0 deletions cadical/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ if [ "$1" == "--clean" ]; then cargo clean -p rustsat-cadical > /dev/null; fi
cargo test --features=v2-1-0 &> v210-test.log
echo "v2.1.0 test returned: $?"

echo "Testing v2.1.1"
if [ "$1" == "--clean" ]; then cargo clean -p rustsat-cadical > /dev/null; fi
cargo test --features=v2-1-1 &> v211-test.log
echo "v2.1.1 test returned: $?"

echo "Testing quiet"
if [ "$1" == "--clean" ]; then cargo clean -p rustsat-cadical > /dev/null; fi
cargo test --features=quiet &> quiet-test.log
Expand Down

0 comments on commit 1fc4d19

Please sign in to comment.