Merge pull request #4114 from alalek:ocl_generator_error_processing

This commit is contained in:
Vadim Pisarevsky 2015-06-17 11:26:53 +00:00
commit 220bb14d10
2 changed files with 9 additions and 1 deletions

View File

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

View File

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