package An official xmake package repository
https://xrepo.xmake.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.9 KiB
41 lines
1.9 KiB
4 years ago
|
package("tesseract")
|
||
|
|
||
|
set_homepage("https://tesseract-ocr.github.io/")
|
||
|
set_description("Tesseract Open Source OCR Engine")
|
||
|
set_license("Apache-2.0")
|
||
|
|
||
|
add_urls("https://github.com/tesseract-ocr/tesseract/archive/$(version).tar.gz",
|
||
|
"https://github.com/tesseract-ocr/tesseract.git")
|
||
|
add_versions("4.1.1", "2a66ff0d8595bff8f04032165e6c936389b1e5727c3ce5a27b3e059d218db1cb")
|
||
|
|
||
|
add_configs("training", {description = "Build training tools.", default = false, type = "boolean"})
|
||
|
|
||
|
add_deps("cmake")
|
||
|
add_deps("leptonica")
|
||
|
add_deps("libarchive", {optional = true})
|
||
|
on_load(function (package)
|
||
|
if package:config("training") then
|
||
|
package:add("deps", "icu4c")
|
||
|
end
|
||
|
end)
|
||
|
|
||
|
on_install("windows", "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"}
|
||
|
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
|
||
|
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
|
||
|
table.insert(configs, "-DWIN32_MT_BUILD=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
|
||
|
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
|
||
|
import("package.tools.cmake").install(package, configs)
|
||
|
package:addenv("PATH", "bin")
|
||
|
end)
|
||
|
|
||
|
on_test(function (package)
|
||
|
os.vrun("tesseract --version")
|
||
|
assert(package:has_cxxtypes("tesseract::TessBaseAPI", {configs = {languages = "c++11"}, includes = "tesseract/baseapi.h"}))
|
||
|
end)
|