[libjpeg-turbo] Patch vcpkg dependencies for 3.2.0 - #52891
Victor Romero (vicroms) merged 53 commits into
Conversation
|
The static versions are all likely failing due to this problem GPT 5.6 Sol found:
You might also want to fix this other bit it found while you are here but that's not blocking:
|
…static-md since MSVC is not supported
| + find_dependency(PkgConfig) | ||
| + if(PkgConfig_FOUND) | ||
| + pkg_check_modules(spng REQUIRED spng IMPORTED_TARGET) | ||
| + endif() |
There was a problem hiding this comment.
Using imported targets from pkgconfig is complicated for reverse dependencies with MSVC. In other ports we use the variables (and in particular <Prefix>_LINK_LIBRARIES) to get resolved libs instead.
There was a problem hiding this comment.
These patches are generated from upstream libjpeg-turbo commits which will be included in the next libjpeg-turbo release. The patches may therefore be removed from the portfile when an update is available for the next version of libjpeg-turbo.
I've included comments in the portfile referencing the upstream commits used for the patch files.
There was a problem hiding this comment.
That's not true in general. If we see something bogus we can fix bogus and submit the fix for bogus upstream. I agree with Kai Pastor (@dg0yt) and think this is incorrect. Zlib has conventions for how it is found in CMake, and libspng publishes CMake configs: https://github.com/randy408/libspng/blob/adc94393dbeddf9e027d1b2dfff7c1bab975224e/CMakeLists.txt#L65-L81
We should stay entirely in the CMake configs namespace if at all possible and it appears possible here.
There was a problem hiding this comment.
Oh, I see, this is confusing because it's patches on patches. Kai Pastor (@dg0yt) I think your comment is resolved by 0002+0003 in this series.
| + include(FindPkgConfig) | ||
| + pkg_check_modules(spng REQUIRED spng IMPORTED_TARGET) | ||
| + set(SPNG_TARGET_DEFAULT PkgConfig::spng) |
There was a problem hiding this comment.
So this still goes against my "do not use imported targets from pkg-config" advise.
Again, the problem is that it works poorly for top-level projects in Windows because typically there is no pkg-config in the PATH. (It is resolved when building vcpkg ports, but not for top-level projects.)
| + if(SPNG_LIBRARY MATCHES "PkgConfig::") | ||
| + find_dependency(PkgConfig) | ||
| + if(PkgConfig_FOUND) | ||
| + pkg_check_modules(spng REQUIRED spng IMPORTED_TARGET) |
There was a problem hiding this comment.
REQUIRED here breaks optional find_package. This another quirk with pkg-config for transitive dependencies for imported targets.
| libjpeg-turbo is compatible with built-in implementation-agnostic CMake targets: | ||
|
|
||
| find_package(JPEG REQUIRED) | ||
| target_link_libraries(main PRIVATE JPEG::JPEG) | ||
|
|
||
| libjpeg-turbo provides CMake targets for the TurboJPEG C API: | ||
|
|
||
| find_package(libjpeg-turbo CONFIG REQUIRED) | ||
| target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:libjpeg-turbo::turbojpeg>,libjpeg-turbo::turbojpeg,libjpeg-turbo::turbojpeg-static>) |
There was a problem hiding this comment.
When this file is touched, it should re-formatted to align with heuristical output.
| libjpeg-turbo is compatible with built-in implementation-agnostic CMake targets: | |
| find_package(JPEG REQUIRED) | |
| target_link_libraries(main PRIVATE JPEG::JPEG) | |
| libjpeg-turbo provides CMake targets for the TurboJPEG C API: | |
| find_package(libjpeg-turbo CONFIG REQUIRED) | |
| target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:libjpeg-turbo::turbojpeg>,libjpeg-turbo::turbojpeg,libjpeg-turbo::turbojpeg-static>) | |
| libjpeg-turbo is compatible with built-in implementation-agnostic CMake targets: | |
| find_package(JPEG REQUIRED) | |
| target_link_libraries(main PRIVATE JPEG::JPEG) | |
| libjpeg-turbo provides CMake targets for the TurboJPEG C API: | |
| find_package(libjpeg-turbo CONFIG REQUIRED) | |
| target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:libjpeg-turbo::turbojpeg>,libjpeg-turbo::turbojpeg,libjpeg-turbo::turbojpeg-static>) |
| if(CMAKE_VERSION VERSION_LESS 3.12 AND CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
| set(JPEG_LIBRARY "${JPEG_LIBRARY_DEBUG}" CACHE FILEPATH "") | ||
| endif() |
There was a problem hiding this comment.
Since the wrapper is touched: CMake 3.12 is no longer supported when using vcpkg. This (and its usage further down) is obsolete.
|
OK 53510 just landed so you should be able to make both CMake and pkgconfig paths work now |
|
Billy O'Neal (@BillyONeal) Kai Pastor (@dg0yt) I've attempted to address the review comments above. Please let me know if there is more work required to make this mergable. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 75ecd986-b9c4-474e-91e9-36e614aa0c3c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 75ecd986-b9c4-474e-91e9-36e614aa0c3c
Victor Romero (vicroms)
left a comment
There was a problem hiding this comment.
Please merge tartanpaint#4 to fix usage issues.
Fix static pkg-config dependencies
Victor Romero (@vicroms) Thank you! |
./vcpkg x-add-version --alland committing the result.The port file update will use the zlib and libspng dependencies introduced with libjpeg-turbo 3.2.0 from vcpkg rather than building additional copies of these from the libjpeg-turbo source tree.
The libjpeg-turbo patch files have been generated directly from commits in the upstream project repository and may be removed with a port update to a future version of libjpeg-turbo. Related libjpeg-turbo issue: libjpeg-turbo/libjpeg-turbo#901