From b7cfd5a7dad40cc36f729953acf540c9aca6079b Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 11 Jun 2015 15:36:29 +0300 Subject: [PATCH] ocl: added errors processing in OpenCL code generator, resolve space issue --- cmake/OpenCVModule.cmake | 2 +- cmake/cl2cpp.cmake | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index a1a1b90202..62714d92d8 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.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") diff --git a/cmake/cl2cpp.cmake b/cmake/cl2cpp.cmake index 700f12fb5c..c0e211b900 100644 --- a/cmake/cl2cpp.cmake +++ b/cmake/cl2cpp.cmake @@ -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)