@@ -64,12 +64,15 @@ fn main() {
6464 Ok ( s) => s == "true" ,
6565 Err ( _) => false ,
6666 } ;
67+ log_var ! ( force_src) ;
6768
68- let target_os = target_os ( ) ;
69- if !force_src
70- && target_arch ( ) == "x86_64"
71- && ( target_os == "linux" || target_os == "macos" || target_os == "windows" )
72- {
69+ let prebuilt_supported = match ( & target_arch ( ) as & str , & target_os ( ) as & str ) {
70+ ( "x86_64" , "linux" ) => true ,
71+ ( "x86_64" , "windows" ) => true ,
72+ ( "aarch64" , "macos" ) => true ,
73+ _ => false ,
74+ } ;
75+ if !force_src && prebuilt_supported {
7376 install_prebuilt ( ) ;
7477 } else {
7578 build_from_src ( ) ;
@@ -185,11 +188,17 @@ fn extract<P: AsRef<Path>, P2: AsRef<Path>>(archive_path: P, extract_to: P2) {
185188
186189// Downloads and unpacks a prebuilt binary. Only works for certain platforms.
187190fn install_prebuilt ( ) {
191+ log ! ( "Installing prebuilt" ) ;
188192 // Figure out the file names.
189193 let os = match & target_os ( ) as & str {
190194 "macos" => "darwin" . to_string ( ) ,
191195 x => x. to_string ( ) ,
192196 } ;
197+ let arch = match & target_arch ( ) as & str {
198+ "aarch64" => "arm64" ,
199+ x => x,
200+ }
201+ . to_string ( ) ;
193202 let proc_type = if cfg ! ( feature = "tensorflow_gpu" ) {
194203 "gpu"
195204 } else {
@@ -301,6 +310,7 @@ fn symlink<P: AsRef<Path>, P2: AsRef<Path>>(target: P, link: P2) {
301310}
302311
303312fn build_from_src ( ) {
313+ log ! ( "Building from source" ) ;
304314 let dll_suffix = dll_suffix ( ) ;
305315 let framework_target = FRAMEWORK_TARGET . to_string ( ) + dll_suffix;
306316 let target = TARGET . to_string ( ) + dll_suffix;
0 commit comments