Skip to content
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

leptonica: fix with_{gif|jpeg|png|tiff|openjpeg|webp}=False #23855

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions recipes/leptonica/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,34 +128,22 @@ def _patch_sources(self):
replace_in_file(self, cmakelists_src, "${GIF_LIBRARIES}", "GIF::GIF")
if not self.options.with_gif:
replace_in_file(self, cmakelists_src, "if (GIF_LIBRARIES)", "if(0)")
if Version(self.version) >= "1.83.0":
replace_in_file(self, cmake_configure, "if(GIF_FOUND)", "if(0)")
else:
replace_in_file(self, cmake_configure, "if (GIF_FOUND)", "if(0)")
replace_in_file(self, cmake_configure, "if (GIF_FOUND)", "if(0)")
## libjpeg
replace_in_file(self, cmakelists_src, "${JPEG_LIBRARIES}", "JPEG::JPEG")
if not self.options.with_jpeg:
replace_in_file(self, cmakelists_src, "if (JPEG_LIBRARIES)", "if(0)")
if Version(self.version) >= "1.83.0":
replace_in_file(self, cmake_configure, "if(JPEG_FOUND)", "if(0)")
else:
replace_in_file(self, cmake_configure, "if (JPEG_FOUND)", "if(0)")
replace_in_file(self, cmake_configure, "if (JPEG_FOUND)", "if(0)")
## libpng
replace_in_file(self, cmakelists_src, "${PNG_LIBRARIES}", "PNG::PNG")
if not self.options.with_png:
replace_in_file(self, cmakelists_src, "if (PNG_LIBRARIES)", "if(0)")
if Version(self.version) >= "1.83.0":
replace_in_file(self, cmake_configure, "if(PNG_FOUND)", "if(0)")
else:
replace_in_file(self, cmake_configure, "if (PNG_FOUND)", "if(0)")
replace_in_file(self, cmake_configure, "if (PNG_FOUND)", "if(0)")
## libtiff
replace_in_file(self, cmakelists_src, "${TIFF_LIBRARIES}", "TIFF::TIFF")
if not self.options.with_tiff:
replace_in_file(self, cmakelists_src, "if (TIFF_LIBRARIES)", "if(0)")
if Version(self.version) >= "1.83.0":
replace_in_file(self, cmake_configure, "if(TIFF_FOUND)", "if(0)")
else:
replace_in_file(self, cmake_configure, "if (TIFF_FOUND)", "if(0)")
replace_in_file(self, cmake_configure, "if (TIFF_FOUND)", "if(0)")
## We have to be more aggressive with dependencies found with pkgconfig
## Injection of libdirs is ensured by conan_basic_setup()
## openjpeg
Expand All @@ -174,7 +162,7 @@ def _patch_sources(self):
else:
replace_in_file(self, cmakelists, "set(JP2K_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIRS})", "set(JP2K_INCLUDE_DIRS ${OpenJPEG_INCLUDE_DIRS})")
if not self.options.with_openjpeg:
replace_in_file(self, cmake_configure, "if(JP2K_FOUND)", "if(0)")
replace_in_file(self, cmake_configure, "if (JP2K_FOUND)", "if(0)")

## libwebp
if Version(self.version) < "1.83.0":
Expand All @@ -185,11 +173,12 @@ def _patch_sources(self):
if not self.options.with_webp:
replace_in_file(self, cmakelists_src, "if (WEBP_FOUND)", "if(0)")
replace_in_file(self, cmake_configure, "if (WEBP_FOUND)", "if(0)")
replace_in_file(self, cmakelists_src,
"if (WEBP_FOUND)",
"if (WEBP_FOUND)\n"
"target_link_directories(leptonica PRIVATE ${WEBP_LIBRARY_DIRS} ${WEBPMUX_LIBRARY_DIRS})\n"
"target_compile_definitions(leptonica PRIVATE ${WEBP_CFLAGS_OTHER} ${WEBPMUX_CFLAGS_OTHER})")
if Version(self.version) >= "1.83.0" or self.options.with_webp:
replace_in_file(self, cmakelists_src,
"if (WEBP_FOUND)",
"if (WEBP_FOUND)\n"
"target_link_directories(leptonica PRIVATE ${WEBP_LIBRARY_DIRS} ${WEBPMUX_LIBRARY_DIRS})\n"
"target_compile_definitions(leptonica PRIVATE ${WEBP_CFLAGS_OTHER} ${WEBPMUX_CFLAGS_OTHER})")
replace_in_file(self, cmakelists_src, "${WEBP_LIBRARIES}", "${WEBP_LIBRARIES} ${WEBPMUX_LIBRARIES}")

# Remove detection of fmemopen() on macOS < 10.13
Expand Down
Loading