improve leptonica and tesseract (#1579)

* improve leptonica and tesseract

* fix build

* force libwebp dependency

* see detailed log

* check log on macos

* fix libjpeg-turbo for arm windows

* use lower case

* Update xmake.lua

* Update macos.yml

* Update macos.yml

* Update windows.yml

* Update xmake.lua

Co-authored-by: ruki <waruqi@gmail.com>
pull/1586/head
Hoildkv 2 years ago committed by GitHub
parent fbee3d80d7
commit 759d24db47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      packages/l/leptonica/xmake.lua
  2. 5
      packages/l/libjpeg-turbo/xmake.lua
  3. 29
      packages/t/tesseract/xmake.lua

@ -13,14 +13,15 @@ package("leptonica")
add_deps("cmake")
add_deps("libwebp", {configs = {libwebpmux = true}})
add_deps("zlib", "libtiff", "libpng", "libjpeg", "giflib")
on_load("windows", function (package)
on_load("windows", "macosx", "linux", function (package)
if package:config("shared") then
package:add("defines", "LIBLEPT_IMPORTS")
end
end)
on_install("windows", "linux", function (package)
local configs = {"-DSW_BUILD=OFF"}
on_install("windows", "macosx", "linux", function (package)
io.replace("CMakeLists.txt", "NOT JP2K", "FALSE", {plain = true})
local configs = {"-DSW_BUILD=OFF", "-DCMAKE_FIND_FRAMEWORK=LAST", "-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)

@ -46,8 +46,9 @@ package("libjpeg-turbo")
if package:is_plat("windows") and package:config("vs_runtime"):startswith("MD") then
table.insert(configs, "-DWITH_CRT_DLL=ON")
end
if package:config("pic") ~= false then
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
if package:is_plat("windows") and package:is_arch("arm64") then
io.replace("CMakeLists.txt", 'message(STATUS "${BITS}-bit build (${CPU_TYPE})")',
'set(CPU_TYPE arm64)\nmessage(STATUS "${BITS}-bit build (${CPU_TYPE})")', {plain = true})
end
table.insert(configs, "-DCMAKE_INSTALL_LIBDIR:PATH=lib")
import("package.tools.cmake").install(package, configs)

@ -8,24 +8,35 @@ package("tesseract")
"https://github.com/tesseract-ocr/tesseract.git")
add_versions("4.1.1", "2a66ff0d8595bff8f04032165e6c936389b1e5727c3ce5a27b3e059d218db1cb")
add_versions("4.1.3", "83dc56b544be938983f528c777e4e1d906205b0f6dc0110afc223f2cc1cec6d3")
add_versions("5.0.1","eba4deb2f92a3f89a6623812074af8c53b772079525b3c263aa70bbf7b748b3c")
add_versions("5.2.0","eba4deb2f92a3f89a6623812074af8c53b772079525b3c263aa70bbf7b748b3c")
add_versions("5.0.1", "b5b0e561650ed67feb1e9de38d4746121d302ae4c876c95b99b8b6f9f89d5c58")
add_versions("5.2.0", "eba4deb2f92a3f89a6623812074af8c53b772079525b3c263aa70bbf7b748b3c")
add_configs("training", {description = "Build training tools.", default = false, type = "boolean"})
add_configs("training", {description = "Build training tools.", default = false, type = "boolean"})
add_configs("libarchive", {description = "Enable build with libarchive.", default = false, type = "boolean"})
add_configs("libcurl", {description = "Enable build with libcurl.", default = false, type = "boolean"})
add_configs("opencl", {description = "Enable experimental OpenCL support.", default = false, type = "boolean"})
add_deps("cmake")
add_deps("leptonica")
add_deps("libarchive", {optional = true})
on_load("windows", "linux", function (package)
on_load("windows", "macosx", "linux", function (package)
if package:config("training") then
package:add("deps", "icu4c")
end
if package:config("libarchive") then
package:add("deps", "libarchive")
end
if package:config("libcurl") then
package:add("deps", "libcurl")
end
if package:config("opencl") then
package:add("deps", "opencl")
end
if package:config("shared") then
package:add("defines", "TESS_IMPORTS")
end
end)
on_install("windows", "linux", function (package)
on_install("windows|x86", "windows|x64", "macosx", "linux", function (package)
io.replace("CMakeLists.txt", "find_package(PkgConfig)", "", {plain = true})
io.replace("src/training/CMakeLists.txt", "find_package(PkgConfig)", "", {plain = true})
local configs = {"-DSW_BUILD=OFF", "-DBUILD_TESTS=OFF", "-DUSE_SYSTEM_ICU=ON"}
@ -35,9 +46,9 @@ package("tesseract")
table.insert(configs, "-DWIN32_MT_BUILD=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end
table.insert(configs, "-DBUILD_TRAINING_TOOLS=" .. (package:config("training") and "ON" or "OFF"))
if package:config("pic") ~= false then
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
end
table.insert(configs, "-DDISABLE_ARCHIVE=" .. (package:config("libarchive") and "OFF" or "ON"))
table.insert(configs, "-DDISABLE_CURL=" .. (package:config("libcurl") and "OFF" or "ON"))
table.insert(configs, "-DENABLE_OPENCL=" .. (package:config("opencl") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
package:addenv("PATH", "bin")
end)

Loading…
Cancel
Save