diff --git a/rust/ares/Cargo.toml b/rust/ares/Cargo.toml index 23316f7..d07e754 100644 --- a/rust/ares/Cargo.toml +++ b/rust/ares/Cargo.toml @@ -12,6 +12,8 @@ edition = "2018" # Please keep these alphabetized [dependencies] ares_macros = { path = "../ares_macros" } +# Use this when debugging requires the debug printfs in the PMA +# ares_pma = { path = "../ares_pma", features=["debug_prints"] } ares_pma = { path = "../ares_pma" } assert_no_alloc = "1.1.2" # use this when debugging requires allocation (e.g. eprintln) diff --git a/rust/ares_pma/Cargo.toml b/rust/ares_pma/Cargo.toml index b7ccdb4..94612e4 100644 --- a/rust/ares_pma/Cargo.toml +++ b/rust/ares_pma/Cargo.toml @@ -11,3 +11,5 @@ edition = "2018" bindgen = "0.69.1" cc = "1.0" +[features] +debug_prints = [] diff --git a/rust/ares_pma/build.rs b/rust/ares_pma/build.rs index f79c4ed..eb2ca17 100644 --- a/rust/ares_pma/build.rs +++ b/rust/ares_pma/build.rs @@ -8,7 +8,7 @@ use bindgen::CargoCallbacks; fn main() { let profile = env::var("PROFILE").unwrap(); let opt_level = env::var("OPT_LEVEL").unwrap(); - let define_debug = if profile == "debug" { + let define_debug = if env::var("CARGO_FEATURE_DEBUG_PRINTS").is_ok() { "-DDEBUG" } else { "-UDEBUG"