diff --git a/Cargo.toml b/Cargo.toml index 4adf0b90a..93fd8e562 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "arrayfire" description = "ArrayFire is a high performance software library for parallel computing with an easy-to-use API. Its array based function set makes parallel programming simple. ArrayFire's multiple backends (CUDA, OpenCL and native CPU) make it platform independent and highly portable. A few lines of code in ArrayFire can replace dozens of lines of parallel computing code, saving you valuable time and lowering development costs. This crate provides Rust bindings for ArrayFire library." -version = "3.2.0-rc0" +version = "3.2.0" documentation = "http://arrayfire.github.io/arrayfire-rust/arrayfire/index.html" homepage = "https://github.com/arrayfire/arrayfire" repository = "https://github.com/arrayfire/arrayfire-rust" diff --git a/README.md b/README.md index 0085aac05..381f883e4 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,12 @@ You can find the most recent updated documentation [here](http://arrayfire.githu ## Supported platforms -Currently, only Linux and OSX. With Rust 1.4(MSVC binary), we soon expect to get the Windows support available. +- Linux and OSX: The bindings have been tested with Rust 1.x. +- Windows: Rust 1.5 (MSVC ABI) is the first version that works with our bindings and ArrayFire library(built using MSVC compiler). -## Use from Crates.io +We recommend using Rust 1.5 and higher. + +## Use from Crates.io [![](http://meritbadge.herokuapp.com/arrayfire)](https://crates.io/crates/arrayfire) To use the rust bindings for ArrayFire from crates.io, the following requirements are to be met first. diff --git a/arrayfire b/arrayfire index c9b22d58f..f263db079 160000 --- a/arrayfire +++ b/arrayfire @@ -1 +1 @@ -Subproject commit c9b22d58f49da06a7b13ad594b807d5c1230cfab +Subproject commit f263db079443f7818a73ee94e237dd53ef017d01 diff --git a/build.rs b/build.rs index 9c2fa743c..b45c5e5ad 100644 --- a/build.rs +++ b/build.rs @@ -10,6 +10,15 @@ use std::path::PathBuf; use std::process::Command; use std::convert::AsRef; +// Windows specific library file names +static WIN_CUDA_LIB_NAME: &'static str = "afcuda"; +static WIN_OCL_LIB_NAME: &'static str = "afopencl"; +static WIN_UNI_LIB_NAME: &'static str = "af"; +// Linux & OSX specific library file names +static UNIX_CUDA_LIB_NAME: &'static str = "libafcuda"; +static UNIX_OCL_LIB_NAME: &'static str = "libafopencl"; +static UNIX_UNI_LIB_NAME: &'static str = "libaf"; + #[allow(dead_code)] #[derive(RustcDecodable)] struct Config { @@ -356,53 +365,64 @@ fn blob_backends(conf: &Config, build_dir: &std::path::PathBuf) -> (Vec, } let lib_dir = PathBuf::from(backend_dirs.last().unwrap()); - - // blob in cuda deps - if backend_exists(&lib_dir.join("libafcuda").to_string_lossy()) { - if cfg!(windows) { - backend_dirs.push(format!("{}\\lib\\x64", conf.cuda_sdk)); - backend_dirs.push(format!("{}\\nvvm\\lib\\x64", conf.cuda_sdk)); - } else { - let sdk_dir = format!("{}/{}", conf.cuda_sdk, "lib64"); - match dir_exists(&sdk_dir){ - true => { - backend_dirs.push(sdk_dir); - backend_dirs.push(format!("{}/nvvm/{}", conf.cuda_sdk, "lib64")); - }, - false => { - backend_dirs.push(format!("{}/{}", conf.cuda_sdk, "lib")); - backend_dirs.push(format!("{}/nvvm/{}", conf.cuda_sdk, "lib")); - }, - }; + if ! conf.use_lib { + // blob in cuda deps + let mut lib_file_to_check = if cfg!(windows) {WIN_CUDA_LIB_NAME} else {UNIX_CUDA_LIB_NAME}; + if backend_exists(&lib_dir.join(lib_file_to_check).to_string_lossy()) { + if cfg!(windows) { + backend_dirs.push(format!("{}\\lib\\x64", conf.cuda_sdk)); + backend_dirs.push(format!("{}\\nvvm\\lib\\x64", conf.cuda_sdk)); + } else { + let sdk_dir = format!("{}/{}", conf.cuda_sdk, "lib64"); + match dir_exists(&sdk_dir){ + true => { + backend_dirs.push(sdk_dir); + backend_dirs.push(format!("{}/nvvm/{}", conf.cuda_sdk, "lib64")); + }, + false => { + backend_dirs.push(format!("{}/{}", conf.cuda_sdk, "lib")); + backend_dirs.push(format!("{}/nvvm/{}", conf.cuda_sdk, "lib")); + }, + }; + } } - } - //blob in opencl deps - if backend_exists(&lib_dir.join("libafopencl").to_string_lossy()) { - if ! cfg!(target_os = "macos"){ - backends.push("OpenCL".to_string()); + //blob in opencl deps + lib_file_to_check = if cfg!(windows) {WIN_OCL_LIB_NAME} else {UNIX_OCL_LIB_NAME}; + if backend_exists(&lib_dir.join(lib_file_to_check).to_string_lossy()) { + if ! cfg!(target_os = "macos"){ + backends.push("OpenCL".to_string()); + } + if cfg!(windows) { + let sdk_dir = format!("{}\\lib\\x64", conf.opencl_sdk); + if dir_exists(&sdk_dir){ + backend_dirs.push(sdk_dir); + }else { + backend_dirs.push(format!("{}\\lib\\x86_64", conf.opencl_sdk)); + } + } else { + let sdk_dir = format!("{}/{}", conf.opencl_sdk, "lib64"); + if dir_exists(&sdk_dir){ + backend_dirs.push(sdk_dir); + }else { + backend_dirs.push(format!("{}/{}", conf.opencl_sdk, "lib")); + } + } } - if cfg!(windows) { - backend_dirs.push(format!("{}\\lib\\x64", conf.opencl_sdk)); - } else { - let sdk_dir = format!("{}/{}", conf.opencl_sdk, "lib64"); - if dir_exists(&sdk_dir){ - backend_dirs.push(sdk_dir); - }else { - backend_dirs.push(format!("{}/{}", conf.opencl_sdk, "lib")); + + if conf.build_graphics=="ON" { + if !conf.use_lib { + backend_dirs.push(build_dir.join("third_party/forge/lib") + .to_str().to_owned().unwrap().to_string()); } } } - if backend_exists(&lib_dir.join("libaf").to_string_lossy()) { + let lib_file_to_check = if cfg!(windows) {WIN_UNI_LIB_NAME} else {UNIX_UNI_LIB_NAME}; + if backend_exists(&lib_dir.join(lib_file_to_check).to_string_lossy()) { backends.push("af".to_string()); - } - - if conf.build_graphics=="ON" { - backends.push("forge".to_string()); - if !conf.use_lib { - backend_dirs.push(build_dir.join("third_party/forge/lib") - .to_str().to_owned().unwrap().to_string()); + if !conf.use_lib && conf.build_graphics=="ON" { + backends.push("forge".to_string()); } }