Skip to content

Commit 8532e65

Browse files
committed
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
2 parents 90780db + 15e7f41 commit 8532e65

File tree

5 files changed

+89
-18
lines changed

5 files changed

+89
-18
lines changed

modules/hfs/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
if(HAVE_CUDA)
22
add_definitions(-D_HFS_CUDA_ON_)
3+
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
34
endif()
45

56
set(the_description "Hierarchical Feature Selection for Efficient Image Segmentation")

modules/text/CMakeLists.txt

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
set(the_description "Text Detection and Recognition")
2-
ocv_define_module(text opencv_ml opencv_imgproc opencv_core opencv_features2d opencv_dnn OPTIONAL opencv_highgui WRAP python java)
2+
set(__extra_deps "")
3+
if(DEBUG_opencv_text)
4+
list(APPEND __extra_deps PRIVATE_REQUIRED opencv_highgui)
5+
endif()
6+
7+
ocv_define_module(text
8+
opencv_ml opencv_imgproc opencv_core opencv_features2d opencv_dnn
9+
${__extra_deps}
10+
WRAP
11+
python
12+
java
13+
)
314

4-
if(NOT CMAKE_CROSSCOMPILING OR OPENCV_FIND_TESSERACT)
5-
find_package(Tesseract QUIET) # Prefer CMake's standard locations (including Tesseract_DIR)
6-
if(NOT Tesseract_FOUND)
7-
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindTesseract.cmake") # OpenCV's fallback
8-
endif()
9-
if(Tesseract_FOUND)
10-
if(Tesseract_VERSION)
11-
message(STATUS "Tesseract: YES (ver ${Tesseract_VERSION})")
12-
else()
13-
message(STATUS "Tesseract: YES (ver unknown)")
14-
endif()
15-
set(HAVE_TESSERACT 1)
16-
ocv_include_directories(${Tesseract_INCLUDE_DIRS})
17-
ocv_target_link_libraries(${the_module} ${Tesseract_LIBRARIES})
18-
else()
19-
message(STATUS "Tesseract: NO")
20-
endif()
15+
if(TARGET ocv.3rdparty.tesseract)
16+
ocv_target_link_libraries(${the_module} LINK_PRIVATE ocv.3rdparty.tesseract)
2117
endif()
2218

2319
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/text_config.hpp.in
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#if !defined(USE_STD_NAMESPACE)
2+
#define USE_STD_NAMESPACE
3+
#endif
4+
#include <tesseract/baseapi.h>
5+
#include <tesseract/resultiterator.h>
6+
7+
static void test()
8+
{
9+
tesseract::TessBaseAPI tess;
10+
}
11+
12+
int main() { test(); return 0; }

modules/text/cmake/init.cmake

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
OCV_OPTION(WITH_TESSERACT "Include Tesseract OCR library support" (NOT CMAKE_CROSSCOMPILING)
2+
VERIFY HAVE_TESSERACT)
3+
4+
if(NOT HAVE_TESSERACT
5+
AND (WITH_TESSERACT OR OPENCV_FIND_TESSERACT)
6+
)
7+
if(NOT Tesseract_FOUND)
8+
find_package(Tesseract QUIET) # Prefer CMake's standard locations (including Tesseract_DIR)
9+
endif()
10+
if(NOT Tesseract_FOUND)
11+
include("${CMAKE_CURRENT_LIST_DIR}/FindTesseract.cmake") # OpenCV's fallback
12+
endif()
13+
if(Tesseract_FOUND)
14+
if(Tesseract_VERSION)
15+
message(STATUS "Tesseract: YES (ver ${Tesseract_VERSION})")
16+
else()
17+
message(STATUS "Tesseract: YES (ver unknown)")
18+
endif()
19+
if(NOT ENABLE_CXX11 AND NOT OPENCV_SKIP_TESSERACT_BUILD_CHECK)
20+
try_compile(__VALID_TESSERACT
21+
"${OpenCV_BINARY_DIR}/cmake_check/tesseract"
22+
"${CMAKE_CURRENT_LIST_DIR}/checks/tesseract_test.cpp"
23+
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${Tesseract_INCLUDE_DIRS}"
24+
LINK_LIBRARIES ${Tesseract_LIBRARIES}
25+
OUTPUT_VARIABLE TRY_OUT
26+
)
27+
if(NOT __VALID_TESSERACT)
28+
if(OPENCV_DEBUG_TESSERACT_BUILD)
29+
message(STATUS "${TRY_OUT}")
30+
endif()
31+
message(STATUS "Can't use Tesseract (details: https://github.com/opencv/opencv_contrib/pull/2220)")
32+
return()
33+
endif()
34+
endif()
35+
set(HAVE_TESSERACT 1)
36+
set(HAVE_TESSERACT 1)
37+
38+
# TODO use ocv_add_external_target
39+
set(name "tesseract")
40+
set(inc "${Tesseract_INCLUDE_DIRS}")
41+
set(link "${Tesseract_LIBRARIES}")
42+
set(def "")
43+
if(BUILD_SHARED_LIBS)
44+
set(imp IMPORTED)
45+
endif()
46+
add_library(ocv.3rdparty.${name} INTERFACE ${imp})
47+
set_target_properties(ocv.3rdparty.${name} PROPERTIES
48+
INTERFACE_INCLUDE_DIRECTORIES "${inc}"
49+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${inc}"
50+
INTERFACE_LINK_LIBRARIES "${link}"
51+
INTERFACE_COMPILE_DEFINITIONS "${def}")
52+
if(NOT BUILD_SHARED_LIBS)
53+
install(TARGETS ocv.3rdparty.${name} EXPORT OpenCVModules)
54+
endif()
55+
56+
else()
57+
message(STATUS "Tesseract: NO")
58+
endif()
59+
endif()

modules/xfeatures2d/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
set(the_description "Contributed/Experimental Algorithms for Salient 2D Features Detection")
22

3+
if(HAVE_CUDA)
4+
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
5+
endif()
36
ocv_define_module(xfeatures2d opencv_core opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_shape opencv_ml opencv_cudaarithm WRAP python java)
47

58
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_vgg.cmake)

0 commit comments

Comments
 (0)