@@ -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 ( ) )
0 commit comments