[clfft] 48/109: Improved detection of the OpenCL dependencies during the 'copy' step A little refactoring of the FindOpenCL & FindFFTW to make it more standard

Jérôme Kieffer kieffer-guest at moszumanska.debian.org
Wed May 20 07:29:26 UTC 2015


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

kieffer-guest pushed a commit to branch debian
in repository clfft.

commit 0db6e07afbf2b1cafed401e6b9d46ab2d503f22f
Author: Kent Knox <kent.knox at amd>
Date:   Thu Mar 27 14:50:38 2014 -0500

    Improved detection of the OpenCL dependencies during the 'copy' step
    A little refactoring of the FindOpenCL & FindFFTW to make it more
    standard
---
 src/FindFFTW.cmake                      | 73 +++++++++++++++++----------------
 src/FindOpenCL.cmake                    | 62 ++++++++++++++--------------
 src/tests/copyTestDependencies.cmake.in |  8 ++++
 3 files changed, 76 insertions(+), 67 deletions(-)

diff --git a/src/FindFFTW.cmake b/src/FindFFTW.cmake
index 50a632e..cac5fc6 100644
--- a/src/FindFFTW.cmake
+++ b/src/FindFFTW.cmake
@@ -33,7 +33,9 @@
 #   FFTW_ROOT - (as a CMake or environment variable)
 #                The root directory of the fftw install prefix
 #
-#-----------------------
+#   FIND_LIBRARY_USE_LIB64_PATHS - Global property that controls whether 
+#               findFFTW should search for 64bit or 32bit libs
+#-----------------------------------------------
 # Example Usage:
 #
 #    find_package(FFTW REQUIRED)
@@ -42,53 +44,52 @@
 #    add_executable(foo foo.cc)
 #    target_link_libraries(foo ${FFTW_LIBRARIES})
 #
-#-----------------------
-if( DEFINED ENV{FFTW_ROOT} )
-	set( FFTW_ROOT $ENV{FFTW_ROOT} CACHE PATH "Environment variable defining the root of FFTW" )
-else( )
-	set( FFTW_ROOT "/usr/lib" CACHE PATH "Environment variable defining the root of FFTW" )
-endif( )
+#-----------------------------------------------
 
 find_path(FFTW_INCLUDE_DIRS
-	NAMES fftw3.h
+    NAMES fftw3.h
     HINTS
-        ${FFTW_ROOT}/api
         ${FFTW_ROOT}/include
+        ${FFTW_ROOT}/api
         ${FFTW_ROOT}
-        $ENV{FFTW_ROOT}/api
         $ENV{FFTW_ROOT}/include
-        $ENV{FFTW_ROOT}
-	PATHS
-		/usr/include
-		/usr/local/include
+        $ENV{FFTW_ROOT}/api
+        ENV FFTW_ROOT
+    PATHS
+        /usr/include
+        /usr/local/include
 )
 mark_as_advanced( FFTW_INCLUDE_DIRS )
 
 find_library( FFTW_SINGLE_PRECISION_LIBRARIES
-	NAMES fftw3f libfftw3f-3
-	HINTS
-		${FFTW_ROOT}
-		${FFTW_ROOT}/lib
-		$ENV{FFTW_ROOT}
-		$ENV{FFTW_ROOT}/lib
-	PATHS
-		/usr/lib
-		/usr/local/lib
-	DOC "FFTW dynamic library"
+    NAMES fftw3f libfftw3f-3
+    HINTS
+        ${FFTW_ROOT}/lib
+        ${FFTW_ROOT}/.libs
+        ${FFTW_ROOT}
+        $ENV{FFTW_ROOT}/lib
+        $ENV{FFTW_ROOT}/.libs
+        ENV FFTW_ROOT
+    PATHS
+        /usr/lib
+        /usr/local/lib
+    DOC "FFTW dynamic library"
 )
 mark_as_advanced( FFTW_SINGLE_PRECISION_LIBRARIES )
 
 find_library( FFTW_DOUBLE_PRECISION_LIBRARIES
-	NAMES fftw3 libfftw3-3
-	HINTS
-		${FFTW_ROOT}
-		${FFTW_ROOT}/lib
-		$ENV{FFTW_ROOT}
-		$ENV{FFTW_ROOT}/lib
-	PATHS
-		/usr/lib
-		/usr/local/lib
-	DOC "FFTW dynamic library"
+    NAMES fftw3 libfftw3-3
+    HINTS
+        ${FFTW_ROOT}/lib
+        ${FFTW_ROOT}/.libs
+        ${FFTW_ROOT}
+        $ENV{FFTW_ROOT}/lib
+        $ENV{FFTW_ROOT}/.libs
+        ENV FFTW_ROOT
+    PATHS
+        /usr/lib
+        /usr/local/lib
+    DOC "FFTW dynamic library"
 )
 mark_as_advanced( FFTW_DOUBLE_PRECISION_LIBRARIES )
 
@@ -99,6 +100,6 @@ include( FindPackageHandleStandardArgs )
 FIND_PACKAGE_HANDLE_STANDARD_ARGS( FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDE_DIRS )
 
 if( NOT FFTW_FOUND )
