KDAB / cxx-qt

Safe interop between Rust and Qt
https://kdab.github.io/cxx-qt/book/
964 stars 66 forks source link

Add private include paths #955

Open akiselev opened 1 month ago

akiselev commented 1 month ago

I'm trying to bind QT Advanced Docking System but i'm getting the following error:

Qt-Advanced-Docking-System/src/ads_globals.cpp:45:10: fatal error: qpa/qplatformnativeinterface.h: No such file or directory
    45 | #include <qpa/qplatformnativeinterface.h>
       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

That header is in QtGui/6.7.0/QtGui/qpa/qplatformnativeinterface.h so I have a very hacky solution below that builds, but it'd be nice to have official support.

let version: qt_build_utils::SemVer = qtbuild.version().clone();
for path in qtbuild.include_paths() {
    let path = path.to_str().unwrap();
    if path.contains("QtGui") {
        cc.include(format!("{}/{}/QtGui", path, version));
    }
}
ahayzen-kdab commented 1 month ago

Thanks for taking the time to report this issue.

So this is a private header, but I believe under CMake this would be part of the QtGui Private target? Eg Qt::GuiPrivate in CMake ?

If so then yes I think we should try to add support for this somewhere, like by having a special case for "Private" in .qt_module so that .qt_module("GuiPrivate") does the right thing.

We'd have to investigate what the Qt CMake code is doing and then match that in qt-build-utils, an initial look appears to suggest this is a folder within the module itself eg /var/home/andrew/.var/Qt/6.5.2/gcc_64/include/QtGui/6.5.2/QtGui/private but i also note that the file you want is not under this private folder and instead under the version /var/home/andrew/.var/Qt/6.5.2/gcc_64/include/QtGui/6.5.2/QtGui/qpa/qplatformnativeinterface.h. So we should see what Qt CMake is doing.