mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
dnn: make OpenCL DNN code optional
This commit is contained in:
@@ -747,7 +747,7 @@ endmacro()
|
||||
|
||||
# finds and sets headers and sources for the standard OpenCV module
|
||||
# Usage:
|
||||
# ocv_glob_module_sources([EXCLUDE_CUDA] <extra sources&headers in the same format as used in ocv_set_module_sources>)
|
||||
# ocv_glob_module_sources([EXCLUDE_CUDA] [EXCLUDE_OPENCL] <extra sources&headers in the same format as used in ocv_set_module_sources>)
|
||||
macro(ocv_glob_module_sources)
|
||||
ocv_debug_message("ocv_glob_module_sources(" ${ARGN} ")")
|
||||
set(_argn ${ARGN})
|
||||
@@ -755,6 +755,10 @@ macro(ocv_glob_module_sources)
|
||||
if(NOT exclude_cuda EQUAL -1)
|
||||
list(REMOVE_AT _argn ${exclude_cuda})
|
||||
endif()
|
||||
list(FIND _argn "EXCLUDE_OPENCL" exclude_opencl)
|
||||
if(NOT exclude_opencl EQUAL -1)
|
||||
list(REMOVE_AT _argn ${exclude_opencl})
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE lib_srcs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/*.cpp"
|
||||
@@ -801,7 +805,7 @@ macro(ocv_glob_module_sources)
|
||||
file(GLOB cl_kernels
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/opencl/*.cl"
|
||||
)
|
||||
if(cl_kernels)
|
||||
if(cl_kernels AND exclude_opencl EQUAL -1)
|
||||
set(OCL_NAME opencl_kernels_${name})
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" # don't add .hpp file here to optimize build process
|
||||
|
||||
Reference in New Issue
Block a user