From 7cdb0eafeb1f3c8a7241baa4dd9b33000a2e6fc8 Mon Sep 17 00:00:00 2001 From: Hamdi Sahloul Date: Sat, 25 Aug 2018 07:18:33 +0900 Subject: [PATCH] Enable the binding generator to parse shadow files --- modules/python/bindings/CMakeLists.txt | 2 ++ modules/python/src2/gen2.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/python/bindings/CMakeLists.txt b/modules/python/bindings/CMakeLists.txt index 81cf1337b6..dd9caacbf8 100644 --- a/modules/python/bindings/CMakeLists.txt +++ b/modules/python/bindings/CMakeLists.txt @@ -26,6 +26,8 @@ foreach(m ${OPENCV_PYTHON_MODULES}) list(APPEND opencv_hdrs "${hdr}") endif() endforeach() + file(GLOB hdr ${OPENCV_MODULE_${m}_LOCATION}/misc/python/shadow*.hpp) + list(APPEND opencv_hdrs ${hdr}) file(GLOB userdef_hdrs ${OPENCV_MODULE_${m}_LOCATION}/misc/python/pyopencv*.hpp) list(APPEND opencv_userdef_hdrs ${userdef_hdrs}) endforeach(m) diff --git a/modules/python/src2/gen2.py b/modules/python/src2/gen2.py index 78ad36eb6c..040207ea7f 100755 --- a/modules/python/src2/gen2.py +++ b/modules/python/src2/gen2.py @@ -1019,7 +1019,8 @@ class PythonWrapperGenerator(object): decls = self.parser.parse(hdr) if len(decls) == 0: continue - self.code_include.write( '#include "{0}"\n'.format(hdr[hdr.rindex('opencv2/'):]) ) + if hdr.find('opencv2/') >= 0: #Avoid including the shadow files + self.code_include.write( '#include "{0}"\n'.format(hdr[hdr.rindex('opencv2/'):]) ) for decl in decls: name = decl[0] if name.startswith("struct") or name.startswith("class"):