From caf56bdc774ba42dffcf86638cbb83b030f0073b Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Sat, 9 Sep 2023 12:42:22 +0300 Subject: [PATCH] Fix build on macOS --- core/Cargo.toml | 4 +++- core/io/mod.rs | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/Cargo.toml b/core/Cargo.toml index a405649cb..496805168 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -17,11 +17,13 @@ path = "lib.rs" default = ["fs"] fs = [] +[target.'cfg(target_os = "linux")'.dependencies] +io-uring = "0.6.1" + [dependencies] anyhow = "1.0.75" concurrent_lru = "0.2.0" fallible-iterator = "0.3.0" -io-uring = "0.6.1" log = "0.4.20" mimalloc = { version = "*", default-features = false } sqlite3-parser = "0.11.0" diff --git a/core/io/mod.rs b/core/io/mod.rs index 82b15b796..d4c082398 100644 --- a/core/io/mod.rs +++ b/core/io/mod.rs @@ -4,10 +4,10 @@ use std::io::{Read, Seek}; use std::os::unix::io::AsRawFd; use std::{fs::File, sync::Arc}; -#[cfg(feature = "fs")] +#[cfg(all(feature = "fs", target_os = "linux"))] mod io_uring; -#[cfg(target_os = "linux")] +#[cfg(feature = "fs")] mod syscall; /// I/O access method @@ -35,7 +35,7 @@ impl Default for IO { } } -#[cfg(all(feature = "fs", target_os = "darwin"))] +#[cfg(all(feature = "fs", target_os = "macos"))] impl Default for IO { fn default() -> Self { IO { @@ -61,6 +61,7 @@ impl IO { let io = Arc::new(syscall::SyscallIO::open(path)?); Ok(PageSource { io }) } + #[cfg(all(feature = "fs", target_os = "darwin"))] IOMethod::IoUring => { let io = Arc::new(io_uring::IoUring::open(path)?); Ok(PageSource { io })