diff --git a/Cargo.toml b/Cargo.toml index d164526..d9a0b82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ lz4 = ["librocksdb-sys/lz4"] zstd = ["librocksdb-sys/zstd"] zlib = ["librocksdb-sys/zlib"] bzip2 = ["librocksdb-sys/bzip2"] +rtti = ["librocksdb-sys/rtti"] multi-threaded-cf = [] [dependencies] diff --git a/librocksdb-sys/Cargo.toml b/librocksdb-sys/Cargo.toml index da4eb3d..1d0d7ad 100644 --- a/librocksdb-sys/Cargo.toml +++ b/librocksdb-sys/Cargo.toml @@ -20,6 +20,7 @@ lz4 = [] zstd = [] zlib = [] bzip2 = [] +rtti = [] [dependencies] libc = "0.2" diff --git a/librocksdb-sys/build.rs b/librocksdb-sys/build.rs index 04febf4..a39ee25 100644 --- a/librocksdb-sys/build.rs +++ b/librocksdb-sys/build.rs @@ -83,6 +83,10 @@ fn build_rocksdb() { config.include("bzip2/"); } + if cfg!(feature = "rtti") { + config.define("USE_RTTI", Some("1")); + } + config.include("."); config.define("NDEBUG", Some("1")); @@ -400,4 +404,13 @@ fn main() { fail_on_empty_directory("bzip2"); build_bzip2(); } + + // Allow dependent crates to locate the sources and output directory of + // this crate. Notably, this allows a dependent crate to locate the RocksDB + // sources and built archive artifacts provided by this crate. + println!( + "cargo:cargo_manifest_dir={}", + env::var("CARGO_MANIFEST_DIR").unwrap() + ); + println!("cargo:out_dir={}", env::var("OUT_DIR").unwrap()); }