Skip to content

Commit

Permalink
Add support for building with io_uring on Linux. (rust-rocksdb#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
parazyd authored and msmouse committed Sep 8, 2022
1 parent be2865e commit e9323cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -22,6 +22,7 @@ members = ["librocksdb-sys"]
[features]
default = ["snappy", "lz4", "zstd", "zlib", "bzip2"]
jemalloc = ["librocksdb-sys/jemalloc"]
io-uring = ["librocksdb-sys/io-uring"]
valgrind = []
snappy = ["librocksdb-sys/snappy"]
lz4 = ["librocksdb-sys/lz4"]
Expand Down
2 changes: 2 additions & 0 deletions librocksdb-sys/Cargo.toml
Expand Up @@ -15,6 +15,7 @@ links = "rocksdb"
default = [ "static" ]
jemalloc = ["tikv-jemalloc-sys"]
static = ["libz-sys?/static", "bzip2-sys?/static"]
io-uring = ["pkg-config"]
snappy = []
lz4 = ["lz4-sys"]
zstd = ["zstd-sys"]
Expand All @@ -38,3 +39,4 @@ uuid = { version = "1.0", features = ["v4"] }
cc = { version = "1.0", features = ["parallel"] }
bindgen = { version = "0.60", default-features = false, features = ["runtime"] }
glob = "0.3"
pkg-config = { version = "0.3", optional = true }
7 changes: 7 additions & 0 deletions librocksdb-sys/build.rs
Expand Up @@ -222,6 +222,13 @@ fn build_rocksdb() {
config.define("WITH_JEMALLOC", "ON");
}

#[cfg(feature = "io-uring")]
if target.contains("linux") {
pkg_config::probe_library("liburing")
.expect("The io-uring feature was requested but the library is not available");
config.define("ROCKSDB_IOURING_PRESENT", Some("1"));
}

if target.contains("msvc") {
config.flag("-EHsc");
config.flag("-std:c++17");
Expand Down

0 comments on commit e9323cd

Please sign in to comment.