Shiboken - Building bindings with headers in subfolders
-
Greetings!
I'm currently building bindings to a Qt-based library, but I'm running into a problem when it comes to headers being placed in subfolders (but still sharing a single namespace). An example:
The library I'm wrapping contains a number of header files, many of those being placed in subfolders. Take the following
wrappedclasses.h, which is used to feed header files to the Shiboken2 generator:#ifndef WRAPPEDCLASSES_H #define WRAPPEDCLASSES_H #include <../model/file.h> #include <../model/disk.h> #include <../model/filesystem.h> #endif // WRAPPEDCLASSES_HAs you can see, all headers are in the
modeldirectory, which is the base directory for the library (and added to theINCLUDEPATHof my binding's qmake file). Building a binding using these classes works without problems.However, when I add a header file from a subfolder, things get messy. Let's add the
point.hfile from thecommonsubfolder:#ifndef WRAPPEDCLASSES_H #define WRAPPEDCLASSES_H #include <../model/file.h> #include <../model/disk.h> #include <../model/filesystem.h> #include <../model/common/point.h> #endif // WRAPPEDCLASSES_HNow, when I try to build my binding library, the compilation process is aborted because the compiler cannot find
point.h. As it turns out, the wrapper files created by Shiboken2 reference the header file simply aspoint.hinstead ofcommon/point.h, which results in the file not being found:// bje_model_point_wrapper.h, generated by shiboken #ifndef SBK_BJE_MODEL_POINT_H #define SBK_BJE_MODEL_POINT_H #define protected public #include <point.h> // <-- this should be common/point.h #endif // SBK_BJE_MODEL_POINT_HThe project builds when I modify the include paths in the generated files to include the subfolder (as in, replace
point.hwithcommon/point.h), but this is not an option due to the number of files being involved.Is this a known problem with an already existing solution?
-
This looks like something shiboken people should look into, not Qt.
-
Just a couple of things if someone end up here:
- This seems to be a bug in shiboken2 https://bugreports.qt.io/browse/PYSIDE-975
- Visiting #qt-pyside on IRC is faster to reach the devs.
PS: Shiboken people is Qt people, the thing is that most of the people in the forums is not really experience with shiboken nor pyside, that's why IRC is better ;)
-
@sierdzio said in Shiboken - Building bindings with headers in subfolders:
This looks like something shiboken people should look into, not Qt.
To expand on @CristianMaureira's comment that "Shiboken people is Qt people": https://blog.qt.io/blog/2018/05/24/qt-for-python-under-the-hood/
-
Cool, I had no idea, thanks for info.
-
I've contacted the devs using their Gitter and they've been quite helpful. In fact, there's a patch now fixing this problem. Thanks for the help!
-
Hi,
Thanks for the feedback ! Can you post the link to said patch ?