Merge pull request #5976 from alalek:fix_cmake_opencl

pull/5981/head
Alexander Alekhin 9 years ago
commit ec1e1c6fe9
  1. 11
      CMakeLists.txt
  2. 34
      cmake/OpenCVDetectOpenCL.cmake
  3. 1
      cmake/OpenCVModule.cmake
  4. 2
      modules/core/CMakeLists.txt

@ -1138,14 +1138,13 @@ endif()
if(HAVE_OPENCL)
status("")
status(" OpenCL:")
if(HAVE_OPENCL_STATIC)
set(__opencl_ver "static")
set(__opencl_type "<Link with OpenCL library>")
else()
set(__opencl_ver "dynamic")
set(__opencl_type "<Dynamic loading of OpenCL library>")
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)

@ -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)

@ -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"

@ -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()

Loading…
Cancel
Save