-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Qt6 + ubuntu #4679
Qt6 + ubuntu #4679
Conversation
CMakeLists.txt
Outdated
@@ -1256,7 +1256,12 @@ elseif(UNIX) | |||
endif() | |||
|
|||
# The mixxx executable | |||
add_executable(mixxx WIN32 src/main.cpp) | |||
if(QT7 AND CMAKE_VERSION VERSION_LESS "3.21") |
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.
QT7?
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.
Ups, that is a debug leftover.
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.
I think it is the best to rebase this out.
add_executable(mixxx WIN32 src/main.cpp) | ||
if(QT7 AND CMAKE_VERSION VERSION_LESS "3.21") | ||
find_package(Qt6 REQUIRED COMPONENTS Core) # For Qt Core cmake functions | ||
qt_add_executable(mixxx WIN32 src/main.cpp MANUAL_FINALIZATION) |
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.
Please add a comment that explains why this is necessary.
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.
In my test with cmake 3.16 it was actually not necessary.
It is just mentioned as the counterpart to the required qt-finalize-target which takes care of object order during linking. See https://doc.qt.io/qt-6/qt-finalize-target.html#qt6-finalize-target
So I think it is better to add it and follow the docs.
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.
From the docs I don't see any indication why this is only necessary on cmake < 3.21?
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 especially important if using a statically built Qt or a CMake version earlier than 3.21."
There is also a pending PR that removes the related tests in the QT CI for cmake > 3.21. Unfortunately I do not have saved the link.
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.
I read that too, but in my understanding it means "It's always important, but especially important on CMake < 3.21". So I don't think we should use a version guard here. Less code paths = less chances we run into weird bugs that CI doesn't detect or that we can't reproduce.
I tested it with this patch on CMake 3.22.2 and it works fine:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c7c7743072..f0f31773ea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1265,12 +1265,10 @@ elseif(UNIX)
endif()
# The mixxx executable
-if(QT6 AND CMAKE_VERSION VERSION_LESS "3.21")
+if(QT6)
find_package(Qt6 REQUIRED COMPONENTS Core) # For Qt Core cmake functions
# qt_add_executable() is the recommended initial call for qt_finalize_target()
# below that takes care of the correct object order in the resulting binary
- # According to https://doc.qt.io/qt-6/qt-finalize-target.html it is importand for
- # builds with Qt < 3.21
qt_add_executable(mixxx WIN32 src/main.cpp MANUAL_FINALIZATION)
else()
add_executable(mixxx WIN32 src/main.cpp)
@@ -2208,11 +2206,9 @@ if(QT6)
)
target_link_libraries(mixxx-lib PRIVATE mixxx-qml-mixxxcontrolsplugin)
- if(CMAKE_VERSION VERSION_LESS "3.21")
- # qt_finalize_target takes care that the resources :/mixxx.org/imports/Mixxx/
- # and :/mixxx.org/imports/Mixxx/Controls are placed into beginning of the binary
- qt_finalize_target(mixxx)
- endif()
+ # qt_finalize_target takes care that the resources :/mixxx.org/imports/Mixxx/
+ # and :/mixxx.org/imports/Mixxx/Controls are placed into beginning of the binary
+ qt_finalize_target(mixxx)
endif()
target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT QT_USE_QSTRINGBUILDER)
Done |
CMakeLists.txt
Outdated
add_executable(mixxx WIN32 src/main.cpp) | ||
if(QT6 AND CMAKE_VERSION VERSION_LESS "3.21") | ||
find_package(Qt6 REQUIRED COMPONENTS Core) # For Qt Core cmake functions | ||
# qt_add_executable() is the recomendet initial call for qt_finalize_target() |
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.
typo
# qt_add_executable() is the recomendet initial call for qt_finalize_target() | |
# qt_add_executable() is the recomended initial call for qt_finalize_target() |
I get a bunch of this warning on my system for
|
Regarding CMP0099, Qt deals with it if available and works around if it is not, so we can safely enable it since the old behavior is deprecated. |
CMakeLists.txt
Outdated
@@ -25,6 +25,14 @@ if(POLICY CMP0071) | |||
cmake_policy(SET CMP0071 NEW) | |||
endif() | |||
|
|||
# propagate interface link properties | |||
if(POLICY CMP0099) | |||
# this avoids a warning when qt deals with it see |
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.
Deals with what?
CMakeLists.txt
Outdated
@@ -2178,7 +2194,7 @@ if(QT6) | |||
URI Mixxx.Controls | |||
VERSION 0.1 | |||
RESOURCE_PREFIX /mixxx.org/imports | |||
OPTIONAL_IMPORTS Mixxx | |||
IMPORTS Mixxx |
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 looks wrong, not every type in that module imports Mixxx
. Also, why is this even part of this PR? It's not necessary to fix Mixxx on Ubuntu, right?
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.
It was necessary at one point during debugging. Now it still works even if I ommit the line entirely so it can be reverted.
add_executable(mixxx WIN32 src/main.cpp) | ||
if(QT7 AND CMAKE_VERSION VERSION_LESS "3.21") | ||
find_package(Qt6 REQUIRED COMPONENTS Core) # For Qt Core cmake functions | ||
qt_add_executable(mixxx WIN32 src/main.cpp MANUAL_FINALIZATION) |
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.
From the docs I don't see any indication why this is only necessary on cmake < 3.21?
Done. |
works on my machine, thanks! |
… if it is really no longer required with cmake >= 3.21
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, thank you. Waiting for CI.
This allows to build and run Mixxx on Ubuntu using https://launchpad.net/~daschuer/+archive/ubuntu/qt6-backports
The main issue was that CMake < 3.21 requires to use qt_finalize_target(mixxx) to ensure that the resources are all linked at the beginning of the mixxx binary.