2012-07-16 19:08:14 +02:00
|
|
|
if(APPLE)
|
|
|
|
set(OPENCL_FOUND YES)
|
|
|
|
set(OPENCL_LIBRARIES "-framework OpenCL")
|
|
|
|
else()
|
2012-10-22 09:14:22 +02:00
|
|
|
#find_package(OpenCL QUIET)
|
2012-10-17 01:18:30 +02:00
|
|
|
if(WITH_OPENCLAMDFFT)
|
2012-08-07 10:33:46 +02:00
|
|
|
find_path(CLAMDFFT_INCLUDE_DIR
|
|
|
|
NAMES clAmdFft.h)
|
|
|
|
find_library(CLAMDFFT_LIBRARIES
|
|
|
|
NAMES clAmdFft.Runtime)
|
2012-10-17 01:18:30 +02:00
|
|
|
endif()
|
|
|
|
if(WITH_OPENCLAMDBLAS)
|
2012-08-07 10:33:46 +02:00
|
|
|
find_path(CLAMDBLAS_INCLUDE_DIR
|
|
|
|
NAMES clAmdBlas.h)
|
|
|
|
find_library(CLAMDBLAS_LIBRARIES
|
|
|
|
NAMES clAmdBlas)
|
2012-10-17 01:18:30 +02:00
|
|
|
endif()
|
2012-07-16 19:08:14 +02:00
|
|
|
# Try AMD/ATI Stream SDK
|
|
|
|
if (NOT OPENCL_FOUND)
|
|
|
|
set(ENV_AMDSTREAMSDKROOT $ENV{AMDAPPSDKROOT})
|
|
|
|
set(ENV_OPENCLROOT $ENV{OPENCLROOT})
|
|
|
|
set(ENV_CUDA_PATH $ENV{CUDA_PATH})
|
|
|
|
if(ENV_AMDSTREAMSDKROOT)
|
|
|
|
set(OPENCL_INCLUDE_SEARCH_PATH ${ENV_AMDSTREAMSDKROOT}/include)
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
|
|
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_AMDSTREAMSDKROOT}/lib/x86)
|
|
|
|
else()
|
|
|
|
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_AMDSTREAMSDKROOT}/lib/x86_64)
|
|
|
|
endif()
|
2012-07-17 08:49:32 +02:00
|
|
|
elseif(ENV_CUDAPATH AND WIN32)
|
2012-07-16 19:08:14 +02:00
|
|
|
set(OPENCL_INCLUDE_SEARCH_PATH ${ENV_CUDA_PATH}/include)
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
|
|
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_CUDA_PATH}/lib/Win32)
|
|
|
|
else()
|
|
|
|
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_CUDA_PATH}/lib/x64)
|
|
|
|
endif()
|
2012-07-17 08:49:32 +02:00
|
|
|
elseif(ENV_OPENCLROOT AND UNIX)
|
2012-07-16 19:08:14 +02:00
|
|
|
set(OPENCL_INCLUDE_SEARCH_PATH ${ENV_OPENCLROOT}/inc)
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
|
|
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} /usr/lib)
|
|
|
|
else()
|
|
|
|
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} /usr/lib64)
|
|
|
|
endif()
|
|
|
|
endif()
|
2012-10-17 01:18:30 +02:00
|
|
|
|
2012-07-16 19:08:14 +02:00
|
|
|
if(OPENCL_INCLUDE_SEARCH_PATH)
|
|
|
|
find_path(OPENCL_INCLUDE_DIR
|
|
|
|
NAMES CL/cl.h OpenCL/cl.h
|
|
|
|
PATHS ${OPENCL_INCLUDE_SEARCH_PATH}
|
|
|
|
NO_DEFAULT_PATH)
|
|
|
|
else()
|
|
|
|
find_path(OPENCL_INCLUDE_DIR
|
|
|
|
NAMES CL/cl.h OpenCL/cl.h)
|
|
|
|
endif()
|
2012-10-17 01:18:30 +02:00
|
|
|
|
2012-07-16 19:08:14 +02:00
|
|
|
if(OPENCL_LIB_SEARCH_PATH)
|
|
|
|
find_library(OPENCL_LIBRARY NAMES OpenCL PATHS ${OPENCL_LIB_SEARCH_PATH} NO_DEFAULT_PATH)
|
|
|
|
else()
|
2012-09-11 12:32:31 +02:00
|
|
|
find_library(OPENCL_LIBRARY NAMES OpenCL)
|
2012-07-16 19:08:14 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(
|
|
|
|
OPENCL
|
|
|
|
DEFAULT_MSG
|
|
|
|
OPENCL_LIBRARY OPENCL_INCLUDE_DIR
|
|
|
|
)
|
|
|
|
|
|
|
|
if(OPENCL_FOUND)
|
|
|
|
set(OPENCL_LIBRARIES ${OPENCL_LIBRARY})
|
2012-10-17 01:18:30 +02:00
|
|
|
set(HAVE_OPENCL 1)
|
2012-07-16 19:08:14 +02:00
|
|
|
else()
|
|
|
|
set(OPENCL_LIBRARIES)
|
|
|
|
endif()
|
2012-10-17 01:18:30 +02:00
|
|
|
else()
|
|
|
|
set(HAVE_OPENCL 1)
|
2012-07-16 19:08:14 +02:00
|
|
|
endif()
|
|
|
|
endif()
|