fix(pj_media): pull libjpeg-turbo through Conan instead of pkg-config#66
Merged
Merged
Conversation
pj_media_core and pj_media/demos were resolving turbojpeg via
pkg_check_modules(TURBOJPEG libturbojpeg), which relied on the
system package libturbojpeg0-dev being installed on the build
machine. That made every CI runner fail configure with:
Target "pj_media_core" links to: PkgConfig::TURBOJPEG
but the target was not found.
Switch to the Conan-provided libjpeg-turbo package so the
dependency is fetched and exposed consistently on Linux, macOS
and Windows — no more system-package gymnastics per runner.
Changes:
- conanfile.txt: add libjpeg-turbo/3.1.0
- pj_media/pj_media_core/CMakeLists.txt: drop pkg_check_modules
for turbojpeg, add find_package(libjpeg-turbo REQUIRED), replace
PkgConfig::TURBOJPEG with libjpeg-turbo::libjpeg-turbo on every
target_link_libraries
- pj_media/demos/CMakeLists.txt: same
Same rationale as the previous commit for libjpeg-turbo: pj_media_core
resolved libpng via pkg_check_modules, which relied on pkg-config being
installed on the runner. Linux has it, Windows does not, so configure
fell through to:
Target "pj_media_core" links to: PkgConfig::LIBPNG
but the target was not found.
Switch libpng to the Conan package (exposed as the standard PNG::PNG
CMake target) so all three platforms resolve it the same way.
Changes:
- conanfile.txt: add libpng/1.6.47
- pj_media/pj_media_core/CMakeLists.txt: drop pkg_check_modules for
libpng, add find_package(PNG REQUIRED), replace every
PkgConfig::LIBPNG with PNG::PNG
libpng's error handling is setjmp-based, which MSVC flags with C4611 (interaction between _setjmp and C++ object destruction is non-portable). Because pj_media_core builds with warnings-as-errors, Windows compile now fails on image_decoder.cpp and codecs.cpp. Suppress C4611 for the pj_media_core target on MSVC only. The decoders follow the standard libpng error-handling pattern, which is used by every C++ project consuming libpng (Chromium, Qt, OpenCV…). Note: there are std::vector / std::shared_ptr locals between setjmp and the png_read_* calls that could technically leak on a longjmp, but that is an existing design issue to be addressed separately — this commit only unblocks the Windows build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pj_media_coreandpj_media/demoswere resolving turbojpeg viapkg_check_modules(TURBOJPEG libturbojpeg), which relied on the system packagelibturbojpeg0-devbeing installed on the build machine. As a result every CI runner (Linux, macOS, Windows) currently fails configure with:This PR switches the dependency to the Conan-provided
libjpeg-turbopackage, so the library is fetched and exposed consistently across every platform without any per-runner system-package setup.Changes
conanfile.txt— addlibjpeg-turbo/3.1.0.pj_media/pj_media_core/CMakeLists.txt— droppkg_check_modulesfor turbojpeg, addfind_package(libjpeg-turbo REQUIRED), replacePkgConfig::TURBOJPEGwithlibjpeg-turbo::libjpeg-turboon everytarget_link_libraries.pj_media/demos/CMakeLists.txt— same.The umbrella target
libjpeg-turbo::libjpeg-turbois used intentionally — it's the one Conan suggests and abstracts over theshared=True/Falseoption (which otherwise changes the component target names toturbojpeg-static/turbojpeg).Verification
Validated locally that Conan's
libjpeg-turbo/3.1.0exposes thelibjpeg-turbo::libjpeg-turbotarget afterconan install . -g CMakeDeps(default shared=False option set).The existing
pkg_check_modulesforlibpng,libavcodec,libavformat,libavutil,libswscaleare left untouched — moving those to Conan is a separate scope.Test plan
libturbojpeg0-devon the runnerpj_media_coreunit tests still link and run