-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
415 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "crates/pindakaas-cadical/vendor/cadical"] | ||
path = crates/pindakaas-cadical/vendor/cadical | ||
url = https://github.com/arminbiere/cadical.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "pindakaas-build-macros" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#[macro_export] | ||
macro_rules! ipasir_definitions { | ||
() => { | ||
extern "C" { | ||
pub fn ipasir_signature() -> *const std::ffi::c_char; | ||
pub fn ipasir_init() -> *mut std::ffi::c_void; | ||
pub fn ipasir_release(slv: *mut std::ffi::c_void); | ||
pub fn ipasir_add(slv: *mut std::ffi::c_void, lit: i32); | ||
pub fn ipasir_assume(slv: *mut std::ffi::c_void, lit: i32); | ||
pub fn ipasir_solve(slv: *mut std::ffi::c_void) -> std::ffi::c_int; | ||
pub fn ipasir_val(slv: *mut std::ffi::c_void, lit: i32) -> i32; | ||
pub fn ipasir_failed(slv: *mut std::ffi::c_void, lit: i32) -> std::ffi::c_int; | ||
pub fn ipasir_set_terminate( | ||
slv: *mut std::ffi::c_void, | ||
data: *mut std::ffi::c_void, | ||
cb: Option<unsafe extern "C" fn(*mut std::ffi::c_void) -> std::ffi::c_int>, | ||
); | ||
pub fn ipasir_set_learn( | ||
ptr: *mut std::ffi::c_void, | ||
data: *mut std::ffi::c_void, | ||
max_len: std::ffi::c_int, | ||
cb: Option<unsafe extern "C" fn(*mut std::ffi::c_void, *const i32)>, | ||
); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "pindakaas-cadical" | ||
version = "0.1.0" | ||
edition = "2021" | ||
build = "build.rs" | ||
links = "cadical" | ||
exclude = ["vendor/cadical"] | ||
include = ["vendor/cadical/src/*.cpp"] | ||
|
||
publish = false | ||
|
||
[build-dependencies] | ||
cc = { version = "1.0", features = ["parallel"] } | ||
|
||
[dependencies] | ||
pindakaas-build-macros = { path = "../pindakaas-build-macros" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
fn main() { | ||
let src = [ | ||
"vendor/cadical/src/analyze.cpp", | ||
"vendor/cadical/src/arena.cpp", | ||
"vendor/cadical/src/assume.cpp", | ||
"vendor/cadical/src/averages.cpp", | ||
"vendor/cadical/src/backtrack.cpp", | ||
"vendor/cadical/src/backward.cpp", | ||
"vendor/cadical/src/bins.cpp", | ||
"vendor/cadical/src/block.cpp", | ||
"vendor/cadical/src/cadical.cpp", | ||
"vendor/cadical/src/ccadical.cpp", | ||
"vendor/cadical/src/checker.cpp", | ||
"vendor/cadical/src/clause.cpp", | ||
"vendor/cadical/src/collect.cpp", | ||
"vendor/cadical/src/compact.cpp", | ||
"vendor/cadical/src/condition.cpp", | ||
"vendor/cadical/src/config.cpp", | ||
"vendor/cadical/src/constrain.cpp", | ||
"vendor/cadical/src/contract.cpp", | ||
"vendor/cadical/src/cover.cpp", | ||
"vendor/cadical/src/cover.hpp", | ||
"vendor/cadical/src/decide.cpp", | ||
"vendor/cadical/src/decompose.cpp", | ||
"vendor/cadical/src/deduplicate.cpp", | ||
"vendor/cadical/src/elim.cpp", | ||
"vendor/cadical/src/ema.cpp", | ||
"vendor/cadical/src/extend.cpp", | ||
"vendor/cadical/src/external.cpp", | ||
"vendor/cadical/src/external_propagate.cpp", | ||
"vendor/cadical/src/file.cpp", | ||
"vendor/cadical/src/flags.cpp", | ||
"vendor/cadical/src/flip.cpp", | ||
"vendor/cadical/src/format.cpp", | ||
"vendor/cadical/src/gates.cpp", | ||
"vendor/cadical/src/instantiate.cpp", | ||
"vendor/cadical/src/internal.cpp", | ||
"vendor/cadical/src/ipasir.cpp", | ||
"vendor/cadical/src/limit.cpp", | ||
"vendor/cadical/src/logging.cpp", | ||
"vendor/cadical/src/lookahead.cpp", | ||
"vendor/cadical/src/lratbuilder.cpp", | ||
"vendor/cadical/src/lratchecker.cpp", | ||
"vendor/cadical/src/lucky.cpp", | ||
"vendor/cadical/src/message.cpp", | ||
"vendor/cadical/src/minimize.cpp", | ||
"vendor/cadical/src/mobical.cpp", | ||
"vendor/cadical/src/occs.cpp", | ||
"vendor/cadical/src/options.cpp", | ||
"vendor/cadical/src/parse.cpp", | ||
"vendor/cadical/src/phases.cpp", | ||
"vendor/cadical/src/probe.cpp", | ||
"vendor/cadical/src/profile.cpp", | ||
"vendor/cadical/src/proof.cpp", | ||
"vendor/cadical/src/propagate.cpp", | ||
"vendor/cadical/src/queue.cpp", | ||
"vendor/cadical/src/random.cpp", | ||
"vendor/cadical/src/reap.cpp", | ||
"vendor/cadical/src/reduce.cpp", | ||
"vendor/cadical/src/rephase.cpp", | ||
"vendor/cadical/src/report.cpp", | ||
"vendor/cadical/src/resources.cpp", | ||
"vendor/cadical/src/restart.cpp", | ||
"vendor/cadical/src/restore.cpp", | ||
"vendor/cadical/src/score.cpp", | ||
"vendor/cadical/src/shrink.cpp", | ||
"vendor/cadical/src/signal.cpp", | ||
"vendor/cadical/src/solution.cpp", | ||
"vendor/cadical/src/solver.cpp", | ||
"vendor/cadical/src/stats.cpp", | ||
"vendor/cadical/src/subsume.cpp", | ||
"vendor/cadical/src/terminal.cpp", | ||
"vendor/cadical/src/ternary.cpp", | ||
"vendor/cadical/src/tracer.cpp", | ||
"vendor/cadical/src/transred.cpp", | ||
"vendor/cadical/src/util.cpp", | ||
"vendor/cadical/src/var.cpp", | ||
"vendor/cadical/src/version.cpp", | ||
"vendor/cadical/src/vivify.cpp", | ||
"vendor/cadical/src/walk.cpp", | ||
"vendor/cadical/src/watch.cpp", | ||
]; | ||
|
||
let mut builder = cc::Build::new(); | ||
let build = builder | ||
.cpp(true) | ||
.flag_if_supported("-std=c++11") | ||
.define("NBUILD", None) | ||
.define("NUNLOCKED", None) | ||
.define("NTRACING", None) | ||
.define("QUIET", None); | ||
|
||
build.files(src); | ||
|
||
build.compile("cadical"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::ffi::{c_char, c_int, c_void}; | ||
|
||
use pindakaas_build_macros::ipasir_definitions; | ||
|
||
// Standard IPASIR definitions | ||
ipasir_definitions!(); | ||
|
||
// Additional C-API functions in CaDiCaL | ||
extern "C" { | ||
pub fn ccadical_constrain(slv: *mut c_void, lit: i32); | ||
pub fn ccadical_constraint_failed(slv: *mut c_void) -> c_int; | ||
pub fn ccadical_set_option(slv: *mut c_void, name: *const c_char, val: c_int); | ||
pub fn ccadical_limit(slv: *mut c_void, name: *const c_char, limit: c_int); | ||
pub fn ccadical_get_option(slv: *mut c_void, name: *const c_char) -> c_int; | ||
pub fn ccadical_print_statistics(slv: *mut c_void); | ||
pub fn ccadical_active(slv: *mut c_void) -> i64; | ||
pub fn ccadical_irredundant(slv: *mut c_void) -> i64; | ||
pub fn ccadical_fixed(slv: *mut c_void, lit: i32) -> c_int; | ||
pub fn ccadical_terminate(slv: *mut c_void); | ||
pub fn ccadical_freeze(slv: *mut c_void, lit: i32); | ||
pub fn ccadical_frozen(slv: *mut c_void, lit: i32) -> c_int; | ||
pub fn ccadical_melt(slv: *mut c_void, lit: i32); | ||
pub fn ccadical_simplify(slv: *mut c_void) -> c_int; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.