[arrayfire] 40/248: Fixing CMakeFiles for unified backend

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:53:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.

commit ec949960c7e41f8c68b0b0e3484f77bfaf73bbbc
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Fri Sep 4 15:57:58 2015 -0400

    Fixing CMakeFiles for unified backend
---
 ArrayFireConfig.cmake.in       | 16 +++++++++++-----
 examples/unified/basic.cpp     |  3 +++
 src/api/unified/CMakeLists.txt | 12 ++++++------
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/ArrayFireConfig.cmake.in b/ArrayFireConfig.cmake.in
index 3ffd8e0..3bb918d 100644
--- a/ArrayFireConfig.cmake.in
+++ b/ArrayFireConfig.cmake.in
@@ -48,17 +48,23 @@
 
 get_filename_component(ArrayFire_INCLUDE_DIRS "@INCLUDE_DIR@" ABSOLUTE)
 
-# keep in the backends in the slowest to fastest order
-foreach(backend CPU OpenCL CUDA)
-  string(TOLOWER "${backend}" lowerbackend)
+macro(find_backend backend libname)
   set(targetFile ${CMAKE_CURRENT_LIST_DIR}/@BACKEND_DIR@/ArrayFire${backend}.cmake)
   if(EXISTS ${targetFile})
     include(${targetFile})
     set(ArrayFire_${backend}_FOUND ON)
-    set(ArrayFire_${backend}_LIBRARIES af${lowerbackend})
+    set(ArrayFire_${backend}_LIBRARIES af${libname})
     # set the default backend
-    set(ArrayFire_LIBRARIES af${lowerbackend})
+    set(ArrayFire_LIBRARIES af${libname})
   else()
     set(ArrayFire_${backend}_FOUND OFF)
   endif()
+endmacro()
+
+# keep in the backends in the slowest to fastest order
+foreach(backend CPU OpenCL CUDA)
+  string(TOLOWER "${backend}" lowerbackend)
+  find_backend("${backend}" "${lowerbackend}")
 endforeach()
+
+find_backend("Unified" "")
diff --git a/examples/unified/basic.cpp b/examples/unified/basic.cpp
index 8b5c418..8f35e19 100644
--- a/examples/unified/basic.cpp
+++ b/examples/unified/basic.cpp
@@ -52,6 +52,9 @@ int main(int argc, char *argv[])
     if (AF_SUCCESS == af_set_backend(AF_BACKEND_CPU))
         testBackend();
 
+    if (AF_SUCCESS == af_set_backend(AF_BACKEND_CUDA))
+        testBackend();
+
     if (AF_SUCCESS == af_set_backend(AF_BACKEND_OPENCL))
         testBackend();
 
diff --git a/src/api/unified/CMakeLists.txt b/src/api/unified/CMakeLists.txt
index e94e577..f5683e0 100644
--- a/src/api/unified/CMakeLists.txt
+++ b/src/api/unified/CMakeLists.txt
@@ -1,17 +1,17 @@
 
-FILE(GLOB hapi_headers
+FILE(GLOB unified_headers
     "*.hpp"
     "*.h")
 
-FILE(GLOB hapi_sources
+FILE(GLOB unified_sources
     "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
 
 FILE(GLOB backend_sources
     "../c/util.cpp")
 
 ADD_LIBRARY(af SHARED
-            ${hapi_headers}
-            ${hapi_sources})
+            ${unified_headers}
+            ${unified_sources})
 
 IF(${BUILD_CPU})
     ADD_DEPENDENCIES(af afcpu)
@@ -36,7 +36,7 @@ IF(APPLE)
     INSTALL(SCRIPT "${CMAKE_MODULE_PATH}/osx_install/InstallTool.cmake")
 ENDIF(APPLE)
 
-EXPORT(TARGETS af FILE ArrayFireHAPI.cmake)
+EXPORT(TARGETS af FILE ArrayFireUnified.cmake)
 INSTALL(EXPORT AF DESTINATION "${AF_INSTALL_CMAKE_DIR}"
         COMPONENT cmake
-        FILE ArrayFireHAPI.cmake)
+        FILE ArrayFireUnified.cmake)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list