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

Make qCoro usable on platforms with missing features #44

Closed
wants to merge 1 commit into from

Conversation

rgriebl
Copy link

@rgriebl rgriebl commented Jan 26, 2022

  • iOS has no QProcess
  • Android has no QtDBus library

* iOS has no QProcess
* Android has no QtDBus library
@github-actions
Copy link
Contributor

Unit Test Results

  6 files  ±0    6 suites  ±0   2m 43s ⏱️ ±0s
13 tests ±0  13 ✔️ ±0  0 💤 ±0  0 ±0 
74 runs  ±0  74 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 2d6b2b0. ± Comparison against base commit c56c7d5.

@rgriebl
Copy link
Author

rgriebl commented Jan 26, 2022

Just to give a bit more context: I'm not using qCoro as is with its cmake build system, but rather have a copy in my project that gets built via qmake (https://github.com/rgriebl/brickstore/blob/main/3rdparty/qcoro.pri)

Here's the GH actions matrix I use to build for Win32/64, Linux, macOS, iOS and Android: https://github.com/rgriebl/brickstore/blob/main/.github/workflows/build_qmake.yml

Copy link
Owner

@danvratil danvratil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think to fix this properly, we need to rethink feature detection at configuration time and

  1. (not) compile files with unsupported features at all
  2. add compiler definitions regarding what's supported by QCoro to config.h
  3. conditionally disable code in QCoro based on those definitions

This is a larger change, and probably needs a more complex CI matrix.

If you can confirm that this change is enough to unbreak QCoro on iOS (I'm suspicious regarding the QCoroProcess thing, see the other review comment), I'm fine with merging this now and I'll plan some time to work on the larger config update.

UPDATE: now I see that in your qmake code you already build qcoroprocess.cpp conditionally, which is likely why this change is indeed enough for you as it is. So I'd say let's merge this change now and I'll add proper support for feature detection later. It won't make iOS supported by the CMake build out of the box, but it won't break anything either ;-)

Comment on lines +9 to +11
#if !QT_CONFIG(process)
# include "qcoroprocess.h"
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't unbreak QCoro build, though, right? There's still qcoroprocess.cpp that will get compiled (and fail), even if QProcess is not supported by Qt.

I also think the proper fix is to follow what Qt does and instead conditionally disable all problematic code (in thise case the whole QCoroProcess class) in the qcoroprocess.h header.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, tested against both Qt5 and Qt6

Comment on lines +11 to +13
#if defined(QT_DBUS_LIB)
# include "qcorodbus.h"
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably take into account QCORO_WITH_QTDBUS and, since in theory this will make the header unusable when QCoro is built without DBus, even if Qt has DBus support.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - you are right. Adding this to cmake shouldn't be a big deal though: just check for if (TARGET Qt::DBus)

@danvratil danvratil mentioned this pull request Jan 26, 2022
8 tasks
@rgriebl
Copy link
Author

rgriebl commented Jan 26, 2022

BTW: ios + c++20 + cmake is broken in Qt 6 at the moment: https://bugreports.qt.io/browse/QTBUG-100246

@rgriebl
Copy link
Author

rgriebl commented Feb 22, 2023

This one here is outdated. Closing in favor of #153

@rgriebl rgriebl closed this Feb 22, 2023
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

2 participants