@@ -357,10 +357,25 @@ fn blob_backends(conf: &Config, build_dir: &std::path::PathBuf) -> (Vec<String>,
357
357
if conf. use_lib {
358
358
let afpath = match env:: var ( "AF_PATH" ) {
359
359
Ok ( af_path) => PathBuf :: from ( & af_path) ,
360
- Err ( _) => panic ! ( "Error use_lib is defined, but AF_PATH is not defined" ) ,
360
+ Err ( _) => {
361
+ println ! ( "WARNING! USE_LIB IS DEFINED, BUT AF_PATH IS NOT FOUND," ) ;
362
+ println ! ( " TRYING TO FIND LIBRARIES FROM KNOWN DEFAULT LOCATIONS" ) ;
363
+
364
+ if cfg!( target_os = "windows" )
365
+ PathBuf :: from( "C:/Program Files/ArrayFire/v3/" )
366
+ } else {
367
+ PathBuf :: from( "/usr/local/" )
368
+ }
369
+ } ,
361
370
} ;
371
+
362
372
let libpath = afpath. join( "lib" ) ;
363
373
backend_dirs. push( libpath. to_str( ) . to_owned( ) . unwrap( ) . to_string( ) ) ;
374
+
375
+ if !cfg!( target_os = "windows" ) {
376
+ backend_dirs. push( String :: from( "/opt/arrayfire-3/lib" ) ) ;
377
+ backend_dirs. push( String :: from( "/usr/lib" ) ) ;
378
+ }
364
379
} else {
365
380
backend_dirs. push( build_dir. join( "package/lib" ) . to_str( ) . to_owned( ) . unwrap( ) . to_string( ) ) ;
366
381
}
@@ -390,6 +405,7 @@ fn blob_backends(conf: &Config, build_dir: &std::path::PathBuf) -> (Vec<String>,
390
405
391
406
//blob in opencl deps
392
407
lib_file_to_check = if cfg!( windows) { WIN_OCL_LIB_NAME } else { UNIX_OCL_LIB_NAME } ;
408
+
393
409
if backend_exists( & lib_dir. join( lib_file_to_check) . to_string_lossy( ) ) {
394
410
if ! cfg!( target_os = "macos" ) {
395
411
backends. push( "OpenCL" . to_string( ) ) ;
0 commit comments