diff --git a/build/linux/HGImgFmt/HGImgFmt.cbp b/build/linux/HGImgFmt/HGImgFmt.cbp
index 46f5e795..61527826 100644
--- a/build/linux/HGImgFmt/HGImgFmt.cbp
+++ b/build/linux/HGImgFmt/HGImgFmt.cbp
@@ -539,6 +539,7 @@
+
diff --git a/build/linux/HGImgProc/HGImgProc.cbp b/build/linux/HGImgProc/HGImgProc.cbp
index a58bbaf4..47df2342 100644
--- a/build/linux/HGImgProc/HGImgProc.cbp
+++ b/build/linux/HGImgProc/HGImgProc.cbp
@@ -557,6 +557,7 @@
+
diff --git a/build/linux/HGScannerLib/HGScannerLib.cbp b/build/linux/HGScannerLib/HGScannerLib.cbp
index 5a325e94..58679755 100644
--- a/build/linux/HGScannerLib/HGScannerLib.cbp
+++ b/build/linux/HGScannerLib/HGScannerLib.cbp
@@ -335,6 +335,7 @@
+
diff --git a/build/linux/HGUpload/HGUpload.cbp b/build/linux/HGUpload/HGUpload.cbp
index 7e2c15ba..9095da64 100644
--- a/build/linux/HGUpload/HGUpload.cbp
+++ b/build/linux/HGUpload/HGUpload.cbp
@@ -235,6 +235,7 @@
+
diff --git a/build/linux/HGVersion/HGVersion.cbp b/build/linux/HGVersion/HGVersion.cbp
index dda6ae54..8bb8d007 100644
--- a/build/linux/HGVersion/HGVersion.cbp
+++ b/build/linux/HGVersion/HGVersion.cbp
@@ -332,6 +332,7 @@
+
diff --git a/test/webservice/webdemoproject/.idea/workspace.xml b/test/webservice/webdemoproject/.idea/workspace.xml
index b440e683..475f7912 100644
--- a/test/webservice/webdemoproject/.idea/workspace.xml
+++ b/test/webservice/webdemoproject/.idea/workspace.xml
@@ -1,12 +1,7 @@
-
-
-
-
-
-
+
@@ -176,7 +171,14 @@
-
+
+
+
+
+
+
+
+
1654157535371
@@ -213,12 +215,36 @@
1655369381641
-
+
+ 1659080182659
+
+
+
+ 1659080182659
+
+
+ 1677145533776
+
+
+
+ 1677145533776
+
+
+
+
+
\ No newline at end of file
diff --git a/test/webservice/webdemoproject/css/scan.css b/test/webservice/webdemoproject/css/scan.css
index 36825f8e..e6eb9e22 100644
--- a/test/webservice/webdemoproject/css/scan.css
+++ b/test/webservice/webdemoproject/css/scan.css
@@ -82,8 +82,10 @@ ul {
}
.el-container .el-header .menuContainer {
- float: left;
- margin-left: 15px;
+ /*float: left;*/
+ /*margin-left: 15px;*/
+ /*height: 80px;*/
+ overflow-x: auto;
}
.el-container .el-header .menuContainer ul {
@@ -218,3 +220,10 @@ ul {
.cursor-pointer {
cursor: pointer
}
+
+
+.menuStyle {
+ display: inline-block;
+ /*margin-left: 10px;*/
+ margin: 5px;
+}
diff --git a/test/webservice/webdemoproject/js/WebScanController.js b/test/webservice/webdemoproject/js/WebScanController.js
index 2af62e23..f81a6ccb 100644
--- a/test/webservice/webdemoproject/js/WebScanController.js
+++ b/test/webservice/webdemoproject/js/WebScanController.js
@@ -448,11 +448,11 @@
},
//插入本地图像(需返回成功后前端缩略图才能作相应的UI修改)
- insertLocalImage: function (imagePath, insertIndex, callBack) {
+ insertLocalImage: function (imagePath, insertIndex, idenInfo, callBack) {
const that = this
this.sendCommand({
func: "insert_local_image",
- iden: that.wslicence,
+ iden: JSON.stringify(idenInfo),
image_path: imagePath,
insert_pos: insertIndex,//插入位置,-1表示最后
image_tag: ''//标签名,可以为空
@@ -501,11 +501,11 @@
},
//修改图像
- modifyImage: function (imageIndex, imageBase64, callBack) {
+ modifyImage: function (imageIndex, imageBase64, idenInfo, callBack) {
const that = this
this.sendCommand({
func: "modify_image",
- iden: that.wslicence,
+ iden: idenInfo == null ? that.wslicence : JSON.stringify(idenInfo),
image_index: imageIndex,
image_base64: imageBase64
}, callBack)
diff --git a/test/webservice/webdemoproject/js/scanWeb.js b/test/webservice/webdemoproject/js/scanWeb.js
index 0a3f952f..ef912159 100644
--- a/test/webservice/webdemoproject/js/scanWeb.js
+++ b/test/webservice/webdemoproject/js/scanWeb.js
@@ -292,8 +292,10 @@ new Vue({
this.eleMessage(info.info, info.is_error ? 'error' : 'warning')
break
case "scan_image"://图片回调
- this.appendLog('图片回调:' + info.image_path)
- console.log('图片回调:' + info.image_path)
+ let imagePath = info.image_path
+
+ this.appendLog('图片回调:' + imagePath)
+ console.log('图片回调:' + imagePath + ' info:' + JSON.stringify(info))
let that = this
if (this.scanMode == 'insert') {//是插入扫描
@@ -306,18 +308,25 @@ new Vue({
this.curInsertIndex = this.selectImageObj.index
}
- console.log('插入扫描:待插入index:' + this.curInsertIndex + " path:" + info.image_path)
- this.WebScanController.insertLocalImage(info.image_path, this.curInsertIndex, function (insertInfo) {
- console.log('插入扫描:插入index' + that.curInsertIndex)
-
- that.urls.splice(that.curInsertIndex, 0, {
- path: info.image_path,
+ console.log('插入扫描:待插入index:' + this.curInsertIndex + " path:" + imagePath)
+ this.WebScanController.insertLocalImage(imagePath, this.curInsertIndex,
+ {
+ path: imagePath,
thumbnail: info.image_base64,
base64: info.image_base64
- });
- that.curInsertIndex++
- that.$forceUpdate()
- })
+ },
+ function (insertInfo) {
+ console.log('插入扫描:插入index' + that.curInsertIndex)
+ let idenInfo = JSON.parse(insertInfo.iden);
+
+ that.urls.splice(that.curInsertIndex, 0, {
+ path: idenInfo.path,
+ thumbnail: idenInfo.thumbnail,
+ base64: idenInfo.base64
+ });
+ that.curInsertIndex++
+ that.$forceUpdate()
+ })
} else if (this.scanMode == 'cover') {//是覆盖扫描
@@ -333,15 +342,20 @@ new Vue({
}
if (this.needCoverCount > 0) {//还在覆盖范围内,直接覆盖掉
- this.WebScanController.modifyImage(this.curCoverIndex, info.image_base64, function (modifyInfo) {
+ this.WebScanController.modifyImage(this.curCoverIndex, info.image_base64, {
+ base64: info.image_base64,
+ thumbnail: info.image_base64,
+ path: imagePath
+ }, function (modifyInfo) {
console.log('覆盖扫描:修改成功 index:' + that.curCoverIndex)
console.log('覆盖前:index==' + that.curCoverIndex + ' path:' + that.urls[that.curCoverIndex].path)
+ let idenInfo = JSON.parse(modifyInfo.iden);
that.urls[that.curCoverIndex] = {
- base64: info.image_base64,
- thumbnail: info.image_base64,
- path: info.image_path
+ base64: idenInfo.base64,
+ thumbnail: idenInfo.thumbnail,
+ path: idenInfo.path
}
console.log('覆盖后:index==' + that.curCoverIndex + ' path:' + that.urls[that.curCoverIndex].path)
@@ -351,12 +365,18 @@ new Vue({
that.$forceUpdate()
})
} else {//之后都是新增的往后添加了
- this.WebScanController.insertLocalImage(info.image_path, this.urls.length, function (result) {
+ this.WebScanController.insertLocalImage(imagePath, this.urls.length, {
+ path: imagePath,
+ thumbnail: info.image_base64,
+ base64: info.image_base64
+ }, function (result) {
console.log('覆盖扫描:插入成功 index:' + that.urls.length)
+ let idenInfo = JSON.parse(result.iden);
+
that.urls.push({
- path: info.image_path,
- thumbnail: info.image_base64,
- base64: info.image_base64
+ path: idenInfo.path,
+ thumbnail: idenInfo.thumbnail,
+ base64: idenInfo.base64
})
that.$forceUpdate()
@@ -374,12 +394,20 @@ new Vue({
let that = this;
- this.WebScanController.insertLocalImage(info.image_path, this.urls.length, function (result) {
- console.log('正常扫描:插入成功 index:' + that.urls.length)
+
+ this.WebScanController.insertLocalImage(imagePath, this.urls.length, {
+ path: imagePath,
+ thumbnail: info.image_base64,
+ base64: info.image_base64
+ }, function (result) {
+ let idenInfo = JSON.parse(result.iden);
+
+ console.log('正常扫描:插入成功 index:' + that.urls.length + ' path:' + idenInfo.path)
+
that.urls.push({
- path: info.image_path,
- thumbnail: info.image_base64,
- base64: info.image_base64
+ path: idenInfo.path,
+ thumbnail: idenInfo.thumbnail,
+ base64: idenInfo.base64
})
that.$nextTick(function () {
if (that.$refs.imageArea) {
@@ -1023,7 +1051,7 @@ new Vue({
that.WebScanController.imageAddWatermark(modifyIndex, that.waterMarkInfo, true, function (info) {
console.log('添加水印成功:')
- that.WebScanController.modifyImage(modifyIndex, info.image_base64, function (modifyInfo) {
+ that.WebScanController.modifyImage(modifyIndex, info.image_base64, {}, function (modifyInfo) {
console.log('添加水印:修改' + modifyIndex + '成功:')
that.urls[modifyIndex].thumbnail = info.image_base64
that.urls[modifyIndex].base64 = info.image_base64
@@ -1056,7 +1084,7 @@ new Vue({
this.WebScanController.imageAddWatermark(imageIndex, markInfoParams, true, function (markInfo) {
console.log('多张添加水印成功:index:' + imageIndex)
let resultImage = markInfo.image_base64
- that.WebScanController.modifyImage(imageIndex, resultImage, function (modifyInfo) {
+ that.WebScanController.modifyImage(imageIndex, resultImage, {}, function (modifyInfo) {
console.log('多张添加水印:修改' + imageIndex + '成功:')
that.urls[imageIndex].thumbnail = resultImage
that.urls[imageIndex].base64 = resultImage
@@ -1249,9 +1277,9 @@ new Vue({
this.totalAngle = 0
this.canvas.discardActiveObject()
let that = this
- console.log('准备加载图像到画布:' + JSON.stringify(imageSrc))
+ // console.log('准备加载图像到画布:' + JSON.stringify(imageSrc))
new fabric.Image.fromURL(imageSrc ? imageSrc.base64 : null, function (image) {
- console.log('加载图像:image===' + image)
+ // console.log('加载图像:image===' + image)
let result = imageSrc ? image : null
that.image = result
that.canvas.add(image)
@@ -1452,7 +1480,7 @@ new Vue({
let firstPath = info.image_path_list[0]
let secondPath = info.image_path_list[1]
- that.WebScanController.modifyImage(currentIndex, secondBase64, function (info) {
+ that.WebScanController.modifyImage(currentIndex, secondBase64, {}, function (info) {
console.log('图像拆分:第二张修改成功...')
that.urls[currentIndex] = {
base64: secondBase64,
@@ -1886,7 +1914,7 @@ new Vue({
console.log('save image dataUrl:' + dataUrl)
- this.WebScanController.modifyImage(this.selectImageObj.index, dataUrl, function (info) {
+ this.WebScanController.modifyImage(this.selectImageObj.index, dataUrl, {}, function (info) {
console.log('修改图像成功:' + JSON.stringify(info))
that.eleUnloadding()
that.undoStack.length = 0;
@@ -2073,7 +2101,7 @@ new Vue({
console.log('save image dataUrl:' + dataUrl)
- that.WebScanController.modifyImage(currentIndex, dataUrl, function (info) {
+ that.WebScanController.modifyImage(currentIndex, dataUrl, {}, function (info) {
that.eleUnloadding()
console.log('修改成功')
that.urls[currentIndex].base64 = dataUrl
diff --git a/test/webservice/webdemoproject/webDemo.html b/test/webservice/webdemoproject/webDemo.html
index 082f7c23..fdaaeae6 100644
--- a/test/webservice/webdemoproject/webDemo.html
+++ b/test/webservice/webdemoproject/webDemo.html
@@ -9,7 +9,7 @@
-
+
+
+
+
+
+
diff --git a/third_party/ocr/tesseract-ocr/kylin/aarch64/include/tesseract/baseapi.h b/third_party/ocr/tesseract-ocr/kylin/aarch64/include/tesseract/baseapi.h
index 3724dd92..fe12351b 100644
--- a/third_party/ocr/tesseract-ocr/kylin/aarch64/include/tesseract/baseapi.h
+++ b/third_party/ocr/tesseract-ocr/kylin/aarch64/include/tesseract/baseapi.h
@@ -93,6 +93,8 @@ class TESS_API TessBaseAPI {
TessBaseAPI();
virtual ~TessBaseAPI();
+ int MyOSD();
+
/**
* Returns the version identifier as a static string. Do not delete.
*/
diff --git a/third_party/ocr/tesseract-ocr/kylin/aarch64/include/tesseract/capi.h b/third_party/ocr/tesseract-ocr/kylin/aarch64/include/tesseract/capi.h
index 7ed64ef4..8752816a 100644
--- a/third_party/ocr/tesseract-ocr/kylin/aarch64/include/tesseract/capi.h
+++ b/third_party/ocr/tesseract-ocr/kylin/aarch64/include/tesseract/capi.h
@@ -176,6 +176,8 @@ struct Pix;
struct Boxa;
struct Pixa;
+TESS_API int MyOSD(TessBaseAPI* api);
+
/* General free functions */
TESS_API const char* TESS_CALL TessVersion();
diff --git a/third_party/ocr/tesseract-ocr/kylin/aarch64/lib/libtesseract.a b/third_party/ocr/tesseract-ocr/kylin/aarch64/lib/libtesseract.a
index 47aa9d0d..9d5a9047 100644
Binary files a/third_party/ocr/tesseract-ocr/kylin/aarch64/lib/libtesseract.a and b/third_party/ocr/tesseract-ocr/kylin/aarch64/lib/libtesseract.a differ
diff --git a/third_party/ocr/tesseract-ocr/kylin/amd64/include/tesseract/baseapi.h b/third_party/ocr/tesseract-ocr/kylin/amd64/include/tesseract/baseapi.h
index 3724dd92..fe12351b 100644
--- a/third_party/ocr/tesseract-ocr/kylin/amd64/include/tesseract/baseapi.h
+++ b/third_party/ocr/tesseract-ocr/kylin/amd64/include/tesseract/baseapi.h
@@ -93,6 +93,8 @@ class TESS_API TessBaseAPI {
TessBaseAPI();
virtual ~TessBaseAPI();
+ int MyOSD();
+
/**
* Returns the version identifier as a static string. Do not delete.
*/
diff --git a/third_party/ocr/tesseract-ocr/kylin/amd64/include/tesseract/capi.h b/third_party/ocr/tesseract-ocr/kylin/amd64/include/tesseract/capi.h
index 7ed64ef4..8752816a 100644
--- a/third_party/ocr/tesseract-ocr/kylin/amd64/include/tesseract/capi.h
+++ b/third_party/ocr/tesseract-ocr/kylin/amd64/include/tesseract/capi.h
@@ -176,6 +176,8 @@ struct Pix;
struct Boxa;
struct Pixa;
+TESS_API int MyOSD(TessBaseAPI* api);
+
/* General free functions */
TESS_API const char* TESS_CALL TessVersion();
diff --git a/third_party/ocr/tesseract-ocr/kylin/amd64/lib/libtesseract.a b/third_party/ocr/tesseract-ocr/kylin/amd64/lib/libtesseract.a
index d4aeb5ee..e2a2d25f 100644
Binary files a/third_party/ocr/tesseract-ocr/kylin/amd64/lib/libtesseract.a and b/third_party/ocr/tesseract-ocr/kylin/amd64/lib/libtesseract.a differ
diff --git a/third_party/ocr/tesseract-ocr/kylin/loongarch64/include/tesseract/baseapi.h b/third_party/ocr/tesseract-ocr/kylin/loongarch64/include/tesseract/baseapi.h
index 3724dd92..fe12351b 100644
--- a/third_party/ocr/tesseract-ocr/kylin/loongarch64/include/tesseract/baseapi.h
+++ b/third_party/ocr/tesseract-ocr/kylin/loongarch64/include/tesseract/baseapi.h
@@ -93,6 +93,8 @@ class TESS_API TessBaseAPI {
TessBaseAPI();
virtual ~TessBaseAPI();
+ int MyOSD();
+
/**
* Returns the version identifier as a static string. Do not delete.
*/
diff --git a/third_party/ocr/tesseract-ocr/kylin/loongarch64/include/tesseract/capi.h b/third_party/ocr/tesseract-ocr/kylin/loongarch64/include/tesseract/capi.h
index 7ed64ef4..8752816a 100644
--- a/third_party/ocr/tesseract-ocr/kylin/loongarch64/include/tesseract/capi.h
+++ b/third_party/ocr/tesseract-ocr/kylin/loongarch64/include/tesseract/capi.h
@@ -176,6 +176,8 @@ struct Pix;
struct Boxa;
struct Pixa;
+TESS_API int MyOSD(TessBaseAPI* api);
+
/* General free functions */
TESS_API const char* TESS_CALL TessVersion();
diff --git a/third_party/ocr/tesseract-ocr/kylin/loongarch64/lib/libtesseract.a b/third_party/ocr/tesseract-ocr/kylin/loongarch64/lib/libtesseract.a
index 866ad476..2d3370f7 100644
Binary files a/third_party/ocr/tesseract-ocr/kylin/loongarch64/lib/libtesseract.a and b/third_party/ocr/tesseract-ocr/kylin/loongarch64/lib/libtesseract.a differ
diff --git a/third_party/ocr/tesseract-ocr/kylin/mips64/include/tesseract/baseapi.h b/third_party/ocr/tesseract-ocr/kylin/mips64/include/tesseract/baseapi.h
index 3724dd92..fe12351b 100644
--- a/third_party/ocr/tesseract-ocr/kylin/mips64/include/tesseract/baseapi.h
+++ b/third_party/ocr/tesseract-ocr/kylin/mips64/include/tesseract/baseapi.h
@@ -93,6 +93,8 @@ class TESS_API TessBaseAPI {
TessBaseAPI();
virtual ~TessBaseAPI();
+ int MyOSD();
+
/**
* Returns the version identifier as a static string. Do not delete.
*/
diff --git a/third_party/ocr/tesseract-ocr/kylin/mips64/include/tesseract/capi.h b/third_party/ocr/tesseract-ocr/kylin/mips64/include/tesseract/capi.h
index 7ed64ef4..8752816a 100644
--- a/third_party/ocr/tesseract-ocr/kylin/mips64/include/tesseract/capi.h
+++ b/third_party/ocr/tesseract-ocr/kylin/mips64/include/tesseract/capi.h
@@ -176,6 +176,8 @@ struct Pix;
struct Boxa;
struct Pixa;
+TESS_API int MyOSD(TessBaseAPI* api);
+
/* General free functions */
TESS_API const char* TESS_CALL TessVersion();
diff --git a/third_party/ocr/tesseract-ocr/kylin/mips64/lib/libtesseract.a b/third_party/ocr/tesseract-ocr/kylin/mips64/lib/libtesseract.a
index 7fbb3435..1e740828 100644
Binary files a/third_party/ocr/tesseract-ocr/kylin/mips64/lib/libtesseract.a and b/third_party/ocr/tesseract-ocr/kylin/mips64/lib/libtesseract.a differ
diff --git a/third_party/ocr/tesseract-ocr/src/CMakeLists.txt b/third_party/ocr/tesseract-ocr/src/CMakeLists.txt
new file mode 100644
index 00000000..eb3fdba6
--- /dev/null
+++ b/third_party/ocr/tesseract-ocr/src/CMakeLists.txt
@@ -0,0 +1,594 @@
+#
+# tesseract
+#
+
+###############################################################################
+#
+# cmake settings
+#
+###############################################################################
+
+cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
+
+# In-source builds are disabled.
+if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ message(FATAL_ERROR
+ "CMake generation is not possible within the source directory!"
+ "\n Remove the CMakeCache.txt file and try again from another folder, e.g.:"
+ "\n "
+ "\n rm CMakeCache.txt"
+ "\n mkdir build"
+ "\n cd build"
+ "\n cmake .."
+ )
+endif()
+
+set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -O2")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -O2")
+
+# Use solution folders.
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets")
+
+###############################################################################
+#
+# project settings
+#
+###############################################################################
+
+project(tesseract C CXX)
+
+# Get version with components from VERSION file.
+file(STRINGS "VERSION" VERSION_PLAIN)
+string(REGEX REPLACE "^([^.]*)\\..*" "\\1" VERSION_MAJOR ${VERSION_PLAIN})
+string(REGEX REPLACE "^[^.]*\\.([^.]*)\\..*" "\\1" VERSION_MINOR ${VERSION_PLAIN})
+string(REGEX REPLACE "^[^.]*\\.[^.]*\\.([0-9]*).*" "\\1" VERSION_PATCH ${VERSION_PLAIN})
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
+ execute_process(COMMAND git --git-dir ${CMAKE_CURRENT_SOURCE_DIR}/.git describe --abbrev=4
+ OUTPUT_VARIABLE GIT_REV)
+ string(REGEX REPLACE "\n$" "" PACKAGE_VERSION "${GIT_REV}")
+endif()
+if(NOT PACKAGE_VERSION)
+ set(PACKAGE_VERSION ${VERSION_PLAIN})
+endif()
+
+# Provide also same macro names as autoconf (see configure.ac).
+set(GENERIC_MAJOR_VERSION ${VERSION_MAJOR})
+set(GENERIC_MINOR_VERSION ${VERSION_MINOR})
+set(GENERIC_MICRO_VERSION ${VERSION_PATCH})
+
+set(MINIMUM_LEPTONICA_VERSION 1.74)
+
+###############################################################################
+#
+# options
+#
+###############################################################################
+message( "Configuring tesseract version ${PACKAGE_VERSION}...")
+
+option(CPPAN_BUILD "Build with cppan" ON)
+option(SW_BUILD "Build with sw" OFF)
+option(OPENMP_BUILD "Build with openmp support" OFF) # see issue #1662
+option(AUTO_OPTIMIZE "Usage of cmake auto optimize macros (not suitable for portable build)" ON)
+option(GRAPHICS_DISABLED "Disable disable graphics (ScrollView)" OFF)
+option(DISABLED_LEGACY_ENGINE "Disable the legacy OCR engine" OFF)
+option(BUILD_TRAINING_TOOLS "Build training tools" ON)
+option(BUILD_TESTS "Build tests" OFF)
+
+if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.cppan OR SW_BUILD)
+ set(CPPAN_BUILD OFF)
+endif()
+
+###############################################################################
+#
+# compiler and linker
+#
+###############################################################################
+
+if(NOT CMAKE_BUILD_TYPE)
+ message(STATUS "Setting build type to 'Release' as none was specified.")
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
+endif()
+
+include(CheckCXXCompilerFlag)
+
+# Check for C++ standard to use
+get_property(known_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
+if (cxx_std_17 IN_LIST known_features)
+ set(CMAKE_CXX_STANDARD 17)
+elseif (cxx_std_14 IN_LIST known_features)
+ set(CMAKE_CXX_STANDARD 14)
+else() # minimum required standard
+ set(CMAKE_CXX_STANDARD 11)
+endif()
+
+# Avoid using experimental c++1y (c++1z) standard even if the compiler announces cxx14 (cxx17)
+# in CMAKE_CXX_KNOWN_FEATURES and CMAKE_CXX_COMPILE_FEATURES
+# It is the case of clang 3.9, 4.0 (announces c++1z) and gcc 4.8 (announces c++1y)
+if ("${CMAKE_CXX17_STANDARD_COMPILE_OPTION}" STREQUAL "-std=c++1z")
+ set(CMAKE_CXX_STANDARD 14)
+endif()
+if ("${CMAKE_CXX14_STANDARD_COMPILE_OPTION}" STREQUAL "-std=c++1y")
+ set(CMAKE_CXX_STANDARD 11)
+endif()
+
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+set(LIBRARY_TYPE STATIC)
+if (STATIC)
+ set(LIBRARY_TYPE)
+endif()
+
+# auto optimize
+if (AUTO_OPTIMIZE)
+ include(OptimizeForArchitecture)
+ AutodetectHostArchitecture()
+ OptimizeForArchitecture()
+endif()
+# Compiler specific environments
+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ set(CLANG 1)
+endif()
+if(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -Og")
+elseif(MSVC)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
+ if (NOT CLANG)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+ endif()
+ # Don't use /Wall because it generates too many warnings.
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4 /bigobj")
+endif()
+if(CLANG) # clang all platforms
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-unused-command-line-argument")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -O0")
+endif()
+
+if (OPENMP_BUILD)
+ find_package(OpenMP QUIET)
+ if (OpenMP_FOUND)
+ message(">> ${OpenMP_FOUND} ${OpenMP_VERSION}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+ add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
+ endif()
+ # https://stackoverflow.com/questions/12399422/how-to-set-linker-flags-for-openmp-in-cmakes-try-compile-function
+ if (NOT OpenMP_FOUND AND CLANG AND WIN32)
+ # workaroung because find_package(OpenMP) does not work for clang-cl
+ # https://gitlab.kitware.com/cmake/cmake/issues/19404
+ check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
+ find_library(OpenMP_LIBRARY NAMES omp libomp.lib)
+ message(">> OpenMP_LIBRARY: ${OpenMP_LIBRARY}")
+ if (MSVC)
+ set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS} /openmp")
+ else()
+ set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS} -fopenmp")
+ endif()
+ set(OpenMP_FOUND 1)
+ add_definitions(-D_OPENMP=201107) # 3.1 version is supported from Clang 3.8.0
+ endif()
+endif()
+
+
+if (CYGWIN)
+ add_definitions(-D__CYGWIN__)
+elseif(UNIX)
+ if (NOT ANDROID)
+ set(LIB_pthread pthread)
+ endif()
+elseif(WIN32)
+ set(LIB_Ws2_32 Ws2_32)
+endif()
+
+###############################################################################
+#
+# packages
+#
+###############################################################################
+
+if(CPPAN_BUILD)
+ if (STATIC)
+ set(CPPAN_BUILD_SHARED_LIBS 0)
+ else()
+ set(CPPAN_BUILD_SHARED_LIBS 1)
+ endif()
+ add_subdirectory(.cppan)
+elseif (SW_BUILD)
+ find_package(SW REQUIRED)
+ if (STATIC)
+ set(SW_BUILD_SHARED_LIBS 0)
+ else()
+ set(SW_BUILD_SHARED_LIBS 1)
+ endif()
+ sw_add_package(
+ org.sw.demo.danbloomberg.leptonica-master
+ org.sw.demo.libarchive.libarchive
+ )
+ if (BUILD_TRAINING_TOOLS)
+ sw_add_package(
+ org.sw.demo.gnome.pango.pangocairo
+ org.sw.demo.unicode.icu.i18n
+ )
+ endif()
+ sw_execute()
+else()
+ find_package(PkgConfig)
+ if(PKG_CONFIG_EXECUTABLE AND NOT Leptonica_DIR)
+ pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
+ link_directories(${Leptonica_LIBRARY_DIRS})
+ else()
+ find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
+ endif()
+ if (NOT Leptonica_FOUND)
+ message(FATAL_ERROR "Cannot find required library Leptonica. Quitting!")
+ endif(NOT Leptonica_FOUND)
+
+ find_package(LibArchive)
+ if(LibArchive_FOUND)
+ set(HAVE_LIBARCHIVE ON)
+ endif()
+endif()
+
+find_package(OpenCL QUIET)
+
+
+###############################################################################
+#
+# configure
+#
+###############################################################################
+
+foreach(flag ${Vc_ARCHITECTURE_FLAGS})
+ set(Vc_CXX_FLAGS "${Vc_CXX_FLAGS} ${flag}")
+endforeach()
+
+# add definition as expected in src/arch/simddetect.cpp
+set(AVX_OPT OFF)
+set(AVX2_OPT OFF)
+set(FMA_OPT OFF)
+set(SSE41_OPT OFF)
+set(MARCH_NATIVE_OPT OFF)
+foreach(flag ${_enable_vector_unit_list}) # from OptimizeForArchitecture()
+ string(TOUPPER "${flag}" flag)
+ string(REPLACE "\." "_" flag "${flag}")
+ set(simd_flags "${simd_flags} -D${flag}")
+ string(REPLACE "_" "" flag "${flag}")
+ if("${flag}" MATCHES "AVX|AVX2|FMA|SSE41")
+ set("${flag}_OPT" ON)
+ endif()
+endforeach(flag)
+if (NOT MSVC)
+ set(MARCH_NATIVE_FLAGS "${MARCH_NATIVE_FLAGS} -O3 -ffast-math")
+endif()
+CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
+if(COMPILER_SUPPORTS_MARCH_NATIVE)
+ set(MARCH_NATIVE_FLAGS "${MARCH_NATIVE_FLAGS} -march=native -mtune=native")
+ set(MARCH_NATIVE_OPT ON)
+endif()
+
+set(AUTOCONFIG_SRC ${CMAKE_CURRENT_BINARY_DIR}/config_auto.h.in)
+set(AUTOCONFIG ${CMAKE_CURRENT_BINARY_DIR}/config_auto.h)
+add_definitions(-DHAVE_CONFIG_H)
+
+if(GRAPHICS_DISABLED)
+ message("ScrollView debugging disabled.")
+endif()
+set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${CMAKE_PREFIX_PATH}/include" "${CMAKE_INSTALL_PREFIX}/include")
+include(Configure)
+
+configure_file(${AUTOCONFIG_SRC} ${AUTOCONFIG} @ONLY)
+
+set(INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" "${CMAKE_INSTALL_PREFIX}/include/tesseract")
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/api/tess_version.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/api/tess_version.h @ONLY)
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/vs2010/tesseract/tesseract.rc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/vs2010/tesseract/tesseract.rc @ONLY)
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/vs2010/tesseract/libtesseract.rc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/vs2010/tesseract/libtesseract.rc @ONLY)
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/TesseractConfig-version.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/TesseractConfig-version.cmake @ONLY)
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/TesseractConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/TesseractConfig.cmake @ONLY)
+
+# show summary of configuration
+if(${CMAKE_BUILD_TYPE} MATCHES Debug)
+ set(COMPILER_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
+elseif(${CMAKE_BUILD_TYPE} MATCHES Release)
+ set(COMPILER_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
+endif()
+message( STATUS )
+message( STATUS "General configuration for Tesseract ${PACKAGE_VERSION}")
+message( STATUS "--------------------------------------------------------")
+message( STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+message( STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID}")
+message( STATUS "Used standard: C++${CMAKE_CXX_STANDARD}")
+message( STATUS "CXX compiler options: ${COMPILER_FLAGS}")
+message( STATUS "Linker options: ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UP}}")
+message( STATUS "Install directory: ${CMAKE_INSTALL_PREFIX}")
+message( STATUS "Architecture flags: ${Vc_ARCHITECTURE_FLAGS}")
+message( STATUS "Vector unit list: ${_enable_vector_unit_list}")
+message( STATUS "AVX_OPT: ${AVX_OPT}")
+message( STATUS "AVX2_OPT: ${AVX2_OPT}")
+message( STATUS "FMA_OPT: ${FMA_OPT}")
+message( STATUS "SSE41_OPT: ${SSE41_OPT}")
+message( STATUS "MARCH_NATIVE_OPT: ${MARCH_NATIVE_OPT}")
+message( STATUS "simd_flags: ${simd_flags}")
+message( STATUS "--------------------------------------------------------")
+message( STATUS "Build with cppan [CPPAN_BUILD]: ${CPPAN_BUILD}")
+if (CPPAN_BUILD)
+message( STATUS "##################################################################################")
+message( "!! CPPAN is depreciated! Please consider switching to SW Build.\n"
+ " More details: https://github.com/tesseract-ocr/tesseract/wiki/Compiling#windows")
+message( STATUS "##################################################################################")
+endif()
+message( STATUS "Build with sw [SW_BUILD]: ${SW_BUILD}")
+message( STATUS "Build with openmp support [OPENMP_BUILD]: ${OPENMP_BUILD}")
+message( STATUS "Disable disable graphics (ScrollView) [GRAPHICS_DISABLED]: ${GRAPHICS_DISABLED}")
+message( STATUS "Disable the legacy OCR engine [DISABLED_LEGACY_ENGINE]: ${DISABLED_LEGACY_ENGINE}")
+message( STATUS "Build training tools [BUILD_TRAINING_TOOLS]: ${BUILD_TRAINING_TOOLS}")
+message( STATUS "Build tests [BUILD_TESTS]: ${BUILD_TESTS}")
+message( STATUS "--------------------------------------------------------")
+message( STATUS )
+
+###############################################################################
+#
+# build
+#
+###############################################################################
+
+include(BuildFunctions)
+include(SourceGroups)
+
+add_definitions(-D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1)
+
+include_directories(${Leptonica_INCLUDE_DIRS})
+include_directories(${LibArchive_INCLUDE_DIRS})
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+include_directories(src/api)
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/api)
+include_directories(src/arch)
+include_directories(src/ccmain)
+include_directories(src/ccstruct)
+include_directories(src/ccutil)
+include_directories(src/classify)
+include_directories(src/cutil)
+include_directories(src/dict)
+include_directories(src/lstm)
+include_directories(src/opencl)
+include_directories(src/textord)
+include_directories(src/viewer)
+include_directories(src/wordrec)
+include_directories(src/training)
+if(ANDROID_TOOLCHAIN)
+ include_directories(${ANDROID_TOOLCHAIN}/sysroot/usr/include)
+ add_compile_definitions(__ANDROID_API_FUTURE__)
+endif()
+
+########################################
+# LIBRARY tesseract
+########################################
+
+file(GLOB tesseract_src
+ src/ccmain/*.cpp
+ src/ccstruct/*.cpp
+ src/ccutil/*.cpp
+ src/classify/*.cpp
+ src/cutil/*.cpp
+ src/dict/*.cpp
+ src/lstm/*.cpp
+ src/opencl/*.cpp
+ src/textord/*.cpp
+ src/viewer/*.cpp
+ src/wordrec/*.cpp
+)
+
+list(APPEND arch_files
+ src/arch/dotproduct.cpp
+ src/arch/simddetect.cpp
+ src/arch/intsimdmatrix.cpp
+)
+set_source_files_properties(${arch_files} PROPERTIES COMPILE_FLAGS "${simd_flags}")
+set_source_files_properties(src/arch/dotproduct.cpp PROPERTIES COMPILE_FLAGS "${MARCH_NATIVE_FLAGS} ${Vc_CXX_FLAGS}")
+if(AVX_OPT)
+ list(APPEND arch_files_opt src/arch/dotproductavx.cpp)
+ set_source_files_properties(src/arch/dotproductavx.cpp PROPERTIES COMPILE_FLAGS "-DAVX")
+endif(AVX_OPT)
+if(AVX2_OPT)
+ list(APPEND arch_files_opt src/arch/intsimdmatrixavx2.cpp)
+ set_source_files_properties(src/arch/intsimdmatrixavx2.cpp PROPERTIES COMPILE_FLAGS "-DAVX2")
+endif(AVX2_OPT)
+if(FMA_OPT)
+ list(APPEND arch_files_opt src/arch/dotproductfma.cpp)
+ set_source_files_properties(src/arch/dotproductfma.cpp PROPERTIES COMPILE_FLAGS "-mfma")
+endif(FMA_OPT)
+if(SSE41_OPT)
+ list(APPEND arch_files_opt src/arch/dotproductsse.cpp src/arch/intsimdmatrixsse.cpp)
+ set_source_files_properties(src/arch/dotproductsse.cpp src/arch/intsimdmatrixsse.cpp PROPERTIES COMPILE_FLAGS "-DSSE4_1 -msse4.1")
+endif(SSE41_OPT)
+set_source_files_properties(${arch_files_opt} PROPERTIES COMPILE_FLAGS "${Vc_CXX_FLAGS}")
+
+file(GLOB tesseract_hdr
+ src/api/*.h
+ src/arch/*.h
+ src/ccmain/*.h
+ src/ccstruct/*.h
+ src/ccutil/*.h
+ src/classify/*.h
+ src/cutil/*.h
+ src/dict/*.h
+ src/lstm/*.h
+ src/opencl/*.h
+ src/textord/*.h
+ src/viewer/*.h
+ src/wordrec/*.h
+)
+
+set(tesseract_src ${tesseract_src}
+ src/api/baseapi.cpp
+ src/api/capi.cpp
+ src/api/renderer.cpp
+ src/api/altorenderer.cpp
+ src/api/hocrrenderer.cpp
+ src/api/lstmboxrenderer.cpp
+ src/api/pdfrenderer.cpp
+ src/api/wordstrboxrenderer.cpp
+)
+
+if (WIN32)
+ if (MSVC)
+ include_directories(src/vs2010/tesseract)
+ set(tesseract_hdr
+ ${tesseract_hdr}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/vs2010/tesseract/resource.h)
+ set(tesseract_rsc ${CMAKE_CURRENT_BINARY_DIR}/vs2010/tesseract/libtesseract.rc)
+ endif() # MSVC
+endif()
+
+add_library (libtesseract ${LIBRARY_TYPE} ${tesseract_src} ${arch_files}
+ ${arch_files_opt} ${tesseract_hdr} ${tesseract_rsc}
+ )
+if (NOT STATIC)
+target_compile_definitions (libtesseract
+ PRIVATE -DTESS_EXPORTS
+ INTERFACE -DTESS_IMPORTS
+)
+set_target_properties (libtesseract PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS True)
+endif()
+target_link_libraries (libtesseract PRIVATE ${LIB_Ws2_32} ${LIB_pthread})
+set_target_properties (libtesseract PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
+set_target_properties (libtesseract PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
+if (WIN32)
+set_target_properties (libtesseract PROPERTIES OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR})
+set_target_properties (libtesseract PROPERTIES DEBUG_OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR}d)
+else()
+set_target_properties (libtesseract PROPERTIES OUTPUT_NAME tesseract)
+endif()
+
+if (CPPAN_BUILD)
+ target_link_libraries (libtesseract PUBLIC
+ pvt.cppan.demo.danbloomberg.leptonica
+ pvt.cppan.demo.libarchive.libarchive
+ )
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake "include(${CMAKE_CURRENT_BINARY_DIR}/cppan.cmake)\n")
+ export(TARGETS libtesseract APPEND FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
+elseif (SW_BUILD)
+ target_link_libraries (libtesseract PUBLIC
+ org.sw.demo.danbloomberg.leptonica-master
+ org.sw.demo.libarchive.libarchive
+ )
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake "include(${CMAKE_CURRENT_BINARY_DIR}/cppan.cmake)\n")
+ export(TARGETS libtesseract APPEND FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
+else()
+ target_link_libraries (libtesseract PUBLIC
+ ${Leptonica_LIBRARIES}
+ ${LibArchive_LIBRARIES}
+ )
+ export(TARGETS libtesseract FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
+endif()
+
+if (WIN32 AND CLANG AND OPENMP_BUILD)
+ # Workaround for "libomp.lib is not automatically added on Windows"
+ # see: http://lists.llvm.org/pipermail/openmp-dev/2015-August/000857.html
+ target_link_libraries (libtesseract PRIVATE ${OpenMP_LIBRARY})
+endif()
+
+########################################
+# EXECUTABLE tesseractmain
+########################################
+
+set(tesseractmain_src src/api/tesseractmain.cpp)
+if (MSVC)
+ set(tesseractmain_rsc ${CMAKE_CURRENT_BINARY_DIR}/vs2010/tesseract/tesseract.rc)
+endif()
+
+add_executable (tesseract ${tesseractmain_src} ${tesseractmain_rsc})
+target_link_libraries (tesseract libtesseract)
+if (HAVE_TIFFIO_H)
+ target_link_libraries(tesseract tiff)
+endif()
+
+if (OPENMP_BUILD AND UNIX)
+target_link_libraries (tesseract pthread)
+endif()
+
+########################################
+
+if (BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/googletest/CMakeLists.txt)
+ add_subdirectory(googletest)
+endif()
+
+if (BUILD_TRAINING_TOOLS)
+add_subdirectory(src/training)
+endif()
+
+get_target_property(tesseract_NAME libtesseract NAME)
+get_target_property(tesseract_VERSION libtesseract VERSION)
+get_target_property(tesseract_OUTPUT_NAME libtesseract OUTPUT_NAME)
+configure_file(tesseract.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/tesseract.pc @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tesseract.pc DESTINATION lib/pkgconfig)
+install(TARGETS tesseract RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+install(TARGETS libtesseract EXPORT TesseractTargets RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+install(EXPORT TesseractTargets DESTINATION cmake)
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/TesseractConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/TesseractConfig-version.cmake
+ DESTINATION cmake)
+
+install(FILES
+ # from api/makefile.am
+ src/api/apitypes.h
+ src/api/baseapi.h
+ src/api/capi.h
+ src/api/renderer.h
+ ${CMAKE_CURRENT_BINARY_DIR}/api/tess_version.h
+
+ #from ccmain/makefile.am
+ src/ccmain/thresholder.h
+ src/ccmain/ltrresultiterator.h
+ src/ccmain/pageiterator.h
+ src/ccmain/resultiterator.h
+ src/ccmain/osdetect.h
+
+ #from ccstruct/makefile.am
+ src/ccstruct/publictypes.h
+
+ #from ccutil/makefile.am
+ src/ccutil/genericvector.h
+ src/ccutil/helpers.h
+ src/ccutil/ocrclass.h
+ src/ccutil/platform.h
+ src/ccutil/serialis.h
+ src/ccutil/strngs.h
+ src/ccutil/tesscallback.h
+ src/ccutil/unichar.h
+ #${CMAKE_CURRENT_BINARY_DIR}/src/endianness.h
+ DESTINATION include/tesseract)
+
+########################################
+# uninstall target
+########################################
+if(NOT TARGET uninstall)
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+
+ add_custom_target(uninstall
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+endif()
+
+###############################################################################
diff --git a/third_party/ocr/tesseract-ocr/uos/aarch64/include/tesseract/baseapi.h b/third_party/ocr/tesseract-ocr/uos/aarch64/include/tesseract/baseapi.h
index 3724dd92..fe12351b 100644
--- a/third_party/ocr/tesseract-ocr/uos/aarch64/include/tesseract/baseapi.h
+++ b/third_party/ocr/tesseract-ocr/uos/aarch64/include/tesseract/baseapi.h
@@ -93,6 +93,8 @@ class TESS_API TessBaseAPI {
TessBaseAPI();
virtual ~TessBaseAPI();
+ int MyOSD();
+
/**
* Returns the version identifier as a static string. Do not delete.
*/
diff --git a/third_party/ocr/tesseract-ocr/uos/aarch64/include/tesseract/capi.h b/third_party/ocr/tesseract-ocr/uos/aarch64/include/tesseract/capi.h
index 7ed64ef4..8752816a 100644
--- a/third_party/ocr/tesseract-ocr/uos/aarch64/include/tesseract/capi.h
+++ b/third_party/ocr/tesseract-ocr/uos/aarch64/include/tesseract/capi.h
@@ -176,6 +176,8 @@ struct Pix;
struct Boxa;
struct Pixa;
+TESS_API int MyOSD(TessBaseAPI* api);
+
/* General free functions */
TESS_API const char* TESS_CALL TessVersion();
diff --git a/third_party/ocr/tesseract-ocr/uos/aarch64/lib/libtesseract.a b/third_party/ocr/tesseract-ocr/uos/aarch64/lib/libtesseract.a
index 355edfb7..9d5a9047 100644
Binary files a/third_party/ocr/tesseract-ocr/uos/aarch64/lib/libtesseract.a and b/third_party/ocr/tesseract-ocr/uos/aarch64/lib/libtesseract.a differ
diff --git a/third_party/ocr/tesseract-ocr/uos/amd64/include/tesseract/baseapi.h b/third_party/ocr/tesseract-ocr/uos/amd64/include/tesseract/baseapi.h
index 3724dd92..fe12351b 100644
--- a/third_party/ocr/tesseract-ocr/uos/amd64/include/tesseract/baseapi.h
+++ b/third_party/ocr/tesseract-ocr/uos/amd64/include/tesseract/baseapi.h
@@ -93,6 +93,8 @@ class TESS_API TessBaseAPI {
TessBaseAPI();
virtual ~TessBaseAPI();
+ int MyOSD();
+
/**
* Returns the version identifier as a static string. Do not delete.
*/
diff --git a/third_party/ocr/tesseract-ocr/uos/amd64/include/tesseract/capi.h b/third_party/ocr/tesseract-ocr/uos/amd64/include/tesseract/capi.h
index 7ed64ef4..8752816a 100644
--- a/third_party/ocr/tesseract-ocr/uos/amd64/include/tesseract/capi.h
+++ b/third_party/ocr/tesseract-ocr/uos/amd64/include/tesseract/capi.h
@@ -176,6 +176,8 @@ struct Pix;
struct Boxa;
struct Pixa;
+TESS_API int MyOSD(TessBaseAPI* api);
+
/* General free functions */
TESS_API const char* TESS_CALL TessVersion();
diff --git a/third_party/ocr/tesseract-ocr/uos/amd64/lib/libtesseract.a b/third_party/ocr/tesseract-ocr/uos/amd64/lib/libtesseract.a
index 3075cb7a..e2a2d25f 100644
Binary files a/third_party/ocr/tesseract-ocr/uos/amd64/lib/libtesseract.a and b/third_party/ocr/tesseract-ocr/uos/amd64/lib/libtesseract.a differ
diff --git a/third_party/ocr/tesseract-ocr/uos/loongarch64/include/tesseract/baseapi.h b/third_party/ocr/tesseract-ocr/uos/loongarch64/include/tesseract/baseapi.h
index 3724dd92..fe12351b 100644
--- a/third_party/ocr/tesseract-ocr/uos/loongarch64/include/tesseract/baseapi.h
+++ b/third_party/ocr/tesseract-ocr/uos/loongarch64/include/tesseract/baseapi.h
@@ -93,6 +93,8 @@ class TESS_API TessBaseAPI {
TessBaseAPI();
virtual ~TessBaseAPI();
+ int MyOSD();
+
/**
* Returns the version identifier as a static string. Do not delete.
*/
diff --git a/third_party/ocr/tesseract-ocr/uos/loongarch64/include/tesseract/capi.h b/third_party/ocr/tesseract-ocr/uos/loongarch64/include/tesseract/capi.h
index 7ed64ef4..8752816a 100644
--- a/third_party/ocr/tesseract-ocr/uos/loongarch64/include/tesseract/capi.h
+++ b/third_party/ocr/tesseract-ocr/uos/loongarch64/include/tesseract/capi.h
@@ -176,6 +176,8 @@ struct Pix;
struct Boxa;
struct Pixa;
+TESS_API int MyOSD(TessBaseAPI* api);
+
/* General free functions */
TESS_API const char* TESS_CALL TessVersion();
diff --git a/third_party/ocr/tesseract-ocr/uos/loongarch64/lib/libtesseract.a b/third_party/ocr/tesseract-ocr/uos/loongarch64/lib/libtesseract.a
index 866ad476..2d3370f7 100644
Binary files a/third_party/ocr/tesseract-ocr/uos/loongarch64/lib/libtesseract.a and b/third_party/ocr/tesseract-ocr/uos/loongarch64/lib/libtesseract.a differ
diff --git a/third_party/ocr/tesseract-ocr/uos/mips64/include/tesseract/baseapi.h b/third_party/ocr/tesseract-ocr/uos/mips64/include/tesseract/baseapi.h
index 3724dd92..fe12351b 100644
--- a/third_party/ocr/tesseract-ocr/uos/mips64/include/tesseract/baseapi.h
+++ b/third_party/ocr/tesseract-ocr/uos/mips64/include/tesseract/baseapi.h
@@ -93,6 +93,8 @@ class TESS_API TessBaseAPI {
TessBaseAPI();
virtual ~TessBaseAPI();
+ int MyOSD();
+
/**
* Returns the version identifier as a static string. Do not delete.
*/
diff --git a/third_party/ocr/tesseract-ocr/uos/mips64/include/tesseract/capi.h b/third_party/ocr/tesseract-ocr/uos/mips64/include/tesseract/capi.h
index 7ed64ef4..8752816a 100644
--- a/third_party/ocr/tesseract-ocr/uos/mips64/include/tesseract/capi.h
+++ b/third_party/ocr/tesseract-ocr/uos/mips64/include/tesseract/capi.h
@@ -176,6 +176,8 @@ struct Pix;
struct Boxa;
struct Pixa;
+TESS_API int MyOSD(TessBaseAPI* api);
+
/* General free functions */
TESS_API const char* TESS_CALL TessVersion();
diff --git a/third_party/ocr/tesseract-ocr/uos/mips64/lib/libtesseract.a b/third_party/ocr/tesseract-ocr/uos/mips64/lib/libtesseract.a
index 28e0c5f6..1e740828 100644
Binary files a/third_party/ocr/tesseract-ocr/uos/mips64/lib/libtesseract.a and b/third_party/ocr/tesseract-ocr/uos/mips64/lib/libtesseract.a differ