A high-performance inference engine for AI models
build the workspace on windows and linux
eugenebe162012d601
diff --git a/crates/legacy/keisoku/Cargo.toml b/crates/legacy/keisoku/Cargo.tomlindex 0bb525253..9d37becbb 100644--- a/crates/legacy/keisoku/Cargo.toml+++ b/crates/legacy/keisoku/Cargo.toml@@ -16,12 +16,10 @@ path = "src/lib.rs"[lints]workspace = true-[dependencies]+[target.'cfg(target_vendor = "apple")'.dependencies]bitflags.workspace = trueserde = { workspace = true, features = ["derive"] }thiserror.workspace = true--[target.'cfg(target_vendor = "apple")'.dependencies]kanka.workspace = trueobjc2-core-foundation.workspace = trueobfstr.workspace = true@@ -33,5 +31,5 @@ objc2-io-kit.workspace = trueserde_json.workspace = true# Memory stats on non-macOS Apple (iOS) come from sysinfo.-[target.'cfg(not(target_os = "macos"))'.dependencies]+[target.'cfg(all(target_vendor = "apple", not(target_os = "macos")))'.dependencies]sysinfo.workspace = truediff --git a/crates/legacy/keisoku/src/lib.rs b/crates/legacy/keisoku/src/lib.rsindex fa472c462..c488c4aac 100644--- a/crates/legacy/keisoku/src/lib.rs+++ b/crates/legacy/keisoku/src/lib.rs@@ -1,5 +1,6 @@-#[cfg(not(target_vendor = "apple"))]-compile_error!("keisoku supports Apple platforms only (macOS and iOS)");+// Apple platforms only (macOS and iOS). Elsewhere the crate is empty, so workspace-wide+// builds (`cargo build`, `cargo clippy --workspace`) still work on Windows and Linux.+#![cfg(target_vendor = "apple")]mod device;#[cfg(target_os = "macos")]diff --git a/crates/legacy/keisoku/tests/telemetry.rs b/crates/legacy/keisoku/tests/telemetry.rsindex f5293c6b8..104d1e4e5 100644--- a/crates/legacy/keisoku/tests/telemetry.rs+++ b/crates/legacy/keisoku/tests/telemetry.rs@@ -1,3 +1,5 @@+#![cfg(target_vendor = "apple")]+#[test]fn available_telemetry() {use keisoku::Device;diff --git a/crates/uzu-engine/build/cpu/compiler.rs b/crates/uzu-engine/build/cpu/compiler.rsindex 9dbfece66..a6e4f2198 100644--- a/crates/uzu-engine/build/cpu/compiler.rs+++ b/crates/uzu-engine/build/cpu/compiler.rs@@ -170,11 +170,8 @@ impl CpuCompiler {.strip_prefix(&self.src_dir).context("source is not in src_dir")?.with_extension("")- .as_os_str()- .to_str()- .unwrap()- .split("/")- .map(|s| s.to_string())+ .components()+ .map(|component| component.as_os_str().to_str().unwrap().to_string()).collect();let source_contents = fs::read_to_string(&source_path).context("cannot read the source file")?;diff --git a/scripts/benchmarks/engine-uzu/Cargo.toml b/scripts/benchmarks/engine-uzu/Cargo.tomlindex 521a51380..a5cc014cb 100644--- a/scripts/benchmarks/engine-uzu/Cargo.toml+++ b/scripts/benchmarks/engine-uzu/Cargo.toml@@ -12,7 +12,7 @@ publish = false[lints]workspace = true-[dependencies]+[target.'cfg(target_vendor = "apple")'.dependencies]anyhow.workspace = trueclap.workspace = truefutures.workspace = truediff --git a/scripts/benchmarks/engine-uzu/build.rs b/scripts/benchmarks/engine-uzu/build.rsindex 281cb1ecc..364188ca7 100644--- a/scripts/benchmarks/engine-uzu/build.rs+++ b/scripts/benchmarks/engine-uzu/build.rs@@ -1,4 +1,7 @@fn main() {+ if std::env::var("CARGO_CFG_TARGET_VENDOR").as_deref() != Ok("apple") {+ return;+ }let header = "../common-cpp/src/memory_counters.h";let source = "../common-cpp/src/memory_counters.c";println!("cargo:rerun-if-changed={source}");diff --git a/scripts/benchmarks/engine-uzu/src/lib.rs b/scripts/benchmarks/engine-uzu/src/lib.rsindex a886c8e9c..6cc276944 100644--- a/scripts/benchmarks/engine-uzu/src/lib.rs+++ b/scripts/benchmarks/engine-uzu/src/lib.rs@@ -1,3 +1,5 @@+#![cfg(target_vendor = "apple")]+mod args;mod bench;mod common;diff --git a/scripts/benchmarks/engine-uzu/src/main.rs b/scripts/benchmarks/engine-uzu/src/main.rsindex 3b494ae5c..11e1cd4b7 100644--- a/scripts/benchmarks/engine-uzu/src/main.rs+++ b/scripts/benchmarks/engine-uzu/src/main.rs@@ -1,7 +1,16 @@-use benchmarks_uzu::Args;-use clap::Parser;-+#[cfg(target_vendor = "apple")]#[tokio::main]async fn main() -> anyhow::Result<()> {+ use benchmarks_uzu::Args;+ use clap::Parser;+benchmarks_uzu::run(Args::parse()).await}++// Apple platforms only: the memory counters read mach task info and the engine runs on Metal. Elsewhere the binary+// only says so, which keeps workspace-wide builds working on Windows and Linux.+#[cfg(not(target_vendor = "apple"))]+fn main() {+ eprintln!("benchmarks-uzu runs on Apple platforms only");+ std::process::exit(1);+}