CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
feat: add conditional inclusion support to header parser #27325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add conditional inclusion support to header parser #27325
Conversation
2392492
to
4a93fbd
Compare
4a93fbd
to
d32123c
Compare
Thank you. This patch resolves both mentioned issues. For #10175 if
|
4d8c249
to
4b68d2c
Compare
4b68d2c
to
6ac0816
Compare
6ac0816
to
b3e17ea
Compare
@mshabunin @opencv-alalek could you take a look too? |
"Failed to evaluate '{}' directive, stripped down to '{}'".format( | ||
input_directive, directive | ||
) | ||
) from e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check failed build https://pullrequest.opencv.org/buildbot/builders/precommit_windows64/builds/109668/steps/compile%20release/logs/stdio:
Traceback (most recent call last):
File "C:/build/precommit_windows64/4.x/opencv/modules/java/generator/../generator/gen_java.py", line 1422, in <module>
import hdr_parser
File "C:\build\precommit_windows64\4.x\opencv\modules\python\src2\hdr_parser.py", line 154
) from e
^
SyntaxError: invalid syntax
opencv_gapi_SSE4_1.vcxproj -> C:\build\precommit_windows64\build\modules\gapi\opencv_gapi_SSE4_1.dir\Release\opencv_gapi_SSE4_1.lib
Generate files for Python bindings and documentation
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\build\precommit_windows64\build\modules\java_bindings_generator\gen_opencv_java_source.vcxproj]
Traceback (most recent call last):
File "C:/build/precommit_windows64/4.x/opencv/modules/python/src2/gen2.py", line 4, in <module>
import hdr_parser, sys, re
File "C:\build\precommit_windows64\4.x\opencv\modules\python\src2\hdr_parser.py", line 154
) from e
^
SyntaxError: invalid syntax
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It requires Python update. I notified Alexander about it.
Thanks for the patch, that really helps. I have a different build system though (blaze) so I generate the binding files in CMake and then include them in blaze which works fine. Some users might need DNN in the bindings, others might not (typically, Java and Android Java) and one header for both is easier. Would the following be possible: keep your patch but keep the guards in the bindings instead of removing the guarded sections. This way, the binding headers would be usable for different configurations (e.g. with or without HAVE_OPENCV_DNN being defined). |
Thank you for suggestion. Your approach requires significant changes in header parser and all bindings generators, because "availability information" should be a part of "function/enum/class/struct" definition. We can consider doing it once we begin reworking the header parser, updating intermediate representation and unifying all bindings generation. |
Brings support for conditional inclusion directives evaluation and proper
#if
/#else
/#elif
branches support.Generated diffs are attached:
cv::Feature2D
has a valid base class now, because#else
is not discardedBuild warning is resolved:
Related diff in
pyopencv_generated_types.h
Duplicate for
cv::RotationWarper::warpPointBackward
is removed from function dispatch.Related diff in
pyopencv_generated_types_content.h
Before
After
Closes #27064
Closes #10175
Closes #12972
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.