mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
fixed parsing enums with tailing comma
gen2.py reports headers it processes cmake file restructured
This commit is contained in:
parent
964657a155
commit
42ecfc5538
@ -12,24 +12,19 @@ endif()
|
|||||||
|
|
||||||
set(the_description "The python bindings")
|
set(the_description "The python bindings")
|
||||||
|
|
||||||
set(candidate_deps_raw)
|
set(candidate_deps)
|
||||||
foreach(mp ${OPENCV_MODULES_PATH} ${OPENCV_EXTRA_MODULES_PATH})
|
foreach(mp ${OPENCV_MODULES_PATH} ${OPENCV_EXTRA_MODULES_PATH})
|
||||||
file(GLOB names "${mp}/*")
|
file(GLOB names "${mp}/*")
|
||||||
list(APPEND candidate_deps_raw ${names})
|
foreach(m IN LISTS names)
|
||||||
|
if(IS_DIRECTORY ${m})
|
||||||
|
get_filename_component(m ${m} NAME)
|
||||||
|
if (NOT ${m} MATCHES "^cud(a|ev)")
|
||||||
|
list(APPEND candidate_deps "opencv_${m}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach(m)
|
||||||
endforeach(mp)
|
endforeach(mp)
|
||||||
|
|
||||||
set(candidate_deps)
|
|
||||||
foreach(m IN LISTS candidate_deps_raw)
|
|
||||||
if(IS_DIRECTORY ${m})
|
|
||||||
get_filename_component(m ${m} NAME)
|
|
||||||
if (NOT ${m} MATCHES "^cud(a|ev)")
|
|
||||||
if (NOT ${m} MATCHES "optim") # unless we handle namespaces
|
|
||||||
list(APPEND candidate_deps "opencv_${m}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach(m)
|
|
||||||
|
|
||||||
ocv_add_module(python BINDINGS OPTIONAL ${candidate_deps})
|
ocv_add_module(python BINDINGS OPTIONAL ${candidate_deps})
|
||||||
|
|
||||||
ocv_module_include_directories(
|
ocv_module_include_directories(
|
||||||
@ -39,23 +34,26 @@ ocv_module_include_directories(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
set(opencv_hdrs_raw)
|
set(opencv_hdrs_blacklist
|
||||||
foreach(m IN LISTS OPENCV_MODULE_opencv_python_DEPS)
|
".h$"
|
||||||
list(APPEND opencv_hdrs_raw "${OPENCV_MODULE_${m}_HEADERS}")
|
"opencv2/core/cuda"
|
||||||
endforeach(m)
|
"opencv2/objdetect/detection_based_tracker.hpp"
|
||||||
|
"opencv2/optim.hpp")
|
||||||
|
|
||||||
# remove problematic headers
|
|
||||||
set(opencv_hdrs)
|
set(opencv_hdrs)
|
||||||
foreach(hdr IN LISTS opencv_hdrs_raw)
|
foreach(m IN LISTS OPENCV_MODULE_opencv_python_DEPS)
|
||||||
if(NOT ${hdr} MATCHES ".h$")
|
foreach(hdr IN LISTS OPENCV_MODULE_${m}_HEADERS)
|
||||||
if(NOT ${hdr} MATCHES "opencv2/core/cuda")
|
set(good TRUE)
|
||||||
if(NOT ${hdr} MATCHES "opencv2/objdetect/detection_based_tracker.hpp")
|
foreach(s IN LISTS opencv_hdrs_blacklist)
|
||||||
list(APPEND opencv_hdrs ${hdr})
|
if (${hdr} MATCHES ${s})
|
||||||
endif()
|
set(good FALSE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endforeach(s)
|
||||||
endforeach(hdr)
|
if(${good})
|
||||||
|
list(APPEND opencv_hdrs ${hdr})
|
||||||
|
endif()
|
||||||
|
endforeach(hdr)
|
||||||
|
endforeach(m)
|
||||||
|
|
||||||
set(cv2_generated_hdrs
|
set(cv2_generated_hdrs
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
|
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
|
||||||
|
@ -831,6 +831,7 @@ class PythonWrapperGenerator(object):
|
|||||||
|
|
||||||
# step 1: scan the headers and build more descriptive maps of classes, consts, functions
|
# step 1: scan the headers and build more descriptive maps of classes, consts, functions
|
||||||
for hdr in srcfiles:
|
for hdr in srcfiles:
|
||||||
|
print(hdr)
|
||||||
decls = parser.parse(hdr)
|
decls = parser.parse(hdr)
|
||||||
if len(decls) == 0:
|
if len(decls) == 0:
|
||||||
continue
|
continue
|
||||||
|
@ -206,6 +206,8 @@ class CppHeaderParser(object):
|
|||||||
def parse_enum(self, decl_str):
|
def parse_enum(self, decl_str):
|
||||||
l = decl_str
|
l = decl_str
|
||||||
ll = l.split(",")
|
ll = l.split(",")
|
||||||
|
if ll[-1].strip() == "":
|
||||||
|
ll = ll[:-1]
|
||||||
prev_val = ""
|
prev_val = ""
|
||||||
prev_val_delta = -1
|
prev_val_delta = -1
|
||||||
decl = []
|
decl = []
|
||||||
|
Loading…
Reference in New Issue
Block a user