tesseract 4.x headers require C++11 (can't be used by OpenCV 3.4 without C++11)pull/2220/head
parent
4c2ef47680
commit
5959d81f48
3 changed files with 66 additions and 18 deletions
@ -0,0 +1,12 @@ |
|||||||
|
#if !defined(USE_STD_NAMESPACE) |
||||||
|
#define USE_STD_NAMESPACE |
||||||
|
#endif |
||||||
|
#include <tesseract/baseapi.h> |
||||||
|
#include <tesseract/resultiterator.h> |
||||||
|
|
||||||
|
static void test() |
||||||
|
{ |
||||||
|
tesseract::TessBaseAPI tess; |
||||||
|
} |
||||||
|
|
||||||
|
int main() { test(); return 0; } |
@ -0,0 +1,39 @@ |
|||||||
|
OCV_OPTION(WITH_TESSERACT "Include Tesseract OCR library support" (NOT CMAKE_CROSSCOMPILING) |
||||||
|
VERIFY HAVE_TESSERACT) |
||||||
|
|
||||||
|
if(NOT HAVE_TESSERACT |
||||||
|
AND (WITH_TESSERACT OR OPENCV_FIND_TESSERACT) |
||||||
|
) |
||||||
|
if(NOT Tesseract_FOUND) |
||||||
|
find_package(Tesseract QUIET) # Prefer CMake's standard locations (including Tesseract_DIR) |
||||||
|
endif() |
||||||
|
if(NOT Tesseract_FOUND) |
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/FindTesseract.cmake") # OpenCV's fallback |
||||||
|
endif() |
||||||
|
if(Tesseract_FOUND) |
||||||
|
if(Tesseract_VERSION) |
||||||
|
message(STATUS "Tesseract: YES (ver ${Tesseract_VERSION})") |
||||||
|
else() |
||||||
|
message(STATUS "Tesseract: YES (ver unknown)") |
||||||
|
endif() |
||||||
|
if(NOT ENABLE_CXX11 AND NOT OPENCV_SKIP_TESSERACT_BUILD_CHECK) |
||||||
|
try_compile(__VALID_TESSERACT |
||||||
|
"${OpenCV_BINARY_DIR}/cmake_check/tesseract" |
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/checks/tesseract_test.cpp" |
||||||
|
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${Tesseract_INCLUDE_DIRS}" |
||||||
|
LINK_LIBRARIES ${Tesseract_LIBRARIES} |
||||||
|
OUTPUT_VARIABLE TRY_OUT |
||||||
|
) |
||||||
|
if(NOT __VALID_TESSERACT) |
||||||
|
if(OPENCV_DEBUG_TESSERACT_BUILD) |
||||||
|
message(STATUS "${TRY_OUT}") |
||||||
|
endif() |
||||||
|
message(STATUS "Can't use Tesseract (details: https://github.com/opencv/opencv_contrib/pull/2220)") |
||||||
|
return() |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
set(HAVE_TESSERACT 1) |
||||||
|
else() |
||||||
|
message(STATUS "Tesseract: NO") |
||||||
|
endif() |
||||||
|
endif() |
Loading…
Reference in new issue