[leptonica]Add dependency port libwebp and fix find libwebp in debug/release (#7712)

* [leptonica]Add dependency port libwebp and fix find libwebp in debug/release.

* [leptonica]Add dependency to LeptonicaConfig.cmake.

* [leptonica]Re-fix find libwebp.
This commit is contained in:
JackBoosY 2019-08-22 05:01:57 +08:00 committed by Victor Romero
parent ec3060c73f
commit 34a26540b1
4 changed files with 42 additions and 28 deletions

View File

@ -1,5 +1,5 @@
Source: leptonica
Version: 1.78.0
Version: 1.78.0-1
Homepage: https://github.com/DanBloomberg/leptonica
Description: An open source library containing software that is broadly useful for image processing and image analysis applications
Build-Depends: libjpeg-turbo, zlib, libpng, tiff, giflib
Build-Depends: libjpeg-turbo, zlib, libpng, tiff, giflib, libwebp

View File

@ -1,18 +1,19 @@
diff --git a/cmake/templates/LeptonicaConfig.cmake.in b/cmake/templates/LeptonicaConfig.cmake.in
index d53904a..2aa2fea 100644
--- a/cmake/templates/LeptonicaConfig.cmake.in
+++ b/cmake/templates/LeptonicaConfig.cmake.in
@@ -20,6 +20,13 @@
#
# ===================================================================================
+include(CMakeFindDependencyMacro)
+find_dependency(TIFF)
+find_dependency(ZLIB)
+find_dependency(PNG)
+find_dependency(JPEG)
+find_dependency(GIF)
+
include(${CMAKE_CURRENT_LIST_DIR}/LeptonicaTargets.cmake)
# ======================================================
diff --git a/cmake/templates/LeptonicaConfig.cmake.in b/cmake/templates/LeptonicaConfig.cmake.in
index 4f7527a..c6759d1 100644
--- a/cmake/templates/LeptonicaConfig.cmake.in
+++ b/cmake/templates/LeptonicaConfig.cmake.in
@@ -20,6 +20,14 @@
#
# ===================================================================================
+include(CMakeFindDependencyMacro)
+find_dependency(TIFF)
+find_dependency(ZLIB)
+find_dependency(PNG)
+find_dependency(JPEG)
+find_dependency(GIF)
+find_dependency(WebP)
+
include(${CMAKE_CURRENT_LIST_DIR}/LeptonicaTargets.cmake)
# ======================================================

View File

@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index debc232..2aa2d3a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,8 +60,7 @@ if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.cppan)
endif()
if(NOT WEBP)
message(STATUS "Looking for WEBP")
- find_path(WEBP_INCLUDE_DIR /webp/decode.h)
- find_library(WEBP_LIBRARY NAMES webp)
+ find_package(WebP CONFIG REQUIRED)
if (WEBP_INCLUDE_DIR AND WEBP_LIBRARY)
set(WEBP 1)
set(WEBP_FOUND TRUE)

View File

@ -3,13 +3,14 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO DanBloomberg/leptonica
REF 87b8219360bca3c9929a5705c3d9c50c42c34bca
REF 87b8219360bca3c9929a5705c3d9c50c42c34bca #1.78.0
SHA512 b7bfa9437be7e3d9276acacf8f62ccda1cd8f88741ada5106ef0232d4965617be2c5d0b8a6b4462896a1a0b6b44d9ecefd6e6b8d0e50d4fb881bdf5e821703a4
HEAD_REF master
PATCHES
${CMAKE_CURRENT_LIST_DIR}/fix-cmakelists.patch
${CMAKE_CURRENT_LIST_DIR}/use-tiff-libraries.patch
${CMAKE_CURRENT_LIST_DIR}/find-dependency.patch
fix-cmakelists.patch
use-tiff-libraries.patch
find-dependency.patch
fix-find-libwebp.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" STATIC)
@ -29,9 +30,7 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
# Handle copyright
file(COPY ${SOURCE_PATH}/leptonica-license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/leptonica)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/leptonica/leptonica-license.txt ${CURRENT_PACKAGES_DIR}/share/leptonica/copyright)
file(COPY ${SOURCE_PATH}/leptonica-license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/leptonica-license.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)