Skip to content

Commit 70811dc

Browse files
committed
Upgrade libyuv to v1922
1 parent 7b03bf7 commit 70811dc

2 files changed

Lines changed: 28 additions & 7 deletions

File tree

yuv-sys/build.rs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,25 @@ fn main() {
119119
.filter(|f| f.path().extension().unwrap() == "h")
120120
.collect::<Vec<_>>();
121121

122-
let source_files = fs::read_dir(source_dir)
122+
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
123+
let source_files: Vec<_> = fs::read_dir(source_dir)
123124
.unwrap()
124125
.map(Result::unwrap)
125-
.filter(|f| f.path().extension().unwrap() == "cc")
126-
.collect::<Vec<_>>();
126+
.filter(|f| {
127+
let path = f.path();
128+
let ext = path.extension().unwrap();
129+
if ext == "cc" {
130+
// Exclude row_neon64.cc on macOS - it contains I8MM instructions
131+
// that Apple Silicon doesn't support
132+
if target_os == "macos" && path.file_name().unwrap() == "row_neon64.cc" {
133+
return false;
134+
}
135+
true
136+
} else {
137+
false
138+
}
139+
})
140+
.collect();
127141

128142
let fnc_content = fs::read_to_string("yuv_functions.txt").unwrap();
129143
let fnc_list = fnc_content.lines().collect::<Vec<_>>();
@@ -134,11 +148,18 @@ fn main() {
134148
rename_symbols(&fnc_list, &include_files, &source_files);
135149
}
136150

137-
cc::Build::new()
151+
let mut build = cc::Build::new();
152+
build
138153
.warnings(false)
139154
.include(libyuv_dir.join("include"))
140-
.files(source_files.iter().map(|f| f.path()))
141-
.compile("yuv");
155+
.files(source_files.iter().map(|f| f.path()));
156+
157+
// Disable SVE on macOS (Apple Silicon doesn't support it)
158+
if target_os == "macos" {
159+
build.define("LIBYUV_DISABLE_SVE", None);
160+
}
161+
162+
build.compile("yuv");
142163

143164
let mut bindgen = bindgen::Builder::default()
144165
.header(include_dir.join("libyuv.h").to_string_lossy())

yuv-sys/libyuv

Submodule libyuv updated from 3e435fe to 500f456

0 commit comments

Comments
 (0)