2
2
# tesseract
3
3
#
4
4
5
- if (STATIC OR NOT (WIN32 OR CYGWIN ))
6
-
7
- # experimental
8
- if (MSVC )
9
-
10
- include (CheckTypeSize)
11
- check_type_size("void *" SIZEOF_VOID_P)
12
-
13
- if (SIZEOF_VOID_P EQUAL 8)
14
- set (X64 1)
15
- set (ARCH_DIR_NAME 64)
16
- elseif (SIZEOF_VOID_P EQUAL 4)
17
- set (X86 1)
18
- set (ARCH_DIR_NAME 32)
19
- else ()
20
- message (FATAL_ERROR "Cannot determine target architecture" )
5
+ if (NOT CPPAN_BUILD AND NOT (WIN32 OR CYGWIN ))
6
+ return ()
21
7
endif ()
22
8
23
- set (icu_dir "${CMAKE_CURRENT_BINARY_DIR} /icu" )
24
- set (icu_archive "${icu_dir} /icu${ARCH_DIR_NAME} .zip" )
25
-
26
- if (X86)
27
- set (icu_hash 45167a240b60e36b59a87eda23490ce4)
28
- else ()
29
- set (icu_hash 480c72491576c048de1218c3c5519399)
9
+ if (CPPAN_BUILD)
10
+ set (ICU_FOUND 1)
30
11
endif ()
31
12
32
- message (STATUS "Downloading latest ICU binaries" )
33
-
34
- file (DOWNLOAD
35
- "http://download.icu-project.org/files/icu4c/56.1/icu4c-56_1-Win${ARCH_DIR_NAME} -msvc10.zip"
36
- "${icu_archive} "
37
- SHOW_PROGRESS
38
- INACTIVITY_TIMEOUT 60 # seconds
39
- EXPECTED_HASH MD5=${icu_hash}
40
- )
41
- execute_process (COMMAND ${CMAKE_COMMAND} -E tar xz "${icu_archive} "
42
- WORKING_DIRECTORY "${icu_dir} "
43
- RESULT_VARIABLE __result
44
- )
45
- if (NOT __result EQUAL 0)
46
- message (FATAL_ERROR "error ${__result} " )
13
+ # experimental
14
+ if (MSVC AND NOT CPPAN_BUILD)
15
+ include (CheckTypeSize)
16
+ check_type_size("void *" SIZEOF_VOID_P)
17
+
18
+ if (SIZEOF_VOID_P EQUAL 8)
19
+ set (X64 1)
20
+ set (ARCH_DIR_NAME 64)
21
+ elseif (SIZEOF_VOID_P EQUAL 4)
22
+ set (X86 1)
23
+ set (ARCH_DIR_NAME 32)
24
+ else ()
25
+ message (FATAL_ERROR "Cannot determine target architecture" )
26
+ endif ()
27
+
28
+ set (icu_dir "${CMAKE_CURRENT_BINARY_DIR} /icu" )
29
+ set (icu_archive "${icu_dir} /icu${ARCH_DIR_NAME} .zip" )
30
+
31
+ if (X86)
32
+ set (icu_hash 45167a240b60e36b59a87eda23490ce4)
33
+ else ()
34
+ set (icu_hash 480c72491576c048de1218c3c5519399)
35
+ endif ()
36
+
37
+ message (STATUS "Downloading latest ICU binaries" )
38
+
39
+ file (DOWNLOAD
40
+ "http://download.icu-project.org/files/icu4c/56.1/icu4c-56_1-Win${ARCH_DIR_NAME} -msvc10.zip"
41
+ "${icu_archive} "
42
+ SHOW_PROGRESS
43
+ INACTIVITY_TIMEOUT 60 # seconds
44
+ EXPECTED_HASH MD5=${icu_hash}
45
+ )
46
+ execute_process (COMMAND ${CMAKE_COMMAND} -E tar xz "${icu_archive} "
47
+ WORKING_DIRECTORY "${icu_dir} "
48
+ RESULT_VARIABLE __result
49
+ )
50
+ if (NOT __result EQUAL 0)
51
+ message (FATAL_ERROR "error ${__result} " )
52
+ endif ()
53
+
54
+ set (ICU_ROOT ${icu_dir} /icu)
47
55
endif ()
48
-
49
- set (ICU_ROOT ${icu_dir} /icu)
50
-
51
- endif (MSVC )
52
56
# experimental
53
57
58
+ if (NOT CPPAN_BUILD)
54
59
find_package (ICU COMPONENTS uc i18n)
60
+ endif ()
55
61
56
62
########################################
57
63
# LIBRARY tessopt
@@ -159,7 +165,9 @@ project_group (wordlist2dawg "Training Tools")
159
165
160
166
if (ICU_FOUND)
161
167
168
+ if (NOT CPPAN_BUILD)
162
169
include_directories (${ICU_INCLUDE_DIRS} )
170
+ endif ()
163
171
164
172
########################################
165
173
# LIBRARY unicharset_training
@@ -177,7 +185,11 @@ set(unicharset_training_src
177
185
unicharset_training_utils.h
178
186
)
179
187
add_library (unicharset_training ${unicharset_training_src} )
188
+ if (NOT CPPAN_BUILD)
180
189
target_link_libraries (unicharset_training common_training ${ICU_LIBRARIES} )
190
+ else ()
191
+ target_link_libraries (unicharset_training common_training pvt.cppan.demo.unicode.icu.i18n)
192
+ endif ()
181
193
project_group (unicharset_training "Training Tools" )
182
194
183
195
@@ -198,6 +210,7 @@ add_executable (lstmtraining lstmtraining.cpp)
198
210
target_link_libraries (lstmtraining unicharset_training)
199
211
project_group (lstmtraining "Training Tools" )
200
212
213
+
201
214
########################################
202
215
# EXECUTABLE set_unicharset_properties
203
216
########################################
@@ -211,6 +224,10 @@ project_group (set_unicharset_properties "Training Tools")
211
224
# EXECUTABLE text2image
212
225
########################################
213
226
227
+ if (NOT CPPAN_BUILD)
228
+ find_package (PkgConfig)
229
+ endif ()
230
+
214
231
if (PKG_CONFIG_FOUND)
215
232
216
233
pkg_check_modules(Pango REQUIRED pango)
@@ -246,7 +263,6 @@ add_executable (text2image ${text2image_src})
246
263
target_include_directories (text2image BEFORE PRIVATE ${Cairo_INCLUDE_DIRS} ${Pango_INCLUDE_DIRS} )
247
264
target_compile_definitions (text2image PRIVATE -DPANGO_ENABLE_ENGINE)
248
265
target_link_libraries (text2image tesseract unicharset_training
249
- ${ICU_LIBRARIES}
250
266
${Pango_LIBRARIES}
251
267
${Cairo_LIBRARIES}
252
268
${PangoCairo_LIBRARIES}
@@ -257,6 +273,5 @@ project_group (text2image "Training Tools")
257
273
258
274
endif (PKG_CONFIG_FOUND)
259
275
endif (ICU_FOUND)
260
- endif (STATIC OR NOT (WIN32 OR CYGWIN ))
261
276
262
277
###############################################################################
0 commit comments