Update VCPKG#16095
Conversation
| # Move custom module path at the end, so system and VCPKG ones take precedence (particularly findFFmpeg) | ||
| list(POP_FRONT CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") | ||
| list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") | ||
|
|
There was a problem hiding this comment.
This is required because QtMultimedia internally include findFFmpeg but because of Windows and MacOS FS case insensitivity, it defaults to our local module findFFMPEG leading to wrong variable casing: both find the same libraries, but one will set FFMPEG_FOUND, the other one FFmpeg_FOUND
The package name passed to `find_package_handle_standard_args` (FFMPEG)
does not match the name of the calling package (FFmpeg). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
One other fix would be to rename our moduel to match Qt's cases. Toughs?
There was a problem hiding this comment.
Having two files doing the same seems not to be good anyway. With the different naming, we can at least detect, which one was used.
@daschuer What do you think? Should we rename ours to the name Qt expects?
There was a problem hiding this comment.
Solution like that change the standard behavior of cmake and should be avoided IMHO.
The file in question is this one:
https://github.com/qt/qtmultimedia/blob/0c08313895ce2f814281a993c83165c3282f9391/cmake/FindFFmpeg.cmake
There is another file in VCPKG with the upper case spelling:
https://github.com/microsoft/vcpkg/blob/master/ports/ffmpeg/FindFFMPEG.cmake.in
The spelling change has been introduced probably exactly for the same issue, see:
2674fa2
We had similar issue for project where files where provided via cmake directly or from upstream. We solved this by aligning our naming to them. I think it was libsqlite2 and sord, but unsure.
At least after looking around, our upercase spelling seems to be exceptional.
It is common with these find modules to have local and upstream versions. So I don't see an issue with the renaming. But we shall file an upstream issue for VCPKG.
There was a problem hiding this comment.
Solution [that] change the standard behavior of cmake and should be avoided IMHO.
Just a heads up that this not changing the standard behaviour of CMake:
We add "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" early on in the CMAKE_MODULE_PATH, before we import the VCPKG toolchain, so we can import custom behaviour (namely default variable), which are needed before we can handle the VCPKG config and thus the toolchain setup.
If we think there is a strong need not to change the standard behavior of cmake, then I can remove our default variable, and so I will be able to set the path correctly, as we are already doing but after setting up the toolchain.
Also, just to clarify on "the standard behavior of cmake" - here is the documentation for CMAKE_MODULE_PATH
By default it is empty. It is intended to be set by the project.
Please justify why this solution circumvent the standard behavior of cmake
There was a problem hiding this comment.
I went away and rename our module - didn't work. I copied Qt's one to use as our module - didn't work.
It feels like the module path approach is the simplest and most functional.
There was a problem hiding this comment.
We do not follow a aaa-style (almost-always-auto).
This means when in doubt don't use auto. The cases where auto can be used are described explicit.
But again the discussion is probably mood here because you can make the local variable disappear by installing proper error handling which is enforced my [nodiscard] in the new Qt version.
There was a problem hiding this comment.
I assume this was for #16095 (comment)
I have complied with the request now.
| # Normalized DESTINATION paths in install() | ||
| if(POLICY CMP0177) | ||
| cmake_policy(SET CMP0177 NEW) | ||
| endif() | ||
|
|
There was a problem hiding this comment.
AFAIR CMP0177 is new in CMake 3.31.
Before CMake 3.31 OLD was the default, now the default is NEW.
To unify the behaviour, we would need to set OLD - right? Or do I misunderstand the purpose?
| # When downloading the manual. 3.21 is required for installing the | ||
| # ANGLE Dlls via IMPORTED_RUNTIME_ARTIFACTS | ||
| cmake-version: "3.21.x" | ||
| cmake-version: "3.22.x" |
There was a problem hiding this comment.
The comment above need to be adjusted
There was a problem hiding this comment.
Simply increasing the version number is not enough to make the comment apply.
The ANGLE DLLs are no longer the reason for the minimum required version; something else is now. The reason for 3.22 should be described here.
There was a problem hiding this comment.
This is the minim Qt requirement. Should I put this here or just remove it and document it in CMakeFile?
There was a problem hiding this comment.
If the general requirement in CMakeLists.txt is the same, we don't need a comment here. Than CMakeLists.txt is the better place for this information.
| # When downloading the manual. 3.21 is required for installing the | ||
| # ANGLE Dlls via IMPORTED_RUNTIME_ARTIFACTS | ||
| cmake-version: "3.21.x" | ||
| cmake-version: "3.22.x" |
There was a problem hiding this comment.
Here the comment about 3.26.4 is lost. How is the situation now?
| QByteArray contentsBa = contents.toLocal8Bit(); | ||
| ScopedTemporaryFile pFile = std::make_unique<QTemporaryFile>(); | ||
| pFile->open(); | ||
| [[maybe_unused]] auto result = pFile->open(); |
There was a problem hiding this comment.
I thin we shall check her the result, instead of continue n the error case.
The use of auto is not helpful here because we can guess the type.
In general we should never use auto for trivial types like bool here.
There was a problem hiding this comment.
I will add the `DEBUG_assert like for 7afc501
The use of auto is not helpful here because we can guess the type.
I disagree, since we don't care of the type of result. If agree this is relevant if we want to properly handle this, but since this is only solving a compilation policy change rather than a feature change, handling this correctly, and thus needing to know the type is out of scope IMO.
There was a problem hiding this comment.
During the review I looked up the Qt docks to find out what the type is.
We don't use auto just because we don't care about the type.
Here are our rules:
https://github.com/mixxxdj/mixxx/wiki/Coding-Guidelines#auto
You can make the type go away by putting the call into an if statement.
There was a problem hiding this comment.
During the review I looked up the Qt docks to find out what the type is.
I don't see what this have to do with the type.
You would have to look at the doc to confirm the returned value anyway.
Here are our rules:
I cannot see anything about this usecase.
| # Move custom module path at the end, so system and VCPKG ones take precedence (particularly findFFmpeg) | ||
| list(POP_FRONT CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") | ||
| list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") | ||
|
|
There was a problem hiding this comment.
Solution like that change the standard behavior of cmake and should be avoided IMHO.
The file in question is this one:
https://github.com/qt/qtmultimedia/blob/0c08313895ce2f814281a993c83165c3282f9391/cmake/FindFFmpeg.cmake
There is another file in VCPKG with the upper case spelling:
https://github.com/microsoft/vcpkg/blob/master/ports/ffmpeg/FindFFMPEG.cmake.in
The spelling change has been introduced probably exactly for the same issue, see:
2674fa2
We had similar issue for project where files where provided via cmake directly or from upstream. We solved this by aligning our naming to them. I think it was libsqlite2 and sord, but unsure.
At least after looking around, our upercase spelling seems to be exceptional.
It is common with these find modules to have local and upstream versions. So I don't see an issue with the renaming. But we shall file an upstream issue for VCPKG.
884a8b4 to
4880a76
Compare
Add latest version of all Mixxx dependencies