diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5cdc849f02..3c64442263 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1138,14 +1138,13 @@ endif()
if(HAVE_OPENCL)
status("")
- status(" OpenCL:")
if(HAVE_OPENCL_STATIC)
- set(__opencl_ver "static")
+ set(__opencl_type "")
else()
- set(__opencl_ver "dynamic")
+ set(__opencl_type "")
endif()
- status(" Version:" ${__opencl_ver})
- if(OPENCL_INCLUDE_DIR)
+ status(" OpenCL:" ${__opencl_type})
+ if(OPENCL_INCLUDE_DIRS)
status(" Include path:" ${OPENCL_INCLUDE_DIRS})
endif()
if(OPENCL_LIBRARIES)
@@ -1162,7 +1161,7 @@ if(HAVE_OPENCL)
list(APPEND __libs "${l}")
endif()
endforeach()
- status(" libraries:" ${__libs})
+ status(" Link libraries:" ${__libs})
endif()
status(" Use AMDFFT:" HAVE_CLAMDFFT THEN YES ELSE NO)
status(" Use AMDBLAS:" HAVE_CLAMDBLAS THEN YES ELSE NO)
diff --git a/cmake/OpenCVDetectOpenCL.cmake b/cmake/OpenCVDetectOpenCL.cmake
index 67e10ede89..433f244fe6 100644
--- a/cmake/OpenCVDetectOpenCL.cmake
+++ b/cmake/OpenCVDetectOpenCL.cmake
@@ -1,21 +1,21 @@
+set(OPENCL_FOUND ON CACHE BOOL "OpenCL library is found")
if(APPLE)
- set(OPENCL_FOUND YES)
set(OPENCL_LIBRARY "-framework OpenCL" CACHE STRING "OpenCL library")
- set(OPENCL_INCLUDE_DIR "" CACHE STRING "OpenCL include directory")
- mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
- set(HAVE_OPENCL_STATIC ON)
+ set(OPENCL_INCLUDE_DIR "" CACHE PATH "OpenCL include directory")
else(APPLE)
- set(OPENCL_FOUND YES)
- set(HAVE_OPENCL_STATIC OFF)
- set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2")
+ set(OPENCL_LIBRARY "" CACHE STRING "OpenCL library")
+ set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2" CACHE PATH "OpenCL include directory")
endif(APPLE)
-
-if(WINRT)
- set(OPENCL_FOUND NO)
- set(HAVE_OPENCL_STATIC OFF)
-endif(WINRT)
+mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
if(OPENCL_FOUND)
+ if(OPENCL_LIBRARY)
+ set(HAVE_OPENCL_STATIC ON)
+ set(OPENCL_LIBRARIES "${OPENCL_LIBRARY}")
+ else()
+ set(HAVE_OPENCL_STATIC OFF)
+ endif()
+
if(NOT HAVE_OPENCL_STATIC)
try_compile(__VALID_OPENCL
"${OpenCV_BINARY_DIR}"
@@ -29,20 +29,12 @@ if(OPENCL_FOUND)
endif()
endif()
- if(NOT WINRT)
- set(HAVE_OPENCL 1)
- endif()
+ set(HAVE_OPENCL 1)
if(WITH_OPENCL_SVM)
set(HAVE_OPENCL_SVM 1)
endif()
- if(HAVE_OPENCL_STATIC)
- set(OPENCL_LIBRARIES "${OPENCL_LIBRARY}")
- else()
- unset(OPENCL_LIBRARIES)
- endif()
-
set(OPENCL_INCLUDE_DIRS ${OPENCL_INCLUDE_DIR})
if(WITH_OPENCLAMDFFT)
diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake
index 3385385c5f..23a637a25a 100644
--- a/cmake/OpenCVModule.cmake
+++ b/cmake/OpenCVModule.cmake
@@ -701,7 +701,6 @@ macro(ocv_glob_module_sources)
)
if(cl_kernels)
set(OCL_NAME opencl_kernels_${name})
- ocv_include_directories(${OPENCL_INCLUDE_DIRS})
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.hpp"
COMMAND ${CMAKE_COMMAND} "-DMODULE_NAME=${name}" "-DCL_DIR=${CMAKE_CURRENT_LIST_DIR}/src/opencl" "-DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" -P "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake"
diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt
index 44085d4edf..8a68c90289 100644
--- a/modules/core/CMakeLists.txt
+++ b/modules/core/CMakeLists.txt
@@ -27,7 +27,7 @@ source_group("Cuda Headers\\Detail" FILES ${lib_cuda_hdrs_detail})
ocv_glob_module_sources(SOURCES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version_string.inc"
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
-ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS})
+ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS} ${OPENCL_INCLUDE_DIRS})
ocv_create_module(${extra_libs})
ocv_add_accuracy_tests()