[tesseract] update to 5.2.0 (#26114)

* [tesseract] update to 5.2.0

* x-add-version

* fix windows build error

* version

* fix opencv4 build error

* version

* conflict

* version

* fix opencv build error on uwp

* version

* fix linux build error

* version

* fix

* version

* version
This commit is contained in:
Lily Wang 2022-08-15 11:57:44 -07:00 committed by GitHub
parent 69296c17df
commit 69e4d02ce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 69 additions and 43 deletions

View File

@ -0,0 +1,13 @@
diff --git a/modules/text/cmake/init.cmake b/modules/text/cmake/init.cmake
index 254757e..73194ec 100644
--- a/modules/text/cmake/init.cmake
+++ b/modules/text/cmake/init.cmake
@@ -4,6 +4,8 @@ OCV_OPTION(WITH_TESSERACT "Include Tesseract OCR library support" (NOT CMAKE_CRO
if(NOT HAVE_TESSERACT
AND (WITH_TESSERACT OR OPENCV_FIND_TESSERACT)
)
+ find_package(Tesseract CONFIG REQUIRED)
+ set(Tesseract_LIBRARIES Tesseract::libtesseract)
if(NOT Tesseract_FOUND)
find_package(Tesseract QUIET) # Prefer CMake's standard locations (including Tesseract_DIR)
endif()

View File

@ -177,6 +177,7 @@ if("contrib" IN_LIST FEATURES)
0013-fix-ceres.patch 0013-fix-ceres.patch
0014-fix-ogre.patch 0014-fix-ogre.patch
0016-fix-freetype-contrib.patch 0016-fix-freetype-contrib.patch
0018-fix-depend-tesseract.patch
) )
set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules") set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules")
@ -352,6 +353,12 @@ if("qt" IN_LIST FEATURES)
list(APPEND ADDITIONAL_BUILD_FLAGS "-DCMAKE_AUTOMOC=ON") list(APPEND ADDITIONAL_BUILD_FLAGS "-DCMAKE_AUTOMOC=ON")
endif() endif()
if("contrib" IN_LIST FEATURES)
if(VCPKG_TARGET_IS_UWP)
list(APPEND ADDITIONAL_BUILD_FLAGS "-DWITH_TESSERACT=OFF")
endif()
endif()
vcpkg_cmake_configure( vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}" SOURCE_PATH "${SOURCE_PATH}"
OPTIONS OPTIONS

View File

