Skip to content

Commit f15cd96

Browse files
committed
Download icu on windows to build set_unicharset_properties target.
1 parent f3b20a0 commit f15cd96

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ set(Leptonica_DIR ${Leptonica_BUILD_DIR})
5353
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
5454
endif()
5555

56-
find_package(ICU COMPONENTS uc i18n)
5756
find_package(OpenCL QUIET)
5857
find_package(PkgConfig)
5958

@@ -220,6 +219,7 @@ set(tesseractmain_src
220219
)
221220
add_executable (tesseractmain ${tesseractmain_src})
222221
target_link_libraries (tesseractmain tesseract)
222+
set_target_properties (tesseractmain PROPERTIES OUTPUT_NAME tesseract)
223223

224224
########################################
225225

training/CMakeLists.txt

+48
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,54 @@
44

55
if (STATIC OR NOT (WIN32 OR CYGWIN))
66

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")
21+
endif()
22+
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)
30+
endif()
31+
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+
EXPECTED_HASH MD5=${icu_hash}
39+
)
40+
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xz "${icu_archive}"
41+
WORKING_DIRECTORY "${icu_dir}"
42+
RESULT_VARIABLE __result
43+
)
44+
if(NOT __result EQUAL 0)
45+
message(FATAL_ERROR "error ${__result}")
46+
endif()
47+
48+
set(ICU_ROOT ${icu_dir}/icu)
49+
50+
endif(MSVC)
51+
# experimental
52+
53+
find_package(ICU COMPONENTS uc i18n)
54+
755
########################################
856
# LIBRARY tessopt
957
########################################

0 commit comments

Comments
 (0)