From b5578ed6a552eab8c714fd8a6bffed394f603ec3 Mon Sep 17 00:00:00 2001 From: A2va <49582555+A2va@users.noreply.github.com> Date: Mon, 27 Feb 2023 15:21:49 +0100 Subject: [PATCH] Add tesseract option to opencv (#1870) --- packages/o/opencv/xmake.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/o/opencv/xmake.lua b/packages/o/opencv/xmake.lua index 186679555..4fa934957 100644 --- a/packages/o/opencv/xmake.lua +++ b/packages/o/opencv/xmake.lua @@ -25,6 +25,7 @@ package("opencv") add_resources("3.4.9", "opencv_contrib", "https://github.com/opencv/opencv_contrib/archive/3.4.9.tar.gz", "dc7d95be6aaccd72490243efcec31e2c7d3f21125f88286186862cf9edb14a57") add_configs("bundled", {description = "Build 3rd-party libraries with OpenCV.", default = true, type = "boolean"}) + add_configs("tesseract", {description = "Enable tesseract on text module", default = false, type = "boolean"}) local features = {"1394", "vtk", @@ -110,6 +111,10 @@ package("opencv") if not package.is_built or package:is_built() then package:add("deps", "cmake", "python 3.x", {kind = "binary"}) end + + if package:config("tesseract") then + package:add("deps", "tesseract 4.1.3") -- Opencv need tesseract from the v4 series + end end) on_install("linux", "macosx", "windows", "mingw@windows,msys", function (package) @@ -125,6 +130,10 @@ package("opencv") "-DBUILD_opencv_python2=OFF", "-DBUILD_opencv_python3=OFF", "-DBUILD_JAVA=OFF"} + + if package:config("tesseract") then + table.insert(configs, "-DWITH_TESSERACT=ON") + end if package:config("bundled") then table.insert(configs, "-DOPENCV_FORCE_3RDPARTY_BUILD=ON") end