From 3527305807fc075fe70586ee91aaf243b4df1fc6 Mon Sep 17 00:00:00 2001 From: Kaiyotech <93724202+Kaiyotech@users.noreply.github.com> Date: Sat, 2 Dec 2023 16:09:28 -0500 Subject: [PATCH] added environment variable RSIM_SILENT_DEBUG to suppress rocketsim output even in debug mode (#9) --- build.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 66d2007..43e439a 100644 --- a/build.rs +++ b/build.rs @@ -3,13 +3,18 @@ use glob::glob; use miette::{IntoDiagnostic, Result}; fn main() -> Result<()> { + println!("cargo:rerun-if-env-changed=RSIM_SILENT_DEBUG"); let mut builder = Builder::new("src/lib.rs", ["RocketSim/src/", "arenar/"]) .extra_clang_args(&["-std=c++20"]) .build()?; - if !cfg!(debug_assertions) { + if cfg!(debug_assertions) && std::env::var("RSIM_SILENT_DEBUG").is_ok_and(|x| x != "0"){ + builder.define("RS_DONT_LOG", "1"); + } + else if !cfg!(debug_assertions) { builder.define("RS_DONT_LOG", "1").define("RS_MAX_SPEED", "1"); } + builder .use_plt(false)