Skip to content

Commit 99f8d03

Browse files
committed
Add more lib dir search options for build script
1 parent e96b4c3 commit 99f8d03

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

build.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,19 @@ fn blob_backends(conf: &Config, build_dir: &std::path::PathBuf) -> (Vec<String>,
357357
if conf.use_lib {
358358
let afpath = match env::var("AF_PATH") {
359359
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 DEFINED, TRYING TO FIND LIBRARIES FROM KNOWN DEFAULT LOCATIONS");
362+
PathBuf::from("/usr/")
363+
},
361364
};
362365
let libpath = afpath.join("lib");
363366
backend_dirs.push(libpath.to_str().to_owned().unwrap().to_string());
367+
if cfg!(target_os = "macos") || cfg!(target_os = "ios") || cfg!(target_os = "linux") {
368+
backend_dirs.push(String::from("/opt/arrayfire-3/lib"));
369+
backend_dirs.push(String::from("/usr/local/lib"));
370+
} else {
371+
backend_dirs.push(String::from("C:/Program Files/ArrayFire/v3"));
372+
}
364373
} else {
365374
backend_dirs.push(build_dir.join("package/lib").to_str().to_owned().unwrap().to_string());
366375
}
@@ -390,6 +399,7 @@ fn blob_backends(conf: &Config, build_dir: &std::path::PathBuf) -> (Vec<String>,
390399

391400
//blob in opencl deps
392401
lib_file_to_check = if cfg!(windows) {WIN_OCL_LIB_NAME} else {UNIX_OCL_LIB_NAME};
402+
393403
if backend_exists(&lib_dir.join(lib_file_to_check).to_string_lossy()) {
394404
if ! cfg!(target_os = "macos"){
395405
backends.push("OpenCL".to_string());

0 commit comments

Comments
 (0)