@ -1,6 +1,7 @@
{ {
"name": "opencv4", "name": "opencv4",
"version": "4.6.0", "version": "4.6.0",
"port-version": 1,
"description": "computer vision library", "description": "computer vision library",
"homepage": "https://github.com/opencv/opencv", "homepage": "https://github.com/opencv/opencv",
"license": "Apache-2.0", "license": "Apache-2.0",

View File

@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd2649d..f932913 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -792,7 +792,8 @@ if(OpenCL_FOUND)
target_link_libraries(libtesseract PUBLIC OpenCL::OpenCL)
endif()
if(LibArchive_FOUND)
- target_link_libraries(libtesseract PUBLIC ${LibArchive_LIBRARIES})
+ find_package(LibArchive REQUIRED)
+ target_link_libraries(libtesseract PRIVATE LibArchive::LibArchive)
endif(LibArchive_FOUND)
if(CURL_FOUND)
if(NOT CURL_LIBRARIES)

View File

@ -1,13 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f154663..c07b827 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -431,7 +431,7 @@ endif()
add_executable (tesseract ${tesseractmain_src} ${tesseractmain_rsc})
target_link_libraries (tesseract libtesseract)
if (HAVE_TIFFIO_H)
- target_link_libraries(tesseract tiff)
+ target_link_libraries(tesseract TIFF::TIFF)
endif()
if (OPENMP_BUILD AND UNIX)

View File

@ -1,14 +0,0 @@
diff --git a/src/ccutil/ocrclass.h b/src/ccutil/ocrclass.h
index d39a6dd..3755632 100644
--- a/src/ccutil/ocrclass.h
+++ b/src/ccutil/ocrclass.h
@@ -28,6 +28,9 @@
#include <chrono>
#include <ctime>
+#ifndef _WIN32
+#include <sys/time.h>
+#endif
#ifdef _WIN32
#include <winsock2.h> // for timeval
#endif

View File

@ -1,11 +1,13 @@
if(NOT VCPKG_TARGET_IS_WINDOWS)
set(tesseract_patch fix-depend-libarchive.patch)
endif()
vcpkg_from_github( vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
REPO tesseract-ocr/tesseract REPO tesseract-ocr/tesseract
REF 4.1.1 REF 5ad5325a0aa8effc47ca033625b6a51682f82767 #v5.2.0
SHA512 017723a2268be789fe98978eed02fd294968cc8050dde376dee026f56f2b99df42db935049ae5e72c4519a920e263b40af1a6a40d9942e66608145b3131a71a2 SHA512 c6ed442c9deb28772aeb918142dab08d5b55eeeeccb0c1d3f13cf51bb72af227afb7f14c19a5c8db40d6a7b8cfeccb3af08a78adfcd7431e4a06f65372709ceb
PATCHES PATCHES ${tesseract_patch}
fix-tiff-linkage.patch
fix-timeval.patch # Remove this patch in the next update
) )
# The built-in cmake FindICU is better # The built-in cmake FindICU is better
@ -30,29 +32,34 @@ vcpkg_cmake_configure(
${FEATURE_OPTIONS} ${FEATURE_OPTIONS}
-DSTATIC=${BUILD_STATIC} -DSTATIC=${BUILD_STATIC}
-DUSE_SYSTEM_ICU=True -DUSE_SYSTEM_ICU=True
-DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=ON -DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_OpenCL=ON -DCMAKE_DISABLE_FIND_PACKAGE_OpenCL=ON
-DLeptonica_DIR=YES -DLeptonica_DIR=YES
-DTARGET_ARCHITECTURE=${TARGET_ARCHITECTURE} -DTARGET_ARCHITECTURE=${TARGET_ARCHITECTURE}
-DSW_BUILD=OFF
MAYBE_UNUSED_VARIABLES
CMAKE_DISABLE_FIND_PACKAGE_OpenCL
STATIC
TARGET_ARCHITECTURE
) )
vcpkg_cmake_install() vcpkg_cmake_install()
vcpkg_copy_pdbs() vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH cmake) vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/tesseract)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/tesseract/TesseractConfig.cmake" vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/tesseract/TesseractConfig.cmake"
"find_package(Leptonica REQUIRED)" "find_dependency(Leptonica)"
[[ [[
find_package(Leptonica REQUIRED) find_dependency(Leptonica)
find_package(LibArchive REQUIRED) find_dependency(LibArchive)
]] ]]
) )
vcpkg_copy_tools(TOOL_NAMES tesseract AUTO_CLEAN) vcpkg_copy_tools(TOOL_NAMES tesseract AUTO_CLEAN)
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/tesseract.pc" "-ltesseract41" "-ltesseract41d") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/tesseract.pc" "-ltesseract52" "-ltesseract52d")
endif() endif()
vcpkg_fixup_pkgconfig() vcpkg_fixup_pkgconfig()
@ -68,6 +75,7 @@ endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
# Handle copyright # Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,9 +1,9 @@
{ {
"name": "tesseract", "name": "tesseract",
"version": "4.1.1", "version": "5.2.0",
"port-version": 11,
"description": "An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google.", "description": "An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google.",
"homepage": "https://github.com/tesseract-ocr/tesseract", "homepage": "https://github.com/tesseract-ocr/tesseract",
"license": "Apache-2.0",
"supports": "!(arm & (osx | linux))", "supports": "!(arm & (osx | linux))",
"dependencies": [ "dependencies": [
"leptonica", "leptonica",

View File

@ -5206,7 +5206,7 @@
}, },
"opencv4": { "opencv4": {
"baseline": "4.6.0", "baseline": "4.6.0",
"port-version": 0 "port-version": 1
}, },
"opendnp3": { "opendnp3": {
"baseline": "3.1.1", "baseline": "3.1.1",
@ -7045,8 +7045,8 @@
"port-version": 0 "port-version": 0
}, },
"tesseract": { "tesseract": {
"baseline": "4.1.1", "baseline": "5.2.0",
"port-version": 11 "port-version": 0
}, },
"tfhe": { "tfhe": {
"baseline": "1.0.1", "baseline": "1.0.1",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "a6c9bded8fc4ad22bea6869caecf2881c8da2d41",
"version": "4.6.0",
"port-version": 1
},
{ {
"git-tree": "1ff543272c91a32d242ad5320e9ca63b29b34ed2", "git-tree": "1ff543272c91a32d242ad5320e9ca63b29b34ed2",
"version": "4.6.0", "version": "4.6.0",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "5ea8fcd243e8aa38e1a83eaa1c745fc53a3464cc",
"version": "5.2.0",
"port-version": 0
},
{ {
"git-tree": "24c99e73eaf335a9abedcfd42163c4968ca07ec3", "git-tree": "24c99e73eaf335a9abedcfd42163c4968ca07ec3",
"version": "4.1.1", "version": "4.1.1",