Skip to content

Commit

Permalink
Merge pull request #50 from arrayfire/build_fixes
Browse files Browse the repository at this point in the history
Fixed build options for OS specific cases
  • Loading branch information
9prady9 committed Dec 10, 2015
2 parents 13dcd15 + 27d9072 commit f668c4b
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion arrayfire
Submodule arrayfire updated 49 files
+1 −0 .gitignore
+13 −0 CMakeLists.txt
+1 −1 CMakeModules/AFInstallDirs.cmake
+1 −1 CMakeModules/Version.cmake
+1 −1 CMakeModules/build_forge.cmake
+3 −0 CMakeModules/examples.dox.in
+1 −1 assets
+30 −6 docs/CMakeLists.txt
+6 −0 docs/arrayfire.css
+0 −21 docs/details/array.dox
+2 −2 docs/doxygen.mk
+4 −0 docs/layout.xml
+1 −1 docs/pages/INSTALL.md
+160 −0 docs/pages/forge_visualization.md
+2 −2 docs/pages/getting_started.md
+163 −0 docs/pages/interop_cuda.md
+189 −0 docs/pages/interop_opencl.md
+94 −56 docs/pages/matrix_manipulation.md
+45 −6 docs/pages/release_notes.md
+3 −3 docs/pages/timing.md
+3 −1 docs/pages/unified_backend.md
+212 −0 docs/pages/vectorization.md
+56 −66 examples/CMakeLists.txt
+1 −0 examples/unified/basic.cpp
+49 −31 include/af/array.h
+1 −1 include/af/graphics.h
+167 −3 include/af/seq.h
+0 −51 include/arrayfire.h
+2 −1 src/api/c/moddims.cpp
+6 −21 src/api/cpp/array.cpp
+2 −0 src/api/unified/CMakeLists.txt
+5 −3 src/backend/cpu/Array.cpp
+17 −3 src/backend/cpu/Array.hpp
+3 −1 src/backend/cpu/platform.cpp
+9 −3 src/backend/cuda/Array.cpp
+17 −3 src/backend/cuda/Array.hpp
+1 −3 src/backend/cuda/homography.cu
+50 −41 src/backend/cuda/kernel/homography.hpp
+11 −3 src/backend/opencl/Array.cpp
+18 −3 src/backend/opencl/Array.hpp
+2 −4 src/backend/opencl/homography.cpp
+45 −42 src/backend/opencl/kernel/homography.cl
+2 −6 src/backend/opencl/kernel/homography.hpp
+120 −47 test/CMakeLists.txt
+190 −0 test/CMakeModules/FindOpenCL.cmake
+8 −7 test/CMakeModules/build_gtest.cmake
+45 −0 test/array.cpp
+34 −0 test/gfor.cpp
+95 −0 test/index.cpp
98 changes: 59 additions & 39 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -356,53 +365,64 @@ fn blob_backends(conf: &Config, build_dir: &std::path::PathBuf) -> (Vec<String>,
}

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());
}
}

Expand Down

0 comments on commit f668c4b

Please sign in to comment.