ocl: added errors processing in OpenCL code generator, resolve space issue

pull/4114/head
Alexander Alekhin 10 years ago
parent 424c2bddb3
commit b7cfd5a7da
  1. 2
      cmake/OpenCVModule.cmake
  2. 8
      cmake/cl2cpp.cmake

@ -662,7 +662,7 @@ macro(ocv_glob_module_sources)
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"
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"
DEPENDS ${cl_kernels} "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake")
ocv_source_group("Src\\opencl\\kernels" FILES ${cl_kernels})
ocv_source_group("Src\\opencl\\kernels\\autogenerated" FILES "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.hpp")

@ -1,6 +1,14 @@
if (NOT EXISTS "${CL_DIR}")
message(FATAL_ERROR "Specified wrong OpenCL kernels directory: ${CL_DIR}")
endif()
file(GLOB cl_list "${CL_DIR}/*.cl" )
list(SORT cl_list)
if (NOT cl_list)
message(FATAL_ERROR "Can't find OpenCL kernels in directory: ${CL_DIR}")
endif()
string(REPLACE ".cpp" ".hpp" OUTPUT_HPP "${OUTPUT}")
get_filename_component(OUTPUT_HPP_NAME "${OUTPUT_HPP}" NAME)

Loading…
Cancel
Save