-
Notifications
You must be signed in to change notification settings - Fork 80
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
register QML elements at build time #428
Conversation
8fd1360
to
bd9019b
Compare
The trick to getting static QML plugin registration working with the Unfortunately this only works when Cargo links the executable though. CMake has an analogous WHOLE_ARCHIVE feature, but when I tried to use it like:
linking failed because the static library includes duplicate symbols:
If there was a way to somehow pass the path of the |
c0ead97
to
8e72555
Compare
It turns out the duplicate symbol errors before were because some C++ files were getting compiled twice and linked twice. 🙃 So it is possible to link with Somehow this caused #110 to affect a few more tests on macOS 🤷 It also triggers what seems to be a bug in valgrind in a few tests on Ubuntu, which I can't reproduce locally on Fedora 37. |
Thanks for shaving this yak, this is really impressive! 🦀 Ironically, cxx-qt is now even better than the official Qt cmake API, as this is now also working for Qt5. 🎉 (i.e. at least the fully declarative type declaration, not sure if qmltc and qmlsc will also be possible) |
Checking for the presence of the qmltc executable and using it conditionally would be easy. qmlcachegen exists with Qt5 as well. |
a0acc8f
to
bcac4ed
Compare
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.
A few more cleanups to be done, but overall approach is good! 👍
We can finally claim that you don't need C++ anymore 🥳
fea483d
to
b0ebd28
Compare
by specifying [cxxqt::qobject(qml_uri = "foo.bar", qml_verison = "1.0")] Fixes KDAB#241
to avoid C++ symbol name collisions if more than one qrc file is used
so rust-analyzer can make use of the error during macro expansion
I'd like to add a C++ generation test in cxx-qt-gen, but I don't see how to write the output files? Is there a tool for this somewhere that I'm missing? |
No, unfortunately not, the easiest way is to start with an empty file, which is gonna give you the complete diff to what is currently being generated. We should probably work on such a tool at some point though, that just updates the test_output files. |
How about adding that in another PR? |
Of course, shouldn't be part of this PR. |
Ready to merge then? |
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.
LGTM, how about @vimpostor ?
Follow up to KDAB#428
Follow up to KDAB#428
Follow up to KDAB#428
Follow up to KDAB#428
Follow up to KDAB#428
by specifying
#[cxxqt::qobject(qml_uri = "foo.bar", qml_verison = "1.0")]
TODO: