Skip to content

Commit

Permalink
feat: quiet feature to disable stdout printing
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Mar 26, 2024
1 parent da39d71 commit ff0eda0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
2 changes: 2 additions & 0 deletions glucose/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ build = "build.rs"

[features]
debug = []
quiet = []
default = ["quiet"]

[dependencies]
cpu-time = "1.0.0"
Expand Down
1 change: 1 addition & 0 deletions glucose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 5 additions & 4 deletions glucose/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn main() {
build(
"https://github.com/chrjabs/glucose4.git",
"main",
"7446ea43cd7b0beb8778de00fc373849983ad067",
"2c41a6d2e9c8db7b5bdebc8dc65760d01bc938e9",
);

let out_dir = env::var("OUT_DIR").unwrap();
Expand All @@ -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();
};

Expand Down
1 change: 1 addition & 0 deletions glucose/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
//!
Expand Down
2 changes: 2 additions & 0 deletions minisat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ build = "build.rs"

[features]
debug = []
quiet = []
default = ["quiet"]

[dependencies]
cpu-time = "1.0.0"
Expand Down
9 changes: 5 additions & 4 deletions minisat/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn main() {
build(
"https://github.com/chrjabs/minisat.git",
"master",
"809d350ff282e695014e96a2afd3625196f58dff",
"8237c54e97272d16531e785dd8031c27c2360904",
);

let out_dir = env::var("OUT_DIR").unwrap();
Expand All @@ -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();
};

Expand Down
1 change: 1 addition & 0 deletions minisat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
//!
Expand Down

0 comments on commit ff0eda0

Please sign in to comment.