Skip to content

Commit f8e26ee

Browse files
committed
fix cmake windows version info for tesseract library and executable
1 parent d28439c commit f8e26ee

File tree

3 files changed

+119
-8
lines changed

3 files changed

+119
-8
lines changed

CMakeLists.txt

+17-7
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ configure_file(
126126
configure_file(
127127
${CMAKE_SOURCE_DIR}/vs2010/tesseract/tesseract.rc.in
128128
${CMAKE_BINARY_DIR}/vs2010/tesseract/tesseract.rc @ONLY)
129+
configure_file(
130+
${CMAKE_SOURCE_DIR}/vs2010/tesseract/libtesseract.rc.in
131+
${CMAKE_BINARY_DIR}/vs2010/tesseract/libtesseract.rc @ONLY)
129132
configure_file(
130133
${CMAKE_SOURCE_DIR}/cmake/templates/TesseractConfig-version.cmake.in
131134
${CMAKE_BINARY_DIR}/TesseractConfig-version.cmake @ONLY)
@@ -214,6 +217,11 @@ set(tesseract_src ${tesseract_src}
214217

215218
if (WIN32)
216219
if (MSVC)
220+
include_directories(vs2010/tesseract)
221+
set(tesseract_hdr
222+
${tesseract_hdr}
223+
${CMAKE_CURRENT_SOURCE_DIR}/vs2010/tesseract/resource.h)
224+
set(tesseract_rsc ${CMAKE_BINARY_DIR}/vs2010/tesseract/libtesseract.rc)
217225
set_source_files_properties(
218226
${CMAKE_CURRENT_SOURCE_DIR}/arch/dotproductsse.cpp
219227
PROPERTIES COMPILE_DEFINITIONS __SSE4_1__)
@@ -242,7 +250,9 @@ else()
242250
PROPERTIES COMPILE_FLAGS "-mavx2")
243251
endif()
244252

245-
add_library (libtesseract ${LIBRARY_TYPE} ${tesseract_src} ${tesseract_hdr})
253+
add_library (libtesseract ${LIBRARY_TYPE} ${tesseract_src} ${tesseract_hdr}
254+
${tesseract_rsc}
255+
)
246256
if (NOT STATIC)
247257
target_compile_definitions (libtesseract
248258
PRIVATE -DTESS_EXPORTS
@@ -273,12 +283,12 @@ endif()
273283
# EXECUTABLE tesseractmain
274284
########################################
275285

276-
set(tesseractmain_src
277-
api/tesseractmain.cpp
278-
vs2010/tesseract/resource.h
279-
vs2010/tesseract/tesseract.rc
280-
)
281-
add_executable (tesseract ${tesseractmain_src})
286+
set(tesseractmain_src api/tesseractmain.cpp)
287+
if (MSVC)
288+
set(tesseractmain_rsc ${CMAKE_BINARY_DIR}/vs2010/tesseract/tesseract.rc)
289+
endif()
290+
291+
add_executable (tesseract ${tesseractmain_src} ${tesseractmain_rsc})
282292
target_link_libraries (tesseract libtesseract)
283293

284294
########################################

vs2010/tesseract/libtesseract.rc.in

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// Microsoft Visual C++ generated resource script.
2+
//
3+
#include "resource.h"
4+
5+
#define APSTUDIO_READONLY_SYMBOLS
6+
/////////////////////////////////////////////////////////////////////////////
7+
//
8+
// Generated from the TEXTINCLUDE 2 resource.
9+
//
10+
#include "windows.h"
11+
12+
/////////////////////////////////////////////////////////////////////////////
13+
#undef APSTUDIO_READONLY_SYMBOLS
14+
15+
/////////////////////////////////////////////////////////////////////////////
16+
// English (U.S.) resources
17+
18+
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19+
#ifdef _WIN32
20+
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21+
#pragma code_page(1252)
22+
#endif //_WIN32
23+
24+
#ifdef APSTUDIO_INVOKED
25+
/////////////////////////////////////////////////////////////////////////////
26+
//
27+
// TEXTINCLUDE
28+
//
29+
30+
1 TEXTINCLUDE
31+
BEGIN
32+
"resource.h\0"
33+
END
34+
35+
2 TEXTINCLUDE
36+
BEGIN
37+
"#include ""afxres.h""\r\n"
38+
"\0"
39+
END
40+
41+
3 TEXTINCLUDE
42+
BEGIN
43+
"\r\n"
44+
"\0"
45+
END
46+
47+
#endif // APSTUDIO_INVOKED
48+
49+
50+
/////////////////////////////////////////////////////////////////////////////
51+
//
52+
// Version
53+
//
54+
55+
VS_VERSION_INFO VERSIONINFO
56+
FILEVERSION @GENERIC_MAJOR_VERSION@,@GENERIC_MINOR_VERSION@,@GENERIC_MICRO_VERSION@,0
57+
PRODUCTVERSION @GENERIC_MAJOR_VERSION@,@GENERIC_MINOR_VERSION@,@GENERIC_MICRO_VERSION@,0
58+
FILEFLAGSMASK 0x17L
59+
#ifdef _DEBUG
60+
FILEFLAGS 0x1L
61+
#else
62+
FILEFLAGS 0x0L
63+
#endif
64+
FILEOS 0x4L
65+
FILETYPE 0x7L
66+
FILESUBTYPE 0x0L
67+
BEGIN
68+
BLOCK "StringFileInfo"
69+
BEGIN
70+
BLOCK "040904b0"
71+
BEGIN
72+
VALUE "FileDescription", "Tesseract OCR library"
73+
VALUE "FileVersion", "@GENERIC_MAJOR_VERSION@,@GENERIC_MINOR_VERSION@,@GENERIC_MICRO_VERSION@,0"
74+
VALUE "InternalName", "libtesseract"
75+
VALUE "LegalCopyright", "Copyright (C) 2018 Google, Inc. Licensed under the Apache License, Version 2.0"
76+
VALUE "OriginalFilename", "tesseract@GENERIC_MAJOR_VERSION@@[email protected]"
77+
VALUE "ProductName", "Tesseract OCR Library"
78+
VALUE "ProductVersion", "@PACKAGE_VERSION@"
79+
END
80+
END
81+
BLOCK "VarFileInfo"
82+
BEGIN
83+
VALUE "Translation", 0x409, 1200
84+
END
85+
END
86+
87+
#endif // English (U.S.) resources
88+
/////////////////////////////////////////////////////////////////////////////
89+
90+
91+
92+
#ifndef APSTUDIO_INVOKED
93+
/////////////////////////////////////////////////////////////////////////////
94+
//
95+
// Generated from the TEXTINCLUDE 3 resource.
96+
//
97+
98+
99+
/////////////////////////////////////////////////////////////////////////////
100+
#endif // not APSTUDIO_INVOKED
101+

vs2010/tesseract/tesseract.rc.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ BEGIN
7272
VALUE "FileDescription", "Tesseract command-line OCR engine"
7373
VALUE "FileVersion", "@GENERIC_MAJOR_VERSION@,@GENERIC_MINOR_VERSION@,@GENERIC_MICRO_VERSION@,0"
7474
VALUE "InternalName", "tesseract"
75-
VALUE "LegalCopyright", "Copyright (C) 2016 Google, Inc. Licensed under the Apache License, Version 2.0"
75+
VALUE "LegalCopyright", "Copyright (C) 2018 Google, Inc. Licensed under the Apache License, Version 2.0"
7676
VALUE "OriginalFilename", "tesseract.exe"
7777
VALUE "ProductName", "Tesseract-OCR"
7878
VALUE "ProductVersion", "@PACKAGE_VERSION@"

0 commit comments

Comments
 (0)