Merge pull request #19000 from alalek:cmake_fix_order_of_bindings_generators

This commit is contained in:
Alexander Alekhin 2020-12-03 18:08:40 +00:00
commit 84a3654371
2 changed files with 11 additions and 12 deletions

View File

@ -98,15 +98,6 @@ macro(ocv_add_dependencies full_modname)
endforeach()
unset(__depsvar)
# hack for python
set(__python_idx)
list(FIND OPENCV_MODULE_${full_modname}_WRAPPERS "python" __python_idx)
if (NOT __python_idx EQUAL -1)
list(REMOVE_ITEM OPENCV_MODULE_${full_modname}_WRAPPERS "python")
list(APPEND OPENCV_MODULE_${full_modname}_WRAPPERS "python_bindings_generator" "python2" "python3")
endif()
unset(__python_idx)
ocv_list_unique(OPENCV_MODULE_${full_modname}_REQ_DEPS)
ocv_list_unique(OPENCV_MODULE_${full_modname}_OPT_DEPS)
ocv_list_unique(OPENCV_MODULE_${full_modname}_PRIVATE_REQ_DEPS)
@ -209,9 +200,17 @@ macro(ocv_add_module _name)
set(OPENCV_MODULES_DISABLED_USER ${OPENCV_MODULES_DISABLED_USER} "${the_module}" CACHE INTERNAL "List of OpenCV modules explicitly disabled by user")
endif()
# add reverse wrapper dependencies
# add reverse wrapper dependencies (BINDINDS)
foreach (wrapper ${OPENCV_MODULE_${the_module}_WRAPPERS})
ocv_add_dependencies(opencv_${wrapper} OPTIONAL ${the_module})
if(wrapper STREQUAL "python") # hack for python (BINDINDS)
ocv_add_dependencies(opencv_python2 OPTIONAL ${the_module})
ocv_add_dependencies(opencv_python3 OPTIONAL ${the_module})
else()
ocv_add_dependencies(opencv_${wrapper} OPTIONAL ${the_module})
endif()
if(DEFINED OPENCV_MODULE_opencv_${wrapper}_bindings_generator_CLASS)
ocv_add_dependencies(opencv_${wrapper}_bindings_generator OPTIONAL ${the_module})
endif()
endforeach()
# stop processing of current file

View File

@ -11,7 +11,7 @@ set(PYTHON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../")
# get list of modules to wrap
set(OPENCV_PYTHON_MODULES)
foreach(m ${OPENCV_MODULES_BUILD})
if (";${OPENCV_MODULE_${m}_WRAPPERS};" MATCHES ";${MODULE_NAME};" AND HAVE_${m})
if (";${OPENCV_MODULE_${m}_WRAPPERS};" MATCHES ";python;" AND HAVE_${m})
list(APPEND OPENCV_PYTHON_MODULES ${m})
#message(STATUS "\t${m}")
endif()