-	message( STATUS "FindFFTW looked for single precision libraries named: fftw3f or libfftw3f-3" )
-	message( STATUS "FindFFTW looked for double precision libraries named: fftw3 or libfftw3-3" )
+    message( STATUS "FindFFTW looked for single precision libraries named: fftw3f or libfftw3f-3" )
+    message( STATUS "FindFFTW looked for double precision libraries named: fftw3 or libfftw3-3" )
 endif()
diff --git a/src/FindOpenCL.cmake b/src/FindOpenCL.cmake
index ab58252..8725612 100644
--- a/src/FindOpenCL.cmake
+++ b/src/FindOpenCL.cmake
@@ -46,23 +46,17 @@
 #    target_link_libraries(foo ${OPENCL_LIBRARIES})
 #
 #-----------------------
-if( DEFINED ENV{AMDAPPSDKROOT} )
-	set( OPENCL_ROOT $ENV{AMDAPPSDKROOT} CACHE PATH "Environment variable defining the root of OPENCL implementation" )
-elseif( DEFINED ENV{CUDA_PATH} )
-        set( OPENCL_ROOT $ENV{CUDA_PATH} CACHE PATH "Environment variable defining the root of OPENCL implementation" )
-else( )
-	set( OPENCL_ROOT "/usr/lib" CACHE PATH "Environment variable defining the root of OPENCL implementation" )
-endif( )
 
 find_path(OPENCL_INCLUDE_DIRS
-	NAMES OpenCL/cl.h CL/cl.h
+    NAMES OpenCL/cl.h CL/cl.h
     HINTS
-		${OPENCL_ROOT}/include
-		ENV AMDAPPSDKROOT/include
-	PATHS
-		/usr/include
-		/usr/local/include
-	DOC "OpenCL header file path"
+        ${OPENCL_ROOT}/include
+        $ENV{AMDAPPSDKROOT}/include
+        $ENV{CUDA_PATH}/include
+    PATHS
+        /usr/include
+        /usr/local/include
+    DOC "OpenCL header file path"
 )
 mark_as_advanced( OPENCL_INCLUDE_DIRS )
 
@@ -70,23 +64,29 @@ mark_as_advanced( OPENCL_INCLUDE_DIRS )
 get_property( LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS )
 
 if( LIB64 )
-	find_library( OPENCL_LIBRARIES
-		NAMES OpenCL
-		HINTS
-			${OPENCL_ROOT}/lib
-			ENV AMDAPPSDKROOT/lib
-		DOC "OpenCL dynamic library path"
-		PATH_SUFFIXES x86_64 x64
-	)
+    find_library( OPENCL_LIBRARIES
+        NAMES OpenCL
+        HINTS
+            ${OPENCL_ROOT}/lib
+            $ENV{AMDAPPSDKROOT}/lib
+            $ENV{CUDA_PATH}/lib
+        DOC "OpenCL dynamic library path"
+        PATH_SUFFIXES x86_64 x64
+        PATHS
+            /usr/lib
+    )
 else( )
-	find_library( OPENCL_LIBRARIES
-		NAMES OpenCL
-		HINTS
-			${OPENCL_ROOT}/lib
-			ENV AMDAPPSDKROOT/lib
-		DOC "OpenCL dynamic library path"
-		PATH_SUFFIXES x86 Win32
-	)
+    find_library( OPENCL_LIBRARIES
+        NAMES OpenCL
+        HINTS
+            ${OPENCL_ROOT}/lib
+            $ENV{AMDAPPSDKROOT}/lib
+            $ENV{CUDA_PATH}/lib
+        DOC "OpenCL dynamic library path"
+        PATH_SUFFIXES x86 Win32
+        PATHS
+            /usr/lib
+    )
 endif( )
 mark_as_advanced( OPENCL_LIBRARIES )
 
@@ -94,5 +94,5 @@ include( FindPackageHandleStandardArgs )
 FIND_PACKAGE_HANDLE_STANDARD_ARGS( OPENCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS )
 
 if( NOT OPENCL_FOUND )
-	message( STATUS "FindOpenCL looked for libraries named: OpenCL" )
+    message( STATUS "FindOpenCL looked for libraries named: OpenCL" )
 endif()
diff --git a/src/tests/copyTestDependencies.cmake.in b/src/tests/copyTestDependencies.cmake.in
index b6d13df..e4f24a6 100644
--- a/src/tests/copyTestDependencies.cmake.in
+++ b/src/tests/copyTestDependencies.cmake.in
@@ -41,6 +41,14 @@ if( EXISTS "@GTEST_ROOT@" )
     list( APPEND depList "@GTEST_ROOT@/lib at SUFFIX_LIB@" )
 endif( )
 
+if( EXISTS "@OPENCL_LIBRARIES@" )
+    get_filename_component( clLibName "@OPENCL_LIBRARIES@" NAME )
+    string( REPLACE ${clLibName} "" clLibDir "@OPENCL_LIBRARIES@" )
+    string( REGEX REPLACE "/+$" "" clLibDir ${clLibDir} )
+
+    list( APPEND depList "${clLibDir}" )
+endif( )
+
 if( EXISTS "${testDir}" )
     list( APPEND depList "${testDir}" )
 endif( )

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



More information about the debian-science-commits mailing list