2015-09-06 05:47:32 +08:00
|
|
|
#
|
|
|
|
# tesseract
|
|
|
|
#
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# cmake settings
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
2015-09-07 07:49:18 +08:00
|
|
|
cmake_minimum_required(VERSION 2.8.11)
|
2015-09-06 05:47:32 +08:00
|
|
|
|
|
|
|
# In-source builds are disabled.
|
2018-10-31 02:58:50 +08:00
|
|
|
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
2015-09-06 05:47:32 +08:00
|
|
|
message(FATAL_ERROR
|
|
|
|
"CMake generation is not possible within the source directory!"
|
|
|
|
"\n Remove the CMakeCache.txt file and try again from another folder, e.g.:"
|
|
|
|
"\n "
|
|
|
|
"\n rm CMakeCache.txt"
|
|
|
|
"\n mkdir build"
|
|
|
|
"\n cd build"
|
|
|
|
"\n cmake .."
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2018-10-31 02:58:50 +08:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
2015-09-06 05:47:32 +08:00
|
|
|
|
2018-10-31 02:27:34 +08:00
|
|
|
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
|
2015-09-06 05:47:32 +08:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
|
|
|
|
|
|
|
|
# Use solution folders.
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets")
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# project settings
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
project(tesseract C CXX)
|
|
|
|
|
2018-03-28 15:58:25 +08:00
|
|
|
# Get version with components from VERSION file.
|
|
|
|
file(STRINGS "VERSION" VERSION_PLAIN)
|
|
|
|
string(REGEX REPLACE "^([^.]*)\\..*" "\\1" VERSION_MAJOR ${VERSION_PLAIN})
|
|
|
|
string(REGEX REPLACE "^[^.]*\\.([^.]*)\\..*" "\\1" VERSION_MINOR ${VERSION_PLAIN})
|
|
|
|
string(REGEX REPLACE "^[^.]*\\.[^.]*\\.([0-9]*).*" "\\1" VERSION_PATCH ${VERSION_PLAIN})
|
2019-01-30 03:01:55 +08:00
|
|
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
|
|
|
execute_process(COMMAND git describe --abbrev=4
|
|
|
|
OUTPUT_VARIABLE GIT_REV)
|
|
|
|
string(REGEX REPLACE "\n$" "" PACKAGE_VERSION "${GIT_REV}")
|
2019-02-02 01:28:47 +08:00
|
|
|
else()
|
2019-01-30 03:01:55 +08:00
|
|
|
set(PACKAGE_VERSION ${VERSION_PLAIN})
|
|
|
|
endif()
|
2018-03-28 15:58:25 +08:00
|
|
|
|
|
|
|
# Provide also same macro names as autoconf (see configure.ac).
|
|
|
|
set(GENERIC_MAJOR_VERSION ${VERSION_MAJOR})
|
|
|
|
set(GENERIC_MINOR_VERSION ${VERSION_MINOR})
|
|
|
|
set(GENERIC_MICRO_VERSION ${VERSION_PATCH})
|
2015-09-06 05:47:32 +08:00
|
|
|
|
2016-12-26 22:28:31 +08:00
|
|
|
set(MINIMUM_LEPTONICA_VERSION 1.74)
|
2015-10-09 23:12:02 +08:00
|
|
|
|
2019-01-25 06:03:47 +08:00
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# options
|
|
|
|
#
|
|
|
|
###############################################################################
|
2019-02-02 01:28:47 +08:00
|
|
|
message( "Configuring tesseract version ${PACKAGE_VERSION}...")
|
2019-01-25 06:03:47 +08:00
|
|
|
|
|
|
|
option(CPPAN_BUILD "Build with cppan" ON)
|
|
|
|
option(OPENMP_BUILD "Build with openmp support" OFF) # see issue #1662
|
|
|
|
option(BUILD_TRAINING_TOOLS "Build training tools" ON)
|
|
|
|
option(BUILD_TESTS "Build tests" OFF)
|
|
|
|
|
2019-02-02 01:02:28 +08:00
|
|
|
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.cppan)
|
|
|
|
set(CPPAN_BUILD OFF)
|
|
|
|
endif()
|
2019-01-25 06:03:47 +08:00
|
|
|
|
2015-09-06 05:47:32 +08:00
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# compiler and linker
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
set(LIBRARY_TYPE SHARED)
|
|
|
|
if (STATIC)
|
|
|
|
set(LIBRARY_TYPE)
|
|
|
|
endif()
|
|
|
|
|
2018-12-29 17:43:13 +08:00
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
set(CLANG 1)
|
|
|
|
endif()
|
|
|
|
|
2015-09-06 05:47:32 +08:00
|
|
|
if (WIN32)
|
|
|
|
if (MSVC)
|
2015-11-30 16:52:21 +08:00
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
2019-01-25 06:03:47 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
|
|
|
|
if (NOT CLANG)
|
2018-12-31 03:25:24 +08:00
|
|
|
add_definitions(-DNOMINMAX)
|
2019-01-25 06:03:47 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
2018-12-29 17:43:13 +08:00
|
|
|
endif()
|
2015-09-06 05:47:32 +08:00
|
|
|
endif()
|
2015-09-07 01:43:28 +08:00
|
|
|
set(LIB_Ws2_32 Ws2_32)
|
|
|
|
endif()
|
|
|
|
|
2019-01-25 06:03:47 +08:00
|
|
|
if (OPENMP_BUILD)
|
|
|
|
if (CLANG)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fopenmp")
|
|
|
|
else(MSVC)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-09-07 07:49:18 +08:00
|
|
|
if (CYGWIN)
|
|
|
|
add_definitions(-D__CYGWIN__)
|
|
|
|
endif()
|
|
|
|
|
2015-09-07 01:43:28 +08:00
|
|
|
if (UNIX)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
|
2016-02-04 18:44:07 +08:00
|
|
|
|
2019-01-04 06:53:38 +08:00
|
|
|
if (NOT ANDROID)
|
|
|
|
set(LIB_pthread pthread)
|
|
|
|
endif()
|
2015-09-06 05:47:32 +08:00
|
|
|
endif()
|
|
|
|
|
2018-04-11 05:16:31 +08:00
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# packages
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
2019-02-02 01:02:28 +08:00
|
|
|
if(NOT CPPAN_BUILD)
|
2018-04-11 05:16:31 +08:00
|
|
|
if (NOT Leptonica_DIR AND NOT MSVC)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
|
|
|
|
link_directories(${Leptonica_LIBRARY_DIRS})
|
|
|
|
else()
|
|
|
|
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
if (STATIC)
|
|
|
|
set(CPPAN_BUILD_SHARED_LIBS 0)
|
|
|
|
else()
|
|
|
|
set(CPPAN_BUILD_SHARED_LIBS 1)
|
|
|
|
endif()
|
|
|
|
add_subdirectory(.cppan)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_package(OpenCL QUIET)
|
|
|
|
|
2015-09-06 05:47:32 +08:00
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# configure
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
2018-10-31 02:58:50 +08:00
|
|
|
set(AUTOCONFIG_SRC ${CMAKE_CURRENT_BINARY_DIR}/config_auto.h.in)
|
|
|
|
set(AUTOCONFIG ${CMAKE_CURRENT_BINARY_DIR}/config_auto.h)
|
2019-02-02 01:02:28 +08:00
|
|
|
add_definitions(-DHAVE_CONFIG_H)
|
2015-09-06 05:47:32 +08:00
|
|
|
|
2018-10-31 02:49:14 +08:00
|
|
|
include(Configure)
|
2015-09-06 05:47:32 +08:00
|
|
|
|
|
|
|
configure_file(${AUTOCONFIG_SRC} ${AUTOCONFIG} @ONLY)
|
|
|
|
|
2017-04-20 19:59:13 +08:00
|
|
|
set(INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" "${CMAKE_INSTALL_PREFIX}/include/tesseract")
|
2015-09-06 05:47:32 +08:00
|
|
|
|
2018-03-28 15:58:25 +08:00
|
|
|
configure_file(
|
2018-10-31 02:58:50 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/api/tess_version.h.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/api/tess_version.h @ONLY)
|
2018-03-28 20:26:03 +08:00
|
|
|
configure_file(
|
2018-10-31 02:58:50 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/vs2010/tesseract/tesseract.rc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/vs2010/tesseract/tesseract.rc @ONLY)
|
2018-03-31 18:49:29 +08:00
|
|
|
configure_file(
|
2018-10-31 02:58:50 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/vs2010/tesseract/libtesseract.rc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/vs2010/tesseract/libtesseract.rc @ONLY)
|
2015-09-06 05:47:32 +08:00
|
|
|
configure_file(
|
2018-10-31 02:58:50 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/TesseractConfig-version.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/TesseractConfig-version.cmake @ONLY)
|
2015-09-06 05:47:32 +08:00
|
|
|
configure_file(
|
2018-10-31 02:58:50 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/TesseractConfig.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/TesseractConfig.cmake @ONLY)
|
2015-09-06 05:47:32 +08:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# build
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
2018-10-31 02:49:14 +08:00
|
|
|
include(BuildFunctions)
|
|
|
|
include(SourceGroups)
|
2015-09-06 05:47:32 +08:00
|
|
|
|
|
|
|
add_definitions(-D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1)
|
|
|
|
add_definitions(-DWINDLLNAME="libtesseract${VERSION_MAJOR}${VERSION_MINOR}.dll")
|
|
|
|
|
|
|
|
include_directories(${Leptonica_INCLUDE_DIRS})
|
|
|
|
|
2018-10-31 02:58:50 +08:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
2015-09-07 01:43:28 +08:00
|
|
|
|
2018-04-25 16:02:54 +08:00
|
|
|
include_directories(src/api)
|
2018-10-31 02:58:50 +08:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/api)
|
2018-04-25 16:02:54 +08:00
|
|
|
include_directories(src/arch)
|
|
|
|
include_directories(src/ccmain)
|
|
|
|
include_directories(src/ccstruct)
|
|
|
|
include_directories(src/ccutil)
|
|
|
|
include_directories(src/classify)
|
|
|
|
include_directories(src/cutil)
|
|
|
|
include_directories(src/dict)
|
|
|
|
include_directories(src/lstm)
|
|
|
|
include_directories(src/opencl)
|
|
|
|
include_directories(src/textord)
|
|
|
|
include_directories(src/viewer)
|
|
|
|
include_directories(src/wordrec)
|
2015-09-06 05:47:32 +08:00
|
|
|
|
|
|
|
########################################
|
2015-09-06 18:47:30 +08:00
|
|
|
# LIBRARY tesseract
|
2015-09-06 05:47:32 +08:00
|
|
|
########################################
|
|
|
|
|
2015-09-06 18:47:30 +08:00
|
|
|
file(GLOB tesseract_src
|
2018-04-25 16:02:54 +08:00
|
|
|
src/arch/*.cpp
|
|
|
|
src/ccmain/*.cpp
|
|
|
|
src/ccstruct/*.cpp
|
|
|
|
src/ccutil/*.cpp
|
|
|
|
src/classify/*.cpp
|
|
|
|
src/cutil/*.cpp
|
|
|
|
src/dict/*.cpp
|
|
|
|
src/lstm/*.cpp
|
|
|
|
src/opencl/*.cpp
|
|
|
|
src/textord/*.cpp
|
|
|
|
src/viewer/*.cpp
|
|
|
|
src/wordrec/*.cpp
|
2015-09-06 18:47:30 +08:00
|
|
|
)
|
|
|
|
file(GLOB tesseract_hdr
|
2018-04-25 16:02:54 +08:00
|
|
|
src/api/*.h
|
|
|
|
src/arch/*.h
|
|
|
|
src/ccmain/*.h
|
|
|
|
src/ccstruct/*.h
|
|
|
|
src/ccutil/*.h
|
|
|
|
src/classify/*.h
|
|
|
|
src/cutil/*.h
|
|
|
|
src/dict/*.h
|
|
|
|
src/lstm/*.h
|
|
|
|
src/opencl/*.h
|
|
|
|
src/textord/*.h
|
|
|
|
src/viewer/*.h
|
|
|
|
src/wordrec/*.h
|
2015-09-06 18:47:30 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
set(tesseract_src ${tesseract_src}
|
2018-04-25 16:02:54 +08:00
|
|
|
src/api/baseapi.cpp
|
|
|
|
src/api/capi.cpp
|
|
|
|
src/api/renderer.cpp
|
2018-11-30 13:09:36 +08:00
|
|
|
src/api/altorenderer.cpp
|
2018-12-16 05:58:51 +08:00
|
|
|
src/api/hocrrenderer.cpp
|
|
|
|
src/api/pdfrenderer.cpp
|
2015-09-06 05:47:32 +08:00
|
|
|
)
|
|
|
|
|
2017-02-24 00:29:48 +08:00
|
|
|
if (WIN32)
|
|
|
|
if (MSVC)
|
2018-04-25 16:02:54 +08:00
|
|
|
include_directories(src/vs2010/tesseract)
|
2018-03-31 18:49:29 +08:00
|
|
|
set(tesseract_hdr
|
|
|
|
${tesseract_hdr}
|
2018-04-25 16:02:54 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/vs2010/tesseract/resource.h)
|
2018-12-29 17:30:56 +08:00
|
|
|
set(tesseract_rsc ${CMAKE_CURRENT_BINARY_DIR}/vs2010/tesseract/libtesseract.rc)
|
2018-12-29 17:43:13 +08:00
|
|
|
if (NOT CLANG)
|
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductsse.cpp
|
|
|
|
PROPERTIES COMPILE_DEFINITIONS __SSE4_1__)
|
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixsse.cpp
|
|
|
|
PROPERTIES COMPILE_DEFINITIONS __SSE4_1__)
|
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductavx.cpp
|
|
|
|
PROPERTIES COMPILE_FLAGS "/arch:AVX")
|
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixavx2.cpp
|
|
|
|
PROPERTIES COMPILE_FLAGS "/arch:AVX2")
|
2019-01-01 20:15:58 +08:00
|
|
|
set_source_files_properties(
|
2019-01-30 00:27:36 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/simddetect.cpp
|
2019-01-01 20:15:58 +08:00
|
|
|
PROPERTIES COMPILE_FLAGS "/DAVX /DAVX2 /DSSE4_1")
|
2019-01-30 03:04:44 +08:00
|
|
|
else(CLANG)
|
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductsse.cpp
|
|
|
|
PROPERTIES COMPILE_FLAGS "-msse4.1")
|
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixsse.cpp
|
|
|
|
PROPERTIES COMPILE_FLAGS "-msse4.1")
|
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductavx.cpp
|
|
|
|
PROPERTIES COMPILE_FLAGS "-mavx")
|
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixavx2.cpp
|
|
|
|
PROPERTIES COMPILE_FLAGS "-mavx2")
|
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/simddetect.cpp
|
|
|
|
PROPERTIES COMPILE_FLAGS "-DAVX -DAVX2 -DSSE4_1")
|
2018-12-29 17:43:13 +08:00
|
|
|
endif() # NOT CLANG
|
|
|
|
endif() # MSVC
|
2017-09-07 08:55:27 +08:00
|
|
|
else()
|
|
|
|
set_source_files_properties(
|
2018-04-25 16:02:54 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductsse.cpp
|
2017-09-07 08:55:27 +08:00
|
|
|
PROPERTIES COMPILE_FLAGS "-msse4.1")
|
2018-01-24 23:45:15 +08:00
|
|
|
set_source_files_properties(
|
2018-04-25 16:02:54 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixsse.cpp
|
2018-01-24 23:45:15 +08:00
|
|
|
PROPERTIES COMPILE_FLAGS "-msse4.1")
|
2017-09-07 08:55:27 +08:00
|
|
|
set_source_files_properties(
|
2018-04-25 16:02:54 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductavx.cpp
|
2017-09-07 08:55:27 +08:00
|
|
|
PROPERTIES COMPILE_FLAGS "-mavx")
|
2018-01-24 23:45:15 +08:00
|
|
|
set_source_files_properties(
|
2018-04-25 16:02:54 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixavx2.cpp
|
2018-01-24 23:45:15 +08:00
|
|
|
PROPERTIES COMPILE_FLAGS "-mavx2")
|
2019-01-01 20:15:58 +08:00
|
|
|
set_source_files_properties(
|
2019-01-30 00:27:36 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/simddetect.cpp
|
2019-01-01 20:15:58 +08:00
|
|
|
PROPERTIES COMPILE_FLAGS "-DAVX -DAVX2 -DSSE4_1")
|
2017-02-24 00:29:48 +08:00
|
|
|
endif()
|
|
|
|
|
2018-03-31 18:49:29 +08:00
|
|
|
add_library (libtesseract ${LIBRARY_TYPE} ${tesseract_src} ${tesseract_hdr}
|
|
|
|
${tesseract_rsc}
|
|
|
|
)
|
2015-09-07 06:46:33 +08:00
|
|
|
if (NOT STATIC)
|
2017-02-23 20:39:58 +08:00
|
|
|
target_compile_definitions (libtesseract
|
2016-12-17 21:19:35 +08:00
|
|
|
PRIVATE -DTESS_EXPORTS
|
|
|
|
INTERFACE -DTESS_IMPORTS
|
|
|
|
)
|
2017-02-23 20:39:58 +08:00
|
|
|
set_target_properties (libtesseract PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS True)
|
2015-09-07 06:46:33 +08:00
|
|
|
endif()
|
2017-02-23 20:39:58 +08:00
|
|
|
target_link_libraries (libtesseract ${LIB_Ws2_32} ${LIB_pthread})
|
2018-03-28 16:00:18 +08:00
|
|
|
set_target_properties (libtesseract PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
|
|
|
set_target_properties (libtesseract PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
2015-10-09 23:12:02 +08:00
|
|
|
if (WIN32)
|
2017-02-23 20:39:58 +08:00
|
|
|
set_target_properties (libtesseract PROPERTIES OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR})
|
|
|
|
set_target_properties (libtesseract PROPERTIES DEBUG_OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR}d)
|
2017-08-30 05:14:13 +08:00
|
|
|
else()
|
|
|
|
set_target_properties (libtesseract PROPERTIES OUTPUT_NAME tesseract)
|
2015-10-09 23:12:02 +08:00
|
|
|
endif()
|
2015-09-06 05:47:32 +08:00
|
|
|
|
2019-02-02 01:02:28 +08:00
|
|
|
if (CPPAN_BUILD)
|
2017-02-23 20:39:58 +08:00
|
|
|
target_link_libraries (libtesseract pvt.cppan.demo.danbloomberg.leptonica)
|
2018-10-31 02:58:50 +08:00
|
|
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake "include(${CMAKE_CURRENT_BINARY_DIR}/cppan.cmake)\n")
|
|
|
|
export(TARGETS libtesseract APPEND FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
|
2019-02-02 01:02:28 +08:00
|
|
|
else()
|
|
|
|
target_link_libraries (libtesseract ${Leptonica_LIBRARIES})
|
|
|
|
export(TARGETS libtesseract FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
|
2016-06-30 05:29:55 +08:00
|
|
|
endif()
|
2015-09-06 05:47:32 +08:00
|
|
|
|
2019-01-25 06:03:47 +08:00
|
|
|
if (WIN32 AND CLANG AND OPENMP_BUILD)
|
2018-12-29 17:43:13 +08:00
|
|
|
# Workaround for "libomp.lib is not automatically added on Windows"
|
|
|
|
# see: http://lists.llvm.org/pipermail/openmp-dev/2015-August/000857.html
|
|
|
|
# TODO: Find better way how to set Clang OpenMP library for linking on Windows
|
|
|
|
target_link_libraries (libtesseract "c:\\Program Files\\LLVM\\lib\\libomp.lib")
|
|
|
|
endif()
|
|
|
|
|
2015-09-06 05:47:32 +08:00
|
|
|
########################################
|
|
|
|
# EXECUTABLE tesseractmain
|
|
|
|
########################################
|
|
|
|
|
2018-04-25 16:02:54 +08:00
|
|
|
set(tesseractmain_src src/api/tesseractmain.cpp)
|
2018-03-31 18:49:29 +08:00
|
|
|
if (MSVC)
|
2018-10-31 02:58:50 +08:00
|
|
|
set(tesseractmain_rsc ${CMAKE_CURRENT_BINARY_DIR}/vs2010/tesseract/tesseract.rc)
|
2018-03-31 18:49:29 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable (tesseract ${tesseractmain_src} ${tesseractmain_rsc})
|
2017-02-23 20:39:58 +08:00
|
|
|
target_link_libraries (tesseract libtesseract)
|
2015-09-06 05:47:32 +08:00
|
|
|
|
2015-09-06 18:47:30 +08:00
|
|
|
########################################
|
|
|
|
|
2018-10-31 02:58:50 +08:00
|
|
|
if (BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/googletest/CMakeLists.txt)
|
2017-07-24 23:59:12 +08:00
|
|
|
add_subdirectory(googletest)
|
|
|
|
endif()
|
|
|
|
|
2016-12-17 23:33:41 +08:00
|
|
|
if (BUILD_TRAINING_TOOLS)
|
2018-04-25 16:35:26 +08:00
|
|
|
add_subdirectory(src/training)
|
2016-12-17 23:33:41 +08:00
|
|
|
endif()
|
2015-09-06 18:47:30 +08:00
|
|
|
|
2017-04-20 19:50:53 +08:00
|
|
|
get_target_property(tesseract_NAME libtesseract NAME)
|
|
|
|
get_target_property(tesseract_VERSION libtesseract VERSION)
|
|
|
|
get_target_property(tesseract_OUTPUT_NAME libtesseract OUTPUT_NAME)
|
|
|
|
configure_file(tesseract.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/tesseract.pc @ONLY)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tesseract.pc DESTINATION lib/pkgconfig)
|
|
|
|
install(TARGETS tesseract RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
|
|
|
install(TARGETS libtesseract EXPORT TesseractTargets RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
|
|
|
install(EXPORT TesseractTargets DESTINATION cmake)
|
|
|
|
install(FILES
|
2018-10-31 02:58:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/TesseractConfig.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/TesseractConfig-version.cmake
|
2017-04-20 19:50:53 +08:00
|
|
|
DESTINATION cmake)
|
|
|
|
|
|
|
|
install(FILES
|
|
|
|
# from api/makefile.am
|
2018-04-25 16:02:54 +08:00
|
|
|
src/api/apitypes.h
|
|
|
|
src/api/baseapi.h
|
|
|
|
src/api/capi.h
|
|
|
|
src/api/renderer.h
|
2018-04-03 01:14:38 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/api/tess_version.h
|
2017-04-20 19:50:53 +08:00
|
|
|
|
|
|
|
#from arch/makefile.am
|
2018-04-25 16:02:54 +08:00
|
|
|
src/arch/dotproductavx.h
|
|
|
|
src/arch/dotproductsse.h
|
|
|
|
src/arch/intsimdmatrix.h
|
|
|
|
src/arch/simddetect.h
|
2017-04-20 19:50:53 +08:00
|
|
|
|
|
|
|
#from ccmain/makefile.am
|
2018-04-25 16:02:54 +08:00
|
|
|
src/ccmain/thresholder.h
|
|
|
|
src/ccmain/ltrresultiterator.h
|
|
|
|
src/ccmain/pageiterator.h
|
|
|
|
src/ccmain/resultiterator.h
|
|
|
|
src/ccmain/osdetect.h
|
2017-04-20 19:50:53 +08:00
|
|
|
|
|
|
|
#from ccstruct/makefile.am
|
2018-04-25 16:02:54 +08:00
|
|
|
src/ccstruct/publictypes.h
|
2017-04-20 19:50:53 +08:00
|
|
|
|
|
|
|
#from ccutil/makefile.am
|
2018-04-25 16:02:54 +08:00
|
|
|
src/ccutil/basedir.h
|
|
|
|
src/ccutil/errcode.h
|
|
|
|
src/ccutil/fileerr.h
|
|
|
|
src/ccutil/genericvector.h
|
|
|
|
src/ccutil/helpers.h
|
|
|
|
src/ccutil/host.h
|
|
|
|
src/ccutil/params.h
|
|
|
|
src/ccutil/ocrclass.h
|
|
|
|
src/ccutil/platform.h
|
|
|
|
src/ccutil/serialis.h
|
|
|
|
src/ccutil/strngs.h
|
|
|
|
src/ccutil/tesscallback.h
|
|
|
|
src/ccutil/unichar.h
|
|
|
|
src/ccutil/unicharcompress.h
|
|
|
|
src/ccutil/unicharmap.h
|
|
|
|
src/ccutil/unicharset.h
|
2017-04-20 19:50:53 +08:00
|
|
|
|
|
|
|
#from lstm/makefile.am
|
2018-04-25 16:02:54 +08:00
|
|
|
src/lstm/convolve.h
|
|
|
|
src/lstm/ctc.h
|
|
|
|
src/lstm/fullyconnected.h
|
|
|
|
src/lstm/functions.h
|
|
|
|
src/lstm/input.h
|
|
|
|
src/lstm/lstm.h
|
|
|
|
src/lstm/lstmrecognizer.h
|
|
|
|
src/lstm/lstmtrainer.h
|
|
|
|
src/lstm/maxpool.h
|
|
|
|
src/lstm/networkbuilder.h
|
|
|
|
src/lstm/network.h
|
|
|
|
src/lstm/networkio.h
|
|
|
|
src/lstm/networkscratch.h
|
|
|
|
src/lstm/parallel.h
|
|
|
|
src/lstm/plumbing.h
|
|
|
|
src/lstm/recodebeam.h
|
|
|
|
src/lstm/reconfig.h
|
|
|
|
src/lstm/reversed.h
|
|
|
|
src/lstm/series.h
|
|
|
|
src/lstm/static_shape.h
|
|
|
|
src/lstm/stridemap.h
|
|
|
|
src/lstm/tfnetwork.h
|
|
|
|
src/lstm/weightmatrix.h
|
2017-04-20 19:50:53 +08:00
|
|
|
|
2018-10-31 02:58:50 +08:00
|
|
|
#${CMAKE_CURRENT_BINARY_DIR}/src/endianness.h
|
2017-04-20 19:50:53 +08:00
|
|
|
DESTINATION include/tesseract)
|
|
|
|
|
|
|
|
|
2015-09-06 05:47:32 +08:00
|
|
|
###############################################################################
|