Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(audio): link RNNoise SIMD archives after the core

Richie McIlroy51a0e7a72397
diff --git a/crates/rnnoise/build.rs b/crates/rnnoise/build.rs
index f50480655..227efbc9d 100644
--- a/crates/rnnoise/build.rs
+++ b/crates/rnnoise/build.rs
@@ -17,6 +17,7 @@ fn main() {
println!("cargo:rerun-if-changed=vendor");
let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let target = env::var("CARGO_CFG_TARGET_ENV").unwrap();
+ let is_x86 = matches!(arch.as_str(), "x86_64" | "x86");
let mut core = build();
for source in [
"denoise",
@@ -32,13 +33,17 @@ fn main() {
] {
core.file(format!("vendor/src/{source}.c"));
}
- if arch == "x86_64" || arch == "x86" {
+ if is_x86 {
core.define("RNN_ENABLE_X86_RTCD", None)
.file("vendor/src/x86/x86cpu.c")
.file("vendor/src/x86/x86_dnn_map.c");
if target != "msvc" {
core.define("CPU_INFO_BY_C", None);
}
+ }
+ // GNU ld needs the core archive before the SIMD archives it references.
+ core.compile("cap_rnnoise");
+ if is_x86 {
for (name, flag) in [("sse4_1", "-msse4.1"), ("avx2", "-mavx2")] {
let mut vector = build();
vector.file(format!("vendor/src/x86/nnet_{name}.c"));
@@ -59,5 +64,4 @@ fn main() {
vector.compile(&format!("cap_rnnoise_{name}"));
}
}
- core.compile("cap_rnnoise");
}