[tesseract] port update to 4.1.0 release (#7227)

This commit is contained in:
zhbanito 2019-07-18 23:59:07 +03:00 committed by Phil Christensen
parent 505eae9f6a
commit 1223604846
6 changed files with 65 additions and 44 deletions

View File

@ -1,5 +1,12 @@
Source: tesseract Source: tesseract
Version: 4.0.0-3 Version: 4.1.0
Homepage: https://github.com/tesseract-ocr/tesseract Homepage: https://github.com/tesseract-ocr/tesseract
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.
Build-Depends: leptonica, icu Build-Depends: leptonica
Feature: training_tools
Description: build training tools
Build-Depends: icu
Feature: cpu_independed
Description: build on any cpu extension commands support

View File

@ -0,0 +1,13 @@
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,13 +0,0 @@
diff --git a/cmake/templates/TesseractConfig.cmake.in b/cmake/templates/TesseractConfig.cmake.in
index 13838361..245ca2bc 100644
--- a/cmake/templates/TesseractConfig.cmake.in
+++ b/cmake/templates/TesseractConfig.cmake.in
@@ -21,6 +21,8 @@
include(${CMAKE_CURRENT_LIST_DIR}/TesseractTargets.cmake)
+find_package(Leptonica REQUIRED)
+
# ======================================================
# Version variables:
# ======================================================

View File

@ -5,24 +5,41 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
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.0.0 REF 4.1.0
SHA512 69e57d4ba1fc43d212fd0fff69a2b5d48a3b37cfee7054fdc083cbb7e04d92317609a32e457229661d70ce8d9b16c9d25e81bfc3861db660dd2c8f292202d447 SHA512 d617f5c5b826640b2871dbe3d7973bcc5e66fafd837921a20e009d683806ed50f0f258aa455019d99fc54f5cb65c2fa0380e3a3c92b39ab0684b8799c730b09d
HEAD_REF master
PATCHES PATCHES
use-vcpkg-icu.patch fix-tiff-linkage.patch
ws2-32.patch
leptonica.patch
) )
# The built-in cmake FindICU is better # The built-in cmake FindICU is better
file(REMOVE ${SOURCE_PATH}/cmake/FindICU.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindICU.cmake)
# Handle Static Library Output
if(VCPKG_LIBRARY_LINKAGE EQUAL "static")
list(APPEND OPTIONS_LIST -DSTATIC=ON)
endif()
# Handle CONTROL
if("training_tools" IN_LIST FEATURES)
list(APPEND OPTIONS_LIST -DBUILD_TRAINING_TOOLS=ON)
else()
list(APPEND OPTIONS_LIST -DBUILD_TRAINING_TOOLS=OFF)
endif()
if("independed_architecture" IN_LIST FEATURES)
list(APPEND OPTIONS_LIST -DTARGET_ARCHITECTURE=none)
else()
list(APPEND OPTIONS_LIST -DTARGET_ARCHITECTURE=auto)
endif()
vcpkg_configure_cmake( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA PREFER_NINJA
OPTIONS OPTIONS
-DSTATIC=ON -DSTATIC=ON
-DUSE_SYSTEM_ICU=True -DUSE_SYSTEM_ICU=True
#any value for vcpkg leptonica link cmake branch select
-DLeptonica_DIR=YES
${OPTIONS_LIST}
) )
vcpkg_install_cmake() vcpkg_install_cmake()
@ -35,6 +52,26 @@ set(EXTENSION)
if(WIN32) if(WIN32)
set(EXTENSION ".exe") set(EXTENSION ".exe")
endif() endif()
# copy training tools
set(TRAINING_TOOLS_DIR ${CURRENT_PACKAGES_DIR}/tools/tesseract/training)
if("training_tools" IN_LIST FEATURES)
file(COPY ${CURRENT_PACKAGES_DIR}/bin/ambiguous_words${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/classifier_tester${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/combine_tessdata${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/cntraining${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/dawg2wordlist${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/mftraining${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/shapeclustering${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/wordlist2dawg${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/combine_lang_model${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/lstmeval${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/lstmtraining${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/set_unicharset_properties${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/unicharset_extractor${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/text2image${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
endif()
file(COPY ${CURRENT_PACKAGES_DIR}/bin/tesseract${EXTENSION} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/tesseract) file(COPY ${CURRENT_PACKAGES_DIR}/bin/tesseract${EXTENSION} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/tesseract)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/tesseract) vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/tesseract)

View File

@ -1,11 +0,0 @@
--- a/training/CMakeLists.txt Thu Aug 17 02:46:15 2017
+++ b/training/CMakeLists.txt Thu Aug 17 02:46:15 2017
@@ -11,7 +11,7 @@
endif()
# experimental
-if (MSVC AND NOT CPPAN_BUILD)
+if (MSVC AND NOT CPPAN_BUILD AND NOT USE_SYSTEM_ICU)
include(CheckTypeSize)
check_type_size("void *" SIZEOF_VOID_P)

View File

@ -1,12 +0,0 @@
diff --git a/viewer/svutil.cpp b/viewer/svutil.cpp
index 34a2286..bc2a7e1 100644
--- a/viewer/svutil.cpp
+++ b/viewer/svutil.cpp
@@ -23,6 +23,7 @@
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
+#pragma comment(lib, "Ws2_32.lib")
struct addrinfo {
struct sockaddr* ai_addr;
int ai_addrlen;