mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 12:49:35 +08:00
Add Leptonica_BUILD_DIR option for CMake find_package in Config mode. Set correct .so name on Linux.
This commit is contained in:
parent
a614edbe94
commit
dfb5aa5c34
@ -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,13 @@ set(VERSION_MAJOR 3)
|
||||
set(VERSION_MINOR 05)
|
||||
set(VERSION_PLAIN ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
|
||||
find_package(Leptonica 1.71 REQUIRED)
|
||||
set(MINIMUM_LEPTONICA_VERSION 1.71)
|
||||
|
||||
if (NOT Leptonica_BUILD_DIR)
|
||||
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED)
|
||||
else()
|
||||
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
find_package(ICU COMPONENTS uc i18n)
|
||||
find_package(OpenCL QUIET)
|
||||
@ -142,6 +148,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 +199,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"
|
||||
|
@ -17,8 +17,9 @@ find_path(Leptonica_INCLUDE_DIR leptonica/allheaders.h
|
||||
/usr/local/include
|
||||
/opt/include
|
||||
/opt/local/include
|
||||
${Leptonica_DIR}/include
|
||||
)
|
||||
if(NOT Leptonica_INCLUDE_DIR-NOTFOUND)
|
||||
if("${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")
|
||||
@ -33,6 +34,7 @@ find_library(Leptonica_LIBRARY NAMES lept liblept
|
||||
/usr/local/lib
|
||||
/opt/lib
|
||||
/opt/local/lib
|
||||
${Leptonica_DIR}/lib
|
||||
)
|
||||
set(Leptonica_LIBRARIES ${Leptonica_LIBRARY})
|
||||
|
||||
@ -43,6 +45,7 @@ find_package_handle_standard_args(Leptonica
|
||||
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