2016-01-15 17:42:22 +08:00
|
|
|
set(OPENCL_FOUND ON CACHE BOOL "OpenCL library is found")
|
2012-07-17 01:08:14 +08:00
|
|
|
if(APPLE)
|
2013-03-16 03:29:22 +08:00
|
|
|
set(OPENCL_LIBRARY "-framework OpenCL" CACHE STRING "OpenCL library")
|
2016-01-15 17:42:22 +08:00
|
|
|
set(OPENCL_INCLUDE_DIR "" CACHE PATH "OpenCL include directory")
|
2019-03-24 23:34:09 +08:00
|
|
|
else()
|
2016-01-15 17:42:22 +08:00
|
|
|
set(OPENCL_LIBRARY "" CACHE STRING "OpenCL library")
|
|
|
|
set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2" CACHE PATH "OpenCL include directory")
|
2018-02-27 02:10:21 +08:00
|
|
|
ocv_install_3rdparty_licenses(opencl-headers "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/LICENSE.txt")
|
2019-03-24 23:34:09 +08:00
|
|
|
endif()
|
2016-01-15 17:42:22 +08:00
|
|
|
mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
|
2015-02-14 00:11:46 +08:00
|
|
|
|
2013-03-16 03:29:22 +08:00
|
|
|
if(OPENCL_FOUND)
|
2019-03-24 23:34:09 +08:00
|
|
|
|
2016-01-15 17:42:22 +08:00
|
|
|
if(OPENCL_LIBRARY)
|
|
|
|
set(HAVE_OPENCL_STATIC ON)
|
|
|
|
set(OPENCL_LIBRARIES "${OPENCL_LIBRARY}")
|
|
|
|
else()
|
|
|
|
set(HAVE_OPENCL_STATIC OFF)
|
|
|
|
endif()
|
|
|
|
|
2013-10-11 23:30:47 +08:00
|
|
|
if(NOT HAVE_OPENCL_STATIC)
|
|
|
|
try_compile(__VALID_OPENCL
|
|
|
|
"${OpenCV_BINARY_DIR}"
|
|
|
|
"${OpenCV_SOURCE_DIR}/cmake/checks/opencl.cpp"
|
|
|
|
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${OPENCL_INCLUDE_DIR}"
|
|
|
|
OUTPUT_VARIABLE TRY_OUT
|
|
|
|
)
|
|
|
|
if(NOT TRY_OUT MATCHES "OpenCL is valid")
|
|
|
|
message(WARNING "Can't use OpenCL")
|
|
|
|
return()
|
|
|
|
endif()
|
2013-03-16 03:29:22 +08:00
|
|
|
endif()
|
|
|
|
|
2016-01-15 17:42:22 +08:00
|
|
|
set(HAVE_OPENCL 1)
|
2013-10-11 23:30:47 +08:00
|
|
|
|
2015-01-02 08:33:40 +08:00
|
|
|
if(WITH_OPENCL_SVM)
|
|
|
|
set(HAVE_OPENCL_SVM 1)
|
|
|
|
endif()
|
|
|
|
|
2013-10-11 23:30:47 +08:00
|
|
|
set(OPENCL_INCLUDE_DIRS ${OPENCL_INCLUDE_DIR})
|
|
|
|
|
2013-03-16 03:29:22 +08:00
|
|
|
if(WITH_OPENCLAMDFFT)
|
|
|
|
find_path(CLAMDFFT_ROOT_DIR
|
|
|
|
NAMES include/clAmdFft.h
|
|
|
|
PATHS ENV CLAMDFFT_PATH ENV ProgramFiles
|
|
|
|
PATH_SUFFIXES clAmdFft AMD/clAmdFft
|
|
|
|
DOC "AMD FFT root directory"
|
|
|
|
NO_DEFAULT_PATH)
|
|
|
|
|
2013-01-15 17:14:14 +08:00
|
|
|
find_path(CLAMDFFT_INCLUDE_DIR
|
2013-03-16 03:29:22 +08:00
|
|
|
NAMES clAmdFft.h
|
|
|
|
HINTS ${CLAMDFFT_ROOT_DIR}
|
|
|
|
PATH_SUFFIXES include
|
|
|
|
DOC "clAmdFft include directory")
|
|
|
|
|
2013-09-15 06:45:02 +08:00
|
|
|
if(CLAMDFFT_INCLUDE_DIR)
|
2013-03-16 03:29:22 +08:00
|
|
|
set(HAVE_CLAMDFFT 1)
|
|
|
|
list(APPEND OPENCL_INCLUDE_DIRS "${CLAMDFFT_INCLUDE_DIR}")
|
2013-01-15 17:14:14 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2013-03-16 03:29:22 +08:00
|
|
|
if(WITH_OPENCLAMDBLAS)
|
|
|
|
find_path(CLAMDBLAS_ROOT_DIR
|
|
|
|
NAMES include/clAmdBlas.h
|
2013-06-13 20:13:46 +08:00
|
|
|
PATHS ENV CLAMDBLAS_PATH ENV ProgramFiles
|
2013-03-16 03:29:22 +08:00
|
|
|
PATH_SUFFIXES clAmdBlas AMD/clAmdBlas
|
|
|
|
DOC "AMD FFT root directory"
|
|
|
|
NO_DEFAULT_PATH)
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2013-03-16 03:29:22 +08:00
|
|
|
find_path(CLAMDBLAS_INCLUDE_DIR
|
|
|
|
NAMES clAmdBlas.h
|
|
|
|
HINTS ${CLAMDBLAS_ROOT_DIR}
|
|
|
|
PATH_SUFFIXES include
|
|
|
|
DOC "clAmdFft include directory")
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-15 06:45:02 +08:00
|
|
|
if(CLAMDBLAS_INCLUDE_DIR)
|
2013-03-16 03:29:22 +08:00
|
|
|
set(HAVE_CLAMDBLAS 1)
|
|
|
|
list(APPEND OPENCL_INCLUDE_DIRS "${CLAMDBLAS_INCLUDE_DIR}")
|
2012-07-17 01:08:14 +08:00
|
|
|
endif()
|
2013-01-15 17:14:14 +08:00
|
|
|
endif()
|
2019-04-11 22:50:15 +08:00
|
|
|
|
|
|
|
# check WITH_OPENCL_D3D11_NV is located in OpenCVDetectDirectX.cmake file
|
|
|
|
|
2012-07-17 01:08:14 +08:00
|
|
|
endif()
|