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
Add the option to build with Qt 6 #4929
Conversation
Built with Qt 5 here, #4908 updated with this commit to build with Qt 6. |
You probably want to avoid the whole code duplication and rather have a variable called |
if (USE_QT6) | ||
if (APPLE AND EXISTS /usr/local/opt/qt@6) | ||
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt@6") | ||
endif() | ||
if (APPLE AND EXISTS /opt/homebrew/opt/qt@6) | ||
list(APPEND CMAKE_PREFIX_PATH "/opt/homebrew/opt/qt@6") | ||
endif() | ||
else() | ||
if (APPLE AND EXISTS /usr/local/opt/qt@5) | ||
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt@5") | ||
endif() | ||
if (APPLE AND EXISTS /opt/homebrew/opt/qt@5) | ||
list(APPEND CMAKE_PREFIX_PATH "/opt/homebrew/opt/qt@5") | ||
endif() |
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.
This is getting a bit messy - do you think there's a way of moving this out of the main CMakeLists file?
Same goes for the Qt5 vs. Qt6 logic. Perhaps a separate macro which deals with the details without making the main CMakeLists file so messy?
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.
No doubt that part could be moved out to a module and included, although it is relatively small compared to the entire file (especially when only one version of Qt is supported).
I agree with both of you it ain't pretty. But it isn't all duplication like this, there are some sections which are different, making anything cleaner a more complex proposition. Plus my take was that this is about a managed switch to Qt 6, not maintaining support for both 5 & 6. (I am biased, I have uninstalled Qt 5 completely and don't use a gamepad). Meaning that the Qt 5 code will be deleted and then we are back to the current state, with a few updates. But it is also because I am not a CMake expert, so I'm not sure exactly sure what it would look like.
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.
ok, let's defer this until we have both Qt5+6 working and have a better picture
FYI: I managed to build this on macOS - looks good so far |
@cjmayo If you rebase this to master, it should build on macOS too. |
With CMAKE_OSX_DEPLOYMENT_TARGET=10.14 and Qt 6.6.2: /usr/local/include/QtCore/qfile.h:59:58: error: 'path' is unavailable: introduced in macOS 10.15 /usr/local/include/QtCore/qfile.h:64:40: error: 'native' is unavailable: introduced in macOS 10.15
Rebased on master. Good to know it actually runs on Qt 6 and doesn't just build. On Linux can't say I've noticed any difference. |
We can probably merge this soon. I'll do a more proper review, and update #4909 accordingly |
I've tried to do this in the way that makes it easiest to remove Qt 5 down the line.
For now there is no gamepad support with Qt 6.