Skip to content

Commit

Permalink
fix cmake windows version info for tesseract library and executable
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Mar 31, 2018
1 parent d28439c commit f8e26ee
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 8 deletions.
24 changes: 17 additions & 7 deletions CMakeLists.txt
Expand Up @@ -126,6 +126,9 @@ configure_file(
configure_file(
${CMAKE_SOURCE_DIR}/vs2010/tesseract/tesseract.rc.in
${CMAKE_BINARY_DIR}/vs2010/tesseract/tesseract.rc @ONLY)
configure_file(
${CMAKE_SOURCE_DIR}/vs2010/tesseract/libtesseract.rc.in
${CMAKE_BINARY_DIR}/vs2010/tesseract/libtesseract.rc @ONLY)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/templates/TesseractConfig-version.cmake.in
${CMAKE_BINARY_DIR}/TesseractConfig-version.cmake @ONLY)
Expand Down Expand Up @@ -214,6 +217,11 @@ set(tesseract_src ${tesseract_src}

if (WIN32)
if (MSVC)
include_directories(vs2010/tesseract)
set(tesseract_hdr
${tesseract_hdr}
${CMAKE_CURRENT_SOURCE_DIR}/vs2010/tesseract/resource.h)
set(tesseract_rsc ${CMAKE_BINARY_DIR}/vs2010/tesseract/libtesseract.rc)
set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/arch/dotproductsse.cpp
PROPERTIES COMPILE_DEFINITIONS __SSE4_1__)
Expand Down Expand Up @@ -242,7 +250,9 @@ else()
PROPERTIES COMPILE_FLAGS "-mavx2")
endif()

add_library (libtesseract ${LIBRARY_TYPE} ${tesseract_src} ${tesseract_hdr})
add_library (libtesseract ${LIBRARY_TYPE} ${tesseract_src} ${tesseract_hdr}
${tesseract_rsc}
)
if (NOT STATIC)
target_compile_definitions (libtesseract
PRIVATE -DTESS_EXPORTS
Expand Down Expand Up @@ -273,12 +283,12 @@ endif()
# EXECUTABLE tesseractmain
########################################

set(tesseractmain_src
api/tesseractmain.cpp
vs2010/tesseract/resource.h
vs2010/tesseract/tesseract.rc
)
add_executable (tesseract ${tesseractmain_src})
set(tesseractmain_src api/tesseractmain.cpp)
if (MSVC)
set(tesseractmain_rsc ${CMAKE_BINARY_DIR}/vs2010/tesseract/tesseract.rc)
endif()

add_executable (tesseract ${tesseractmain_src} ${tesseractmain_rsc})
target_link_libraries (tesseract libtesseract)

########################################
Expand Down
101 changes: 101 additions & 0 deletions vs2010/tesseract/libtesseract.rc.in
@@ -0,0 +1,101 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END

3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END

#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION @GENERIC_MAJOR_VERSION@,@GENERIC_MINOR_VERSION@,@GENERIC_MICRO_VERSION@,0
PRODUCTVERSION @GENERIC_MAJOR_VERSION@,@GENERIC_MINOR_VERSION@,@GENERIC_MICRO_VERSION@,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x7L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Tesseract OCR library"
VALUE "FileVersion", "@GENERIC_MAJOR_VERSION@,@GENERIC_MINOR_VERSION@,@GENERIC_MICRO_VERSION@,0"
VALUE "InternalName", "libtesseract"
VALUE "LegalCopyright", "Copyright (C) 2018 Google, Inc. Licensed under the Apache License, Version 2.0"
VALUE "OriginalFilename", "tesseract@GENERIC_MAJOR_VERSION@@GENERIC_MINOR_VERSION@.dll"
VALUE "ProductName", "Tesseract OCR Library"
VALUE "ProductVersion", "@PACKAGE_VERSION@"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

2 changes: 1 addition & 1 deletion vs2010/tesseract/tesseract.rc.in
Expand Up @@ -72,7 +72,7 @@ BEGIN
VALUE "FileDescription", "Tesseract command-line OCR engine"
VALUE "FileVersion", "@GENERIC_MAJOR_VERSION@,@GENERIC_MINOR_VERSION@,@GENERIC_MICRO_VERSION@,0"
VALUE "InternalName", "tesseract"
VALUE "LegalCopyright", "Copyright (C) 2016 Google, Inc. Licensed under the Apache License, Version 2.0"
VALUE "LegalCopyright", "Copyright (C) 2018 Google, Inc. Licensed under the Apache License, Version 2.0"
VALUE "OriginalFilename", "tesseract.exe"
VALUE "ProductName", "Tesseract-OCR"
VALUE "ProductVersion", "@PACKAGE_VERSION@"
Expand Down

0 comments on commit f8e26ee

Please sign in to comment.