@@ -64,12 +64,15 @@ fn main() {
64
64
Ok ( s) => s == "true" ,
65
65
Err ( _) => false ,
66
66
} ;
67
+ log_var ! ( force_src) ;
67
68
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 {
73
76
install_prebuilt ( ) ;
74
77
} else {
75
78
build_from_src ( ) ;
@@ -185,11 +188,17 @@ fn extract<P: AsRef<Path>, P2: AsRef<Path>>(archive_path: P, extract_to: P2) {
185
188
186
189
// Downloads and unpacks a prebuilt binary. Only works for certain platforms.
187
190
fn install_prebuilt ( ) {
191
+ log ! ( "Installing prebuilt" ) ;
188
192
// Figure out the file names.
189
193
let os = match & target_os ( ) as & str {
190
194
"macos" => "darwin" . to_string ( ) ,
191
195
x => x. to_string ( ) ,
192
196
} ;
197
+ let arch = match & target_arch ( ) as & str {
198
+ "aarch64" => "arm64" ,
199
+ x => x,
200
+ }
201
+ . to_string ( ) ;
193
202
let proc_type = if cfg ! ( feature = "tensorflow_gpu" ) {
194
203
"gpu"
195
204
} else {
@@ -199,11 +208,7 @@ fn install_prebuilt() {
199
208
let ext = if windows { ".zip" } else { ".tar.gz" } ;
200
209
let binary_url = format ! (
201
210
"https://storage.googleapis.com/tensorflow/versions/{}/libtensorflow-{}-{}-{}{}" ,
202
- VERSION ,
203
- proc_type,
204
- os,
205
- target_arch( ) ,
206
- ext
211
+ VERSION , proc_type, os, arch, ext
207
212
) ;
208
213
log_var ! ( binary_url) ;
209
214
let short_file_name = binary_url. split ( '/' ) . last ( ) . unwrap ( ) ;
@@ -301,6 +306,7 @@ fn symlink<P: AsRef<Path>, P2: AsRef<Path>>(target: P, link: P2) {
301
306
}
302
307
303
308
fn build_from_src ( ) {
309
+ log ! ( "Building from source" ) ;
304
310
let dll_suffix = dll_suffix ( ) ;
305
311
let framework_target = FRAMEWORK_TARGET . to_string ( ) + dll_suffix;
306
312
let target = TARGET . to_string ( ) + dll_suffix;
0 commit comments