mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
commit
bb15031266
@ -41,5 +41,5 @@ install:
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -DLeptonica_DIR=leptonica-master/build
|
||||
- cmake .. -DLeptonica_BUILD_DIR=leptonica-master/build
|
||||
- make
|
||||
|
@ -44,7 +44,14 @@ set(VERSION_MAJOR 3)
|
||||
set(VERSION_MINOR 05)
|
||||
set(VERSION_PLAIN ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
|
||||
find_package(Leptonica 1.72 REQUIRED)
|
||||
set(MINIMUM_LEPTONICA_VERSION 1.71)
|
||||
|
||||
if (NOT Leptonica_BUILD_DIR)
|
||||
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED)
|
||||
else()
|
||||
set(Leptonica_DIR ${Leptonica_BUILD_DIR})
|
||||
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
find_package(ICU COMPONENTS uc i18n)
|
||||
find_package(OpenCL QUIET)
|
||||
@ -142,6 +149,8 @@ include_directories(wordrec)
|
||||
# LIBRARY tesseract
|
||||
########################################
|
||||
|
||||
string(SUBSTRING ${VERSION_MINOR} 0 1 VERSION_MINOR_0)
|
||||
string(SUBSTRING ${VERSION_MINOR} 1 1 VERSION_MINOR_1)
|
||||
|
||||
file(GLOB tesseract_src
|
||||
"ccmain/*.cpp"
|
||||
@ -191,8 +200,12 @@ if (NOT STATIC)
|
||||
target_compile_definitions (tesseract PUBLIC -DTESS_EXPORTS)
|
||||
endif()
|
||||
target_link_libraries (tesseract ${Leptonica_LIBRARIES} ${LIB_Ws2_32} ${LIB_pthread})
|
||||
set_target_properties (tesseract PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR_0}.${VERSION_MINOR_1})
|
||||
set_target_properties (tesseract PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR_0}.${VERSION_MINOR_1})
|
||||
if (WIN32)
|
||||
set_target_properties (tesseract PROPERTIES OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR})
|
||||
set_target_properties (tesseract PROPERTIES DEBUG_OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR}d)
|
||||
endif()
|
||||
export(TARGETS tesseract FILE ${CMAKE_BINARY_DIR}/TesseractTargets.cmake)
|
||||
|
||||
|
||||
|
@ -20,5 +20,5 @@ before_build:
|
||||
build_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -G "%generator%" -DLeptonica_DIR=leptonica-master/build -DSTATIC=1
|
||||
- cmake .. -G "%generator%" -DLeptonica_BUILD_DIR=leptonica-master/build -DSTATIC=1
|
||||
- msbuild tesseract.sln /p:Platform=%vcplatform% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
|
52
cmake/FindLeptonica.cmake
Normal file
52
cmake/FindLeptonica.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
#
|
||||
# Find Leptonica
|
||||
#
|
||||
# Exported variables:
|
||||
# Leptonica_FOUND
|
||||
# Leptonica_INCLUDE_DIRS
|
||||
# Leptonica_LIBRARIES
|
||||
#
|
||||
# Leptonica_VERSION
|
||||
# Leptonica_MAJOR_VERSION
|
||||
# Leptonica_MINOR_VERSION
|
||||
#
|
||||
|
||||
find_path(Leptonica_INCLUDE_DIR leptonica/allheaders.h
|
||||
HINTS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/include
|
||||
/opt/local/include
|
||||
${Leptonica_DIR}/include
|
||||
)
|
||||
if(NOT "${Leptonica_INCLUDE_DIR}" EQUAL "Leptonica_INCLUDE_DIR-NOTFOUND")
|
||||
set(Leptonica_INCLUDE_DIRS ${Leptonica_INCLUDE_DIR}/leptonica)
|
||||
file(STRINGS ${Leptonica_INCLUDE_DIRS}/allheaders.h Leptonica_MAJOR_VERSION REGEX "LIBLEPT_MAJOR_VERSION")
|
||||
file(STRINGS ${Leptonica_INCLUDE_DIRS}/allheaders.h Leptonica_MINOR_VERSION REGEX "LIBLEPT_MINOR_VERSION")
|
||||
string(REGEX MATCH "[0-9]+" Leptonica_MAJOR_VERSION ${Leptonica_MAJOR_VERSION})
|
||||
string(REGEX MATCH "[0-9]+" Leptonica_MINOR_VERSION ${Leptonica_MINOR_VERSION})
|
||||
set(Leptonica_VERSION ${Leptonica_MAJOR_VERSION}.${Leptonica_MINOR_VERSION})
|
||||
endif()
|
||||
|
||||
find_library(Leptonica_LIBRARY NAMES lept liblept
|
||||
HINTS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/lib
|
||||
/opt/local/lib
|
||||
${Leptonica_DIR}/lib
|
||||
)
|
||||
set(Leptonica_LIBRARIES ${Leptonica_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(Leptonica
|
||||
REQUIRED_VARS
|
||||
Leptonica_INCLUDE_DIRS
|
||||
Leptonica_LIBRARIES
|
||||
VERSION_VAR Leptonica_VERSION
|
||||
FAIL_MESSAGE "Try to set Leptonica_DIR or Leptonica_ROOT"
|
||||
)
|
||||
|
||||
mark_as_advanced(Leptonica_INCLUDE_DIRS Leptonica_LIBRARIES)
|
||||
|
Loading…
Reference in New Issue
Block a user