File tree 4 files changed +19
-4
lines changed
4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -41,5 +41,5 @@ install:
41
41
script :
42
42
- mkdir build
43
43
- cd build
44
- - cmake .. -DLeptonica_DIR =leptonica-master/build
44
+ - cmake .. -DLeptonica_BUILD_DIR =leptonica-master/build
45
45
- make
Original file line number Diff line number Diff line change @@ -44,7 +44,13 @@ set(VERSION_MAJOR 3)
44
44
set (VERSION_MINOR 05)
45
45
set (VERSION_PLAIN ${VERSION_MAJOR} .${VERSION_MINOR} )
46
46
47
- find_package (Leptonica 1.71 REQUIRED)
47
+ set (MINIMUM_LEPTONICA_VERSION 1.71)
48
+
49
+ if (NOT Leptonica_BUILD_DIR)
50
+ find_package (Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED)
51
+ else ()
52
+ find_package (Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
53
+ endif ()
48
54
49
55
find_package (ICU COMPONENTS uc i18n)
50
56
find_package (OpenCL QUIET )
@@ -142,6 +148,8 @@ include_directories(wordrec)
142
148
# LIBRARY tesseract
143
149
########################################
144
150
151
+ string (SUBSTRING ${VERSION_MINOR} 0 1 VERSION_MINOR_0)
152
+ string (SUBSTRING ${VERSION_MINOR} 1 1 VERSION_MINOR_1)
145
153
146
154
file (GLOB tesseract_src
147
155
"ccmain/*.cpp"
@@ -191,8 +199,12 @@ if (NOT STATIC)
191
199
target_compile_definitions (tesseract PUBLIC -DTESS_EXPORTS)
192
200
endif ()
193
201
target_link_libraries (tesseract ${Leptonica_LIBRARIES} ${LIB_Ws2_32} ${LIB_pthread} )
202
+ set_target_properties (tesseract PROPERTIES VERSION ${VERSION_MAJOR} .${VERSION_MINOR_0} .${VERSION_MINOR_1} )
203
+ set_target_properties (tesseract PROPERTIES SOVERSION ${VERSION_MAJOR} .${VERSION_MINOR_0} .${VERSION_MINOR_1} )
204
+ if (WIN32 )
194
205
set_target_properties (tesseract PROPERTIES OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR} )
195
206
set_target_properties (tesseract PROPERTIES DEBUG_OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR} d)
207
+ endif ()
196
208
export (TARGETS tesseract FILE ${CMAKE_BINARY_DIR} /TesseractTargets.cmake)
197
209
198
210
Original file line number Diff line number Diff line change @@ -20,5 +20,5 @@ before_build:
20
20
build_script :
21
21
- mkdir build
22
22
- cd build
23
- - cmake .. -G "%generator%" -DLeptonica_DIR =leptonica-master/build -DSTATIC=1
23
+ - cmake .. -G "%generator%" -DLeptonica_BUILD_DIR =leptonica-master/build -DSTATIC=1
24
24
- msbuild tesseract.sln /p:Platform=%vcplatform% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ find_path(Leptonica_INCLUDE_DIR leptonica/allheaders.h
17
17
/usr/local/include
18
18
/opt/include
19
19
/opt/local/include
20
+ ${Leptonica_DIR} /include
20
21
)
21
- if (NOT Leptonica_INCLUDE_DIR-NOTFOUND )
22
+ if (" ${Leptonica_INCLUDE_DIR} " EQUAL " Leptonica_INCLUDE_DIR-NOTFOUND" )
22
23
set (Leptonica_INCLUDE_DIRS ${Leptonica_INCLUDE_DIR} /leptonica)
23
24
file (STRINGS ${Leptonica_INCLUDE_DIRS} /allheaders.h Leptonica_MAJOR_VERSION REGEX "LIBLEPT_MAJOR_VERSION" )
24
25
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
33
34
/usr/local/lib
34
35
/opt/lib
35
36
/opt/local/lib
37
+ ${Leptonica_DIR} /lib
36
38
)
37
39
set (Leptonica_LIBRARIES ${Leptonica_LIBRARY} )
38
40
@@ -43,6 +45,7 @@ find_package_handle_standard_args(Leptonica
43
45
Leptonica_INCLUDE_DIRS
44
46
Leptonica_LIBRARIES
45
47
VERSION_VAR Leptonica_VERSION
48
+ FAIL_MESSAGE "Try to set Leptonica_DIR or Leptonica_ROOT"
46
49
)
47
50
48
51
mark_as_advanced (Leptonica_INCLUDE_DIRS Leptonica_LIBRARIES)
You can’t perform that action at this time.
0 commit comments