forked from M-Labs/libfringe
make Valgrind optional
This commit is contained in:
parent
2760a0a7aa
commit
195350863a
|
@ -8,5 +8,6 @@ build = "build.rs"
|
|||
gcc = "0.3.3"
|
||||
|
||||
[features]
|
||||
default = ["os"]
|
||||
default = ["os", "valgrind"]
|
||||
os = []
|
||||
valgrind = []
|
||||
|
|
5
build.rs
5
build.rs
|
@ -1,5 +1,8 @@
|
|||
extern crate gcc;
|
||||
use std::env::var_os;
|
||||
|
||||
fn main() {
|
||||
gcc::compile_library("libvalgrind.a", &["src/debug/valgrind.c"]);
|
||||
if var_os("CARGO_FEATURE_VALGRIND").is_some() {
|
||||
gcc::compile_library("libvalgrind.a", &["src/debug/valgrind/native.c"]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
pub use self::imp::*;
|
||||
|
||||
#[cfg(feature = "valgrind")]
|
||||
#[path = "native.rs"]
|
||||
mod imp;
|
||||
|
||||
#[cfg(not(feature = "valgrind"))]
|
||||
mod imp {
|
||||
//! Stub for the Valgrind functions
|
||||
#![allow(non_camel_case_types)]
|
||||
pub type stack_id_t = ();
|
||||
pub unsafe fn stack_register(_start: *const u8, _end: *const u8) -> stack_id_t {}
|
||||
pub unsafe fn stack_deregister(_id: stack_id_t) {}
|
||||
}
|
Loading…
Reference in New Issue