"Fossies" - the Fresh Open Source Software Archive

Member "darktable-2.6.3/cmake/modules/FindOpenCL.cmake.option2" (20 Oct 2019, 2892 Bytes) of package /linux/misc/darktable-2.6.3.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # Downloaded from:
    2 # http://gitorious.org/findopencl
    3 # License: Public Domain
    4 # - Try to find OpenCL
    5 # This module tries to find an OpenCL implementation on your system. It supports
    6 # AMD / ATI, Apple and NVIDIA implementations, but should work, too.
    7 #
    8 # Once done this will define
    9 #  OPENCL_FOUND        - system has OpenCL
   10 #  OPENCL_INCLUDE_DIRS  - the OpenCL include directory
   11 #  OPENCL_LIBRARIES    - link these to use OpenCL
   12 #
   13 # WIN32 should work, but is untested
   14 
   15 FIND_PACKAGE( PackageHandleStandardArgs )
   16 
   17 SET(OPENCL_FIND_REQUIRED ${OpenCL_FIND_REQUIRED})
   18 
   19 SET (OPENCL_VERSION_STRING "0.1.0")
   20 SET (OPENCL_VERSION_MAJOR 0)
   21 SET (OPENCL_VERSION_MINOR 1)
   22 SET (OPENCL_VERSION_PATCH 0)
   23 
   24 IF (APPLE)
   25 
   26   FIND_LIBRARY(OPENCL_LIBRARIES OpenCL DOC "OpenCL lib for OSX")
   27   FIND_PATH(OPENCL_INCLUDE_DIRS OpenCL/cl.h DOC "Include for OpenCL on OSX")
   28   FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS OpenCL/cl.hpp DOC "Include for OpenCL CPP bindings on OSX")
   29 
   30 ELSE (APPLE)
   31 
   32 	IF (WIN32)
   33 	
   34 	    FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h)
   35 	    FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp)
   36 	
   37 	    # The AMD SDK currently installs both x86 and x86_64 libraries
   38 	    # This is only a hack to find out architecture
   39 	    IF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" )
   40 	    	SET(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86_64")
   41 	    ELSE (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
   42 	    	SET(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86")
   43 	    ENDIF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" )
   44 	    FIND_LIBRARY(OPENCL_LIBRARIES OpenCL.lib ${OPENCL_LIB_DIR})
   45 	    
   46 	    GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE)
   47 	    
   48 	    # On Win32 search relative to the library
   49 	    FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS "${_OPENCL_INC_CAND}")
   50 	    FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS "${_OPENCL_INC_CAND}")
   51 	
   52 	ELSE (WIN32)
   53 
   54             # Unix style platforms
   55             FIND_LIBRARY(OPENCL_LIBRARIES OpenCL
   56               ENV LD_LIBRARY_PATH
   57             )
   58 
   59             GET_FILENAME_COMPONENT(OPENCL_LIB_DIR ${OPENCL_LIBRARIES} PATH)
   60             GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE)
   61 
   62             # The AMD SDK currently does not place its headers
   63             # in /usr/include, therefore also search relative
   64             # to the library
   65             FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS ${_OPENCL_INC_CAND})
   66             FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS ${_OPENCL_INC_CAND})
   67 
   68 	ENDIF (WIN32)
   69 
   70 ENDIF (APPLE)
   71 
   72 FIND_PACKAGE_HANDLE_STANDARD_ARGS( OpenCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS )
   73 
   74 IF( _OPENCL_CPP_INCLUDE_DIRS )
   75 	SET( OPENCL_HAS_CPP_BINDINGS TRUE )
   76 	LIST( APPEND OPENCL_INCLUDE_DIRS ${_OPENCL_CPP_INCLUDE_DIRS} )
   77 	# This is often the same, so clean up
   78 	LIST( REMOVE_DUPLICATES OPENCL_INCLUDE_DIRS )
   79 ENDIF( _OPENCL_CPP_INCLUDE_DIRS )
   80 
   81 MARK_AS_ADVANCED(
   82   OPENCL_INCLUDE_DIRS
   83 )
   84