Skip to content
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

Support older Qt versions, down to 5.6 #123

Merged
merged 5 commits into from Nov 16, 2020
Merged

Support older Qt versions, down to 5.6 #123

merged 5 commits into from Nov 16, 2020

Conversation

rubdos
Copy link
Contributor

@rubdos rubdos commented Nov 13, 2020

Hi!

I know 5.6 is kinda old (an LTS that has known life from 2016-03-16 until 2019-03-16), but this is still what SailfishOS uses, and will probably be that for a while, until they switch to 5.12 (or hopefully something even more recent).

With the eye on keeping the difference between my qmetaobject-sfos-rs fork and your upstream as small as possible, I'd like to introduce cfg flags on all functionality between 5.6 and 5.most-recent. This should not impact upstream, but should provide me with a way more maintainable set of patches.

I hope this is alright for you folks! If it is, I will start adding the relevant cfg flags to all structs and methods that require them.

TODO:

  • Perhaps update the readme for minimum needed Qt version?
  • git rebase --autosquash
  • Should we annotate the docs of relevant public functions with their respective Qt versions?
  • Rebase my fork and test whether it works!

@rubdos rubdos marked this pull request as draft November 13, 2020 08:55
@bundyo
Copy link

bundyo commented Nov 13, 2020

A bit offtopic - where one can read how to use this fork for SFOS development? I've been waiting a long time for Jolla to upgrade Qt, but this might not happen soon and I have an app to rewrite. :)

@rubdos
Copy link
Contributor Author

rubdos commented Nov 13, 2020

A bit offtopic - where one can read how to use this fork for SFOS development? I've been waiting a long time for Jolla to upgrade Qt, but this might not happen soon and I have an app to rewrite. :)

You happen to be on IRC or Matrix? We can discuss this further on #whisperfish:rubdos.be or freenode #whisperfish if you want. There are more people interested in SFOS+Rust than I imagined before.

I've been using it for Whisperfish, which is nearing beta release. You can read how it's done there, but it's currently extremely ugly (and it doesn't work in the official SDK, so I use some... workarounds). Its ugliness is partially resolved by this PR ;-)

@bundyo
Copy link

bundyo commented Nov 13, 2020

Unfortunately IRC and Matrix are not among my channels, I'm using almost everything else. :) I'll consider Matrix.

@rubdos rubdos marked this pull request as ready for review November 13, 2020 10:33
@rubdos
Copy link
Contributor Author

rubdos commented Nov 13, 2020

Unfortunately IRC and Matrix are not among my channels, I'm using almost everything else. :) I'll consider Matrix.

Feel free to send an email, get in contact on the Sailfish forum, or use the fork's issue tracker at https://gitlab.com/rubdos/qmetaobject-sfos-rs/-/issues/, or Twitter, or ... anything really :-)

qmetaobject/src/qtdeclarative.rs Outdated Show resolved Hide resolved
qmetaobject/src/qtdeclarative.rs Outdated Show resolved Hide resolved
qmetaobject/src/qttypes.rs Show resolved Hide resolved
@rubdos
Copy link
Contributor Author

rubdos commented Nov 15, 2020

8590a14, 0523076, 5b57f5d are related to how simple cpp_build is: it cannot exclude code from compilation merely based on a #[cfg(qt_5_7)] flag; it will instead include everything. That's of course not possible in my case...

@rubdos rubdos force-pushed the qt5.6 branch 2 times, most recently from 239d290 to 5419d84 Compare November 15, 2020 13:36
@rubdos
Copy link
Contributor Author

rubdos commented Nov 15, 2020

Guarding C++ code with cfg() generated by build.rs is sadly impossible, so I've done it a bit hacky (5419d84). Suggestions welcome. I've squashed the other commits, as these were slight fixups, and addressed most other comments.

@ogoffart
Copy link
Member

looks good to me. Could you rebase?

- Inheritance checking is only introduced in Qt5.7
- Add a qmeta_inherits method for Qt < 5.7
cpp_build cannot correctly read `cfg(qt_5_x)` decorators, so we have to
guard the types and calls in another way in C++.
@rubdos
Copy link
Contributor Author

rubdos commented Nov 16, 2020

looks good to me. Could you rebase?

done. I still have some other Sailfish related issues, but I'll do them separate.

@ogoffart ogoffart merged commit 4e74c4e into woboq:master Nov 16, 2020
@ogoffart
Copy link
Member

thanks!

@rubdos rubdos deleted the qt5.6 branch November 16, 2020 13:27
@rubdos
Copy link
Contributor Author

rubdos commented Nov 16, 2020

Seems that my Travis addon points to some other problem, cfr. https://travis-ci.org/github/woboq/qmetaobject-rs/jobs/743931414

diff --git a/qmetaobject/tests/tests.rs b/qmetaobject/tests/tests.rs
index d1a8d9b..8b0acfa 100644
--- a/qmetaobject/tests/tests.rs
+++ b/qmetaobject/tests/tests.rs
@@ -720,6 +720,7 @@ struct MyEnumObject {
     base: qt_base_class!(trait QObject),
 }

+#[cfg(qt_5_7)]
 #[test]
 fn enum_properties() {
     qml_register_enum::<MyEnum>(

should do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants