From 1b3a3711186ea35c16eb9d22f164e585206192f8 Mon Sep 17 00:00:00 2001 From: Christoph Jabs Date: Tue, 26 Mar 2024 10:28:19 +0200 Subject: [PATCH] feat: `quiet` feature to disable stdout printing --- glucose/Cargo.toml | 2 ++ glucose/README.md | 1 + glucose/build.rs | 9 +++++---- glucose/src/lib.rs | 1 + minisat/Cargo.toml | 2 ++ minisat/README.md | 1 + minisat/build.rs | 9 +++++---- minisat/src/lib.rs | 1 + 8 files changed, 18 insertions(+), 8 deletions(-) diff --git a/glucose/Cargo.toml b/glucose/Cargo.toml index 25f4a3c2..81ba2383 100644 --- a/glucose/Cargo.toml +++ b/glucose/Cargo.toml @@ -15,6 +15,8 @@ build = "build.rs" [features] debug = [] +quiet = [] +default = ["quiet"] [dependencies] cpu-time = "1.0.0" diff --git a/glucose/README.md b/glucose/README.md index f9a12a29..422b8eef 100644 --- a/glucose/README.md +++ b/glucose/README.md @@ -12,6 +12,7 @@ The Glucose SAT solver to be used with the [RustSAT](https://github.com/chrjabs/ ## Features - `debug`: if this feature is enables, the C++ library will be built with debug and check functionality if the Rust project is built in debug mode +- `quiet`: disable all glucose-internal printing to stdout during solving (on by default) ## Glucose Version diff --git a/glucose/build.rs b/glucose/build.rs index 658ab9db..7c184512 100644 --- a/glucose/build.rs +++ b/glucose/build.rs @@ -11,7 +11,7 @@ fn main() { build( "https://github.com/chrjabs/glucose4.git", "main", - "7446ea43cd7b0beb8778de00fc373849983ad067", + "2c41a6d2e9c8db7b5bdebc8dc65760d01bc938e9", ); let out_dir = env::var("OUT_DIR").unwrap(); @@ -35,9 +35,10 @@ fn build(repo: &str, branch: &str, commit: &str) { let mut conf = cmake::Config::new(glucose_dir); conf.define("BUILD_SYRUP", "OFF") .define("BUILD_EXECUTABLES", "OFF"); - if cfg!(not(feature = "debug")) { - conf.profile("Release"); - } + #[cfg(feature = "quiet")] + conf.define("QUIET", "ON"); + #[cfg(not(feature = "debug"))] + conf.profile("Release"); conf.build(); }; diff --git a/glucose/src/lib.rs b/glucose/src/lib.rs index d28e37b1..4f1f0efa 100644 --- a/glucose/src/lib.rs +++ b/glucose/src/lib.rs @@ -5,6 +5,7 @@ //! ## Features //! //! - `debug`: if this feature is enables, the C++ library will be built with debug and check functionality if the Rust project is built in debug mode +//! - `quiet`: disable all glucose-internal printing to stdout during solving (on by default) //! //! ## Glucose Version //! diff --git a/minisat/Cargo.toml b/minisat/Cargo.toml index e9ffbc09..a47f3eec 100644 --- a/minisat/Cargo.toml +++ b/minisat/Cargo.toml @@ -15,6 +15,8 @@ build = "build.rs" [features] debug = [] +quiet = [] +default = ["quiet"] [dependencies] cpu-time = "1.0.0" diff --git a/minisat/README.md b/minisat/README.md index f4c76548..a15f53a7 100644 --- a/minisat/README.md +++ b/minisat/README.md @@ -12,6 +12,7 @@ The Minisat SAT solver to be used with the [RustSAT](https://github.com/chrjabs/ ## Features - `debug`: if this feature is enables, the C++ library will be built with debug and check functionality if the Rust project is built in debug mode +- `quiet`: disable all glucose-internal printing to stdout during solving (on by default) ## Minisat Version diff --git a/minisat/build.rs b/minisat/build.rs index 59e9ca44..35778969 100644 --- a/minisat/build.rs +++ b/minisat/build.rs @@ -11,7 +11,7 @@ fn main() { build( "https://github.com/chrjabs/minisat.git", "master", - "809d350ff282e695014e96a2afd3625196f58dff", + "8237c54e97272d16531e785dd8031c27c2360904", ); let out_dir = env::var("OUT_DIR").unwrap(); @@ -34,9 +34,10 @@ fn build(repo: &str, branch: &str, commit: &str) { { let mut conf = cmake::Config::new(minisat_dir); conf.define("BUILD_BINARIES", "OFF"); - if cfg!(not(feature = "debug")) { - conf.profile("Release"); - } + #[cfg(feature = "quiet")] + conf.define("QUIET", "ON"); + #[cfg(not(feature = "debug"))] + conf.profile("Release"); conf.build(); }; diff --git a/minisat/src/lib.rs b/minisat/src/lib.rs index 5c738443..a7d1a679 100644 --- a/minisat/src/lib.rs +++ b/minisat/src/lib.rs @@ -5,6 +5,7 @@ //! ## Features //! //! - `debug`: if this feature is enables, the C++ library will be built with debug and check functionality if the Rust project is built in debug mode +//! - `quiet`: disable all glucose-internal printing to stdout during solving (on by default) //! //! ## Minisat Version //!