mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 20:59:36 +08:00
cmake: reformat with cmake-format and check with cmake-lint
This commit is contained in:
parent
b565cfee9b
commit
8f02255294
326
CMakeLists.txt
326
CMakeLists.txt
@ -12,15 +12,15 @@ cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
|
||||
|
||||
# In-source builds are disabled.
|
||||
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
message(FATAL_ERROR
|
||||
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 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 .."
|
||||
)
|
||||
"\n cmake ..")
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
@ -50,11 +50,13 @@ project(tesseract C CXX)
|
||||
# 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})
|
||||
string(REGEX REPLACE "^[^.]*\\.([^.]*)\\..*" "\\1" VERSION_MINOR
|
||||
${VERSION_PLAIN})
|
||||
string(REGEX REPLACE "^[^.]*\\.[^.]*\\.([0-9]*).*" "\\1" VERSION_PATCH
|
||||
${VERSION_PLAIN})
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
execute_process(COMMAND git --git-dir ${CMAKE_CURRENT_SOURCE_DIR}/.git describe --abbrev=4
|
||||
OUTPUT_VARIABLE GIT_REV)
|
||||
execute_process(COMMAND git --git-dir ${CMAKE_CURRENT_SOURCE_DIR}/.git
|
||||
describe --abbrev=4 OUTPUT_VARIABLE GIT_REV)
|
||||
string(REGEX REPLACE "\n$" "" PACKAGE_VERSION "${GIT_REV}")
|
||||
endif()
|
||||
if(NOT PACKAGE_VERSION)
|
||||
@ -110,7 +112,9 @@ endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "Setting build type to 'Release' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
|
||||
set(CMAKE_BUILD_TYPE
|
||||
Release
|
||||
CACHE STRING "Choose the type of build." FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||
endif()
|
||||
|
||||
@ -137,7 +141,7 @@ else()
|
||||
message(STATUS "IPO / LTO not supported: <${error}>")
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
set(MARCH_NATIVE_FLAGS "${MARCH_NATIVE_FLAGS} -march=native")
|
||||
if(NOT CLANG AND MSVC)
|
||||
@ -153,25 +157,25 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686")
|
||||
|
||||
set(HAVE_NEON FALSE)
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-mavx" HAVE_AVX)
|
||||
check_cxx_compiler_flag("-mavx" HAVE_AVX)
|
||||
if(HAVE_AVX)
|
||||
set(AVX_COMPILE_FLAGS "-mavx")
|
||||
add_definitions("-DHAVE_AVX")
|
||||
endif(HAVE_AVX)
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-mavx2" HAVE_AVX2)
|
||||
check_cxx_compiler_flag("-mavx2" HAVE_AVX2)
|
||||
if(HAVE_AVX2)
|
||||
set(AVX2_COMPILE_FLAGS "-mavx2")
|
||||
add_definitions("-DHAVE_AVX2")
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-mfma" HAVE_FMA)
|
||||
check_cxx_compiler_flag("-mfma" HAVE_FMA)
|
||||
if(HAVE_FMA)
|
||||
set(FMA_COMPILE_FLAGS "-mfma")
|
||||
add_definitions("-DHAVE_FMA")
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-msse4.1" HAVE_SSE4_1)
|
||||
check_cxx_compiler_flag("-msse4.1" HAVE_SSE4_1)
|
||||
if(HAVE_SSE4_1)
|
||||
set(SSE4_1_COMPILE_FLAGS "-msse4.1")
|
||||
add_definitions("-DHAVE_SSE4_1")
|
||||
@ -200,7 +204,8 @@ if(MSVC)
|
||||
endif()
|
||||
# clang with MSVC compatibility
|
||||
if(CLANG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-microsoft-unqualified-friend")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -Wno-microsoft-unqualified-friend")
|
||||
if(HAVE_FMA)
|
||||
set(FMA_COMPILE_FLAGS "-mfma ${FMA_COMPILE_FLAGS}")
|
||||
endif(HAVE_FMA)
|
||||
@ -227,7 +232,7 @@ set(HAVE_AVX2 FALSE)
|
||||
set(HAVE_FMA FALSE)
|
||||
set(HAVE_SSE4_1 FALSE)
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-mfpu=neon" HAVE_NEON)
|
||||
check_cxx_compiler_flag("-mfpu=neon" HAVE_NEON)
|
||||
if(HAVE_NEON)
|
||||
set(NEON_COMPILE_FLAGS "-mfpu=neon")
|
||||
add_definitions("-DHAVE_NEON")
|
||||
@ -237,7 +242,8 @@ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686")
|
||||
|
||||
# Compiler specific environments
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -Og")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG
|
||||
"${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -Og")
|
||||
elseif(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) # strdup
|
||||
@ -245,13 +251,13 @@ elseif(MSVC)
|
||||
if(NOT CLANG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
endif()
|
||||
# Hide some warnings for release target
|
||||
# wd4244 'argument': conversion from 'uint64_t' to 'unsigned int', possible loss of data
|
||||
# wd4251 needs to have dll-interface
|
||||
# wd4267 return': conversion from 'size_t' to 'int', possible loss of data
|
||||
# wd4275 non dll-interface class
|
||||
# wd4305 ...truncation from 'double' to 'float'
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4244 /wd4305 /wd4267 /wd4251 /wd4275")
|
||||
# Hide some warnings for release target wd4244 'argument': conversion from
|
||||
# 'uint64_t' to 'unsigned int', possible loss of data wd4251 needs to have
|
||||
# dll-interface wd4267 return': conversion from 'size_t' to 'int', possible
|
||||
# loss of data wd4275 non dll-interface class wd4305 ...truncation from
|
||||
# 'double' to 'float'
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE} /wd4244 /wd4305 /wd4267 /wd4251 /wd4275")
|
||||
# Don't use /Wall because it generates too many warnings.
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W0 /bigobj")
|
||||
# MT flag
|
||||
@ -261,36 +267,44 @@ elseif(MSVC)
|
||||
endif()
|
||||
endif()
|
||||
if(CLANG) # clang all platforms
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-unused-command-line-argument")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -O0")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE} -Wno-unused-command-line-argument")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG
|
||||
"${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -O0")
|
||||
endif()
|
||||
|
||||
if (OPENMP_BUILD AND MSVC AND "${MSVC_VERSION}" LESS 1929)
|
||||
if(OPENMP_BUILD
|
||||
AND MSVC
|
||||
AND "${MSVC_VERSION}" LESS 1929)
|
||||
set(OPENMP_BUILD OFF)
|
||||
endif()
|
||||
if(OPENMP_BUILD)
|
||||
find_package(OpenMP QUIET)
|
||||
if(OpenMP_FOUND)
|
||||
message(">> ${OpenMP_FOUND} ${OpenMP_VERSION}")
|
||||
message(">> OpenMP_FOUND ${OpenMP_FOUND} ${OpenMP_VERSION}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.9.0")
|
||||
add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
|
||||
endif()
|
||||
endif()
|
||||
# https://stackoverflow.com/questions/12399422/how-to-set-linker-flags-for-openmp-in-cmakes-try-compile-function
|
||||
if (NOT OpenMP_FOUND AND CLANG AND WIN32)
|
||||
# https://stackoverflow.com/questions/12399422
|
||||
# how-to-set-linker-flags-for-openmp-in-cmakes-try-compile-function
|
||||
if(NOT OpenMP_FOUND
|
||||
AND CLANG
|
||||
AND WIN32)
|
||||
# workaroung because find_package(OpenMP) does not work for clang-cl
|
||||
# https://gitlab.kitware.com/cmake/cmake/issues/19404
|
||||
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
|
||||
find_library(OpenMP_LIBRARY NAMES omp libomp.lib)
|
||||
message(">> OpenMP_LIBRARY: ${OpenMP_LIBRARY}")
|
||||
if(MSVC)
|
||||
set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS} /openmp")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp")
|
||||
else()
|
||||
set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS} -fopenmp")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
|
||||
endif()
|
||||
set(OpenMP_FOUND 1)
|
||||
add_definitions(-D_OPENMP=201107) # 3.1 version is supported from Clang 3.8.0
|
||||
# OpenMP 3.1 is fully supported from Clang 3.8.0
|
||||
add_definitions(-D_OPENMP=201107)
|
||||
endif()
|
||||
if(MSVC)
|
||||
string(REPLACE "/openmp" "/openmp:llvm" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
@ -323,25 +337,17 @@ if (SW_BUILD)
|
||||
else()
|
||||
set(SW_BUILD_SHARED_LIBS 0)
|
||||
endif()
|
||||
sw_add_package(
|
||||
org.sw.demo.danbloomberg.leptonica
|
||||
org.sw.demo.libarchive.libarchive
|
||||
)
|
||||
sw_add_package(org.sw.demo.danbloomberg.leptonica
|
||||
org.sw.demo.libarchive.libarchive)
|
||||
if(BUILD_TRAINING_TOOLS)
|
||||
sw_add_package(
|
||||
org.sw.demo.gnome.pango.pangocairo
|
||||
org.sw.demo.unicode.icu.i18n
|
||||
)
|
||||
sw_add_package(org.sw.demo.gnome.pango.pangocairo
|
||||
org.sw.demo.unicode.icu.i18n)
|
||||
endif()
|
||||
sw_execute()
|
||||
else()
|
||||
find_package(PkgConfig)
|
||||
if(BUILD_TRAINING_TOOLS)
|
||||
message(WARNING "Building of Training Tools requires PkgConfig")
|
||||
set(BUILD_TRAINING_TOOLS OFF)
|
||||
endif(BUILD_TRAINING_TOOLS)
|
||||
# Check for required library.
|
||||
# option -DLeptonica_DIR=path => cmake hint where to find leptonica
|
||||
# Check for required library. option -DLeptonica_DIR=path => cmake hint where
|
||||
# to find leptonica
|
||||
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} CONFIG)
|
||||
if(NOT Leptonica_FOUND AND PKG_CONFIG_EXECUTABLE)
|
||||
pkg_check_modules(Leptonica lept>=${MINIMUM_LEPTONICA_VERSION})
|
||||
@ -392,7 +398,6 @@ endif()
|
||||
|
||||
find_package(OpenCL QUIET)
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
#
|
||||
# configure
|
||||
@ -414,7 +419,9 @@ add_definitions(-DHAVE_CONFIG_H)
|
||||
if(GRAPHICS_DISABLED)
|
||||
message("ScrollView debugging disabled.")
|
||||
endif()
|
||||
set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${CMAKE_PREFIX_PATH}/include" "${CMAKE_INSTALL_PREFIX}/include")
|
||||
set(CMAKE_REQUIRED_INCLUDES
|
||||
${CMAKE_REQUIRED_INCLUDES} "${CMAKE_PREFIX_PATH}/include"
|
||||
"${CMAKE_INSTALL_PREFIX}/include")
|
||||
include(Configure)
|
||||
|
||||
configure_file(${AUTOCONFIG_SRC} ${AUTOCONFIG} @ONLY)
|
||||
@ -422,8 +429,7 @@ configure_file(${AUTOCONFIG_SRC} ${AUTOCONFIG} @ONLY)
|
||||
set(INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
|
||||
set(LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/tesseract/version.h.in
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/tesseract/version.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/tesseract/version.h @ONLY)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
@ -449,7 +455,8 @@ message( STATUS "Used standard: C++${CMAKE_CXX_STANDARD}")
|
||||
message(STATUS "CXX compiler options: ${COMPILER_FLAGS}")
|
||||
get_directory_property(DirCompDefs COMPILE_DEFINITIONS)
|
||||
message(STATUS "Compile definitions = ${DirCompDefs}")
|
||||
message( STATUS "Linker options: ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UP}}")
|
||||
message(STATUS "Linker options: ${CMAKE_EXE_LINKER_FLAGS} "
|
||||
"${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UP}}")
|
||||
message(STATUS "Install directory: ${CMAKE_INSTALL_PREFIX}")
|
||||
message(STATUS "HAVE_AVX: ${HAVE_AVX}")
|
||||
message(STATUS "HAVE_AVX2: ${HAVE_AVX2}")
|
||||
@ -461,12 +468,16 @@ message( STATUS "Link-time optimization: ${CMAKE_INTERPROCEDURAL_OPTIMIZATION}")
|
||||
message(STATUS "--------------------------------------------------------")
|
||||
message(STATUS "Build with sw [SW_BUILD]: ${SW_BUILD}")
|
||||
message(STATUS "Build with openmp support [OPENMP_BUILD]: ${OPENMP_BUILD}")
|
||||
message( STATUS "Build with libarchive support [HAVE_LIBARCHIVE]: ${HAVE_LIBARCHIVE}")
|
||||
message(STATUS "Build with libarchive support [HAVE_LIBARCHIVE]: "
|
||||
"${HAVE_LIBARCHIVE}")
|
||||
message(STATUS "Build with libcurl support [HAVE_LIBCURL]: ${HAVE_LIBCURL}")
|
||||
message(STATUS "Enable float for LSTM [FAST_FLOAT]: ${FAST_FLOAT}")
|
||||
message( STATUS "Disable disable graphics (ScrollView) [GRAPHICS_DISABLED]: ${GRAPHICS_DISABLED}")
|
||||
message( STATUS "Disable the legacy OCR engine [DISABLED_LEGACY_ENGINE]: ${DISABLED_LEGACY_ENGINE}")
|
||||
message( STATUS "Build training tools [BUILD_TRAINING_TOOLS]: ${BUILD_TRAINING_TOOLS}")
|
||||
message(STATUS "Disable disable graphics (ScrollView) [GRAPHICS_DISABLED]: "
|
||||
"${GRAPHICS_DISABLED}")
|
||||
message(STATUS "Disable the legacy OCR engine [DISABLED_LEGACY_ENGINE]: "
|
||||
"${DISABLED_LEGACY_ENGINE}")
|
||||
message(STATUS "Build training tools [BUILD_TRAINING_TOOLS]: "
|
||||
"${BUILD_TRAINING_TOOLS}")
|
||||
message(STATUS "Build tests [BUILD_TESTS]: ${BUILD_TESTS}")
|
||||
message(STATUS "Use system ICU Library [USE_SYSTEM_ICU]: ${USE_SYSTEM_ICU}")
|
||||
message(STATUS "--------------------------------------------------------")
|
||||
@ -490,11 +501,13 @@ if(ANDROID_TOOLCHAIN)
|
||||
add_compile_definitions(__ANDROID_API_FUTURE__)
|
||||
endif()
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# LIBRARY tesseract
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
file(GLOB tesseract_src
|
||||
file(
|
||||
GLOB
|
||||
TESSERACT_SRC
|
||||
src/ccmain/*.cpp
|
||||
src/ccstruct/*.cpp
|
||||
src/ccutil/*.cpp
|
||||
@ -505,19 +518,21 @@ file(GLOB tesseract_src
|
||||
src/opencl/*.cpp
|
||||
src/textord/*.cpp
|
||||
src/viewer/*.cpp
|
||||
src/wordrec/*.cpp
|
||||
)
|
||||
src/wordrec/*.cpp)
|
||||
|
||||
if(DISABLED_LEGACY_ENGINE)
|
||||
# prepend path to list of source files
|
||||
function(prepend_path srcs path)
|
||||
set(tmp, "")
|
||||
foreach(src IN LISTS ${srcs})
|
||||
list(APPEND tmp ${path}/${src})
|
||||
endforeach(src ${srcs})
|
||||
set(${srcs} ${tmp} PARENT_SCOPE)
|
||||
set(${srcs}
|
||||
${tmp}
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
SET(tesseract_src_legacy
|
||||
set(TESSERACT_SRC_LEGACY
|
||||
src/ccmain/adaptions.cpp
|
||||
src/ccmain/docqual.cpp
|
||||
src/ccmain/equationdetect.cpp
|
||||
@ -579,17 +594,13 @@ if (DISABLED_LEGACY_ENGINE)
|
||||
src/wordrec/plotedges.cpp
|
||||
src/wordrec/render.cpp
|
||||
src/wordrec/segsearch.cpp
|
||||
src/wordrec/wordclass.cpp
|
||||
)
|
||||
prepend_path(tesseract_src_legacy "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
list(REMOVE_ITEM tesseract_src ${tesseract_src_legacy})
|
||||
src/wordrec/wordclass.cpp)
|
||||
prepend_path(TESSERACT_SRC_LEGACY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
list(REMOVE_ITEM TESSERACT_SRC ${TESSERACT_SRC_LEGACY})
|
||||
endif(DISABLED_LEGACY_ENGINE)
|
||||
|
||||
list(APPEND arch_files
|
||||
src/arch/dotproduct.cpp
|
||||
src/arch/simddetect.cpp
|
||||
src/arch/intsimdmatrix.cpp
|
||||
)
|
||||
list(APPEND arch_files src/arch/dotproduct.cpp src/arch/simddetect.cpp
|
||||
src/arch/intsimdmatrix.cpp)
|
||||
|
||||
if(MARCH_NATIVE_FLAGS)
|
||||
set_source_files_properties(src/arch/dotproduct.cpp
|
||||
@ -601,7 +612,8 @@ if(HAVE_AVX)
|
||||
PROPERTIES COMPILE_FLAGS ${AVX_COMPILE_FLAGS})
|
||||
endif(HAVE_AVX)
|
||||
if(HAVE_AVX2)
|
||||
list(APPEND arch_files_opt src/arch/intsimdmatrixavx2.cpp src/arch/dotproductavx.cpp)
|
||||
list(APPEND arch_files_opt src/arch/intsimdmatrixavx2.cpp
|
||||
src/arch/dotproductavx.cpp)
|
||||
set_source_files_properties(src/arch/intsimdmatrixavx2.cpp
|
||||
PROPERTIES COMPILE_FLAGS ${AVX2_COMPILE_FLAGS})
|
||||
endif(HAVE_AVX2)
|
||||
@ -611,19 +623,25 @@ if(HAVE_FMA)
|
||||
PROPERTIES COMPILE_FLAGS ${FMA_COMPILE_FLAGS})
|
||||
endif(HAVE_FMA)
|
||||
if(HAVE_SSE4_1)
|
||||
list(APPEND arch_files_opt src/arch/dotproductsse.cpp src/arch/intsimdmatrixsse.cpp)
|
||||
set_source_files_properties(src/arch/dotproductsse.cpp src/arch/intsimdmatrixsse.cpp
|
||||
list(APPEND arch_files_opt src/arch/dotproductsse.cpp
|
||||
src/arch/intsimdmatrixsse.cpp)
|
||||
set_source_files_properties(
|
||||
src/arch/dotproductsse.cpp src/arch/intsimdmatrixsse.cpp
|
||||
PROPERTIES COMPILE_FLAGS ${SSE4_1_COMPILE_FLAGS})
|
||||
endif(HAVE_SSE4_1)
|
||||
if(HAVE_NEON)
|
||||
list(APPEND arch_files_opt src/arch/dotproductneon.cpp src/arch/intsimdmatrixneon.cpp)
|
||||
list(APPEND arch_files_opt src/arch/dotproductneon.cpp
|
||||
src/arch/intsimdmatrixneon.cpp)
|
||||
if(NEON_COMPILE_FLAGS)
|
||||
set_source_files_properties(src/arch/dotproductneon.cpp src/arch/intsimdmatrixneon.cpp
|
||||
set_source_files_properties(
|
||||
src/arch/dotproductneon.cpp src/arch/intsimdmatrixneon.cpp
|
||||
PROPERTIES COMPILE_FLAGS ${NEON_COMPILE_FLAGS})
|
||||
endif()
|
||||
endif(HAVE_NEON)
|
||||
|
||||
file(GLOB_RECURSE tesseract_hdr
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
tesseract_hdr
|
||||
include/*
|
||||
src/arch/*.h
|
||||
src/ccmain/*.h
|
||||
@ -636,10 +654,10 @@ file(GLOB_RECURSE tesseract_hdr
|
||||
src/opencl/*.h
|
||||
src/textord/*.h
|
||||
src/viewer/*.h
|
||||
src/wordrec/*.h
|
||||
)
|
||||
src/wordrec/*.h)
|
||||
|
||||
set(tesseract_src ${tesseract_src}
|
||||
set(TESSERACT_SRC
|
||||
${TESSERACT_SRC}
|
||||
src/api/baseapi.cpp
|
||||
src/api/capi.cpp
|
||||
src/api/renderer.cpp
|
||||
@ -647,37 +665,36 @@ set(tesseract_src ${tesseract_src}
|
||||
src/api/hocrrenderer.cpp
|
||||
src/api/lstmboxrenderer.cpp
|
||||
src/api/pdfrenderer.cpp
|
||||
src/api/wordstrboxrenderer.cpp
|
||||
)
|
||||
src/api/wordstrboxrenderer.cpp)
|
||||
|
||||
set(libtessfiles ${tesseract_src} ${arch_files} ${arch_files_opt} ${tesseract_hdr})
|
||||
set(LIBTESSFILES ${TESSERACT_SRC} ${arch_files} ${arch_files_opt}
|
||||
${tesseract_hdr})
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${libtessfiles})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${LIBTESSFILES})
|
||||
|
||||
add_library (libtesseract ${libtessfiles})
|
||||
target_include_directories (libtesseract
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
add_library(libtesseract ${LIBTESSFILES})
|
||||
target_include_directories(
|
||||
libtesseract
|
||||
PRIVATE src
|
||||
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/arch>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/ccmain>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/ccstruct>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/ccutil>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/classify>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/cutil>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/dict>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/lstm>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/opencl>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/textord>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/viewer>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/wordrec>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/training>
|
||||
)
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/arch>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/ccmain>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/ccstruct>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/ccutil>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/classify>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/cutil>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/dict>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/lstm>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/opencl>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/textord>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/viewer>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/wordrec>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/training>)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions (libtesseract
|
||||
target_compile_definitions(
|
||||
libtesseract
|
||||
PRIVATE -DTESS_EXPORTS
|
||||
INTERFACE -DTESS_IMPORTS
|
||||
)
|
||||
INTERFACE -DTESS_IMPORTS)
|
||||
# generate_export_header (libtesseract EXPORT_MACRO_NAME TESS_API)
|
||||
endif()
|
||||
target_link_libraries(libtesseract PRIVATE ${LIB_Ws2_32} ${LIB_pthread})
|
||||
@ -694,36 +711,50 @@ if(CURL_FOUND)
|
||||
target_link_libraries(libtesseract PUBLIC ${CURL_LIBRARIES})
|
||||
endif()
|
||||
endif(CURL_FOUND)
|
||||
set_target_properties (libtesseract PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
set_target_properties (libtesseract PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
|
||||
set_target_properties(libtesseract
|
||||
PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
set_target_properties(libtesseract
|
||||
PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
|
||||
if(WIN32)
|
||||
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)
|
||||
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)
|
||||
else()
|
||||
set_target_properties(libtesseract PROPERTIES OUTPUT_NAME tesseract)
|
||||
endif()
|
||||
|
||||
if(SW_BUILD)
|
||||
target_link_libraries (libtesseract PUBLIC
|
||||
org.sw.demo.danbloomberg.leptonica
|
||||
org.sw.demo.libarchive.libarchive
|
||||
)
|
||||
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 NAMESPACE Tesseract::)
|
||||
target_link_libraries(libtesseract PUBLIC org.sw.demo.danbloomberg.leptonica
|
||||
org.sw.demo.libarchive.libarchive)
|
||||
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
|
||||
NAMESPACE Tesseract::)
|
||||
else()
|
||||
target_link_libraries(libtesseract PUBLIC ${Leptonica_LIBRARIES})
|
||||
export(TARGETS libtesseract FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake NAMESPACE Tesseract::)
|
||||
export(
|
||||
TARGETS libtesseract
|
||||
FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake
|
||||
NAMESPACE Tesseract::)
|
||||
endif()
|
||||
|
||||
if (WIN32 AND CLANG AND OPENMP_BUILD)
|
||||
# Workaround for "libomp.lib is not automatically added on Windows"
|
||||
# see: http://lists.llvm.org/pipermail/openmp-dev/2015-August/000857.html
|
||||
if(WIN32
|
||||
AND CLANG
|
||||
AND OPENMP_BUILD)
|
||||
# Workaround for "libomp.lib is not automatically added on Windows" see:
|
||||
# http://lists.llvm.org/pipermail/openmp-dev/2015-August/000857.html
|
||||
target_link_libraries(libtesseract PRIVATE ${OpenMP_LIBRARY})
|
||||
endif()
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# EXECUTABLE tesseract
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
add_executable(tesseract src/tesseract.cpp)
|
||||
target_link_libraries(tesseract libtesseract)
|
||||
@ -735,9 +766,11 @@ if (OPENMP_BUILD AND UNIX)
|
||||
target_link_libraries(tesseract pthread)
|
||||
endif()
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
if (BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/unittest/third_party/googletest/CMakeLists.txt)
|
||||
if(BUILD_TESTS AND EXISTS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/unittest/third_party/googletest/CMakeLists.txt
|
||||
)
|
||||
add_subdirectory(unittest/third_party/googletest)
|
||||
endif()
|
||||
|
||||
@ -749,7 +782,8 @@ 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)
|
||||
configure_file(tesseract.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/tesseract.pc
|
||||
@ONLY)
|
||||
|
||||
configure_package_config_file(
|
||||
cmake/templates/TesseractConfig.cmake.in
|
||||
@ -761,45 +795,51 @@ write_basic_package_version_file(
|
||||
VERSION ${PACKAGE_VERSION}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tesseract.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tesseract.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
install(TARGETS tesseract DESTINATION bin)
|
||||
install(TARGETS libtesseract EXPORT TesseractTargets RUNTIME DESTINATION bin LIBRARY
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
install(
|
||||
TARGETS libtesseract
|
||||
EXPORT TesseractTargets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(EXPORT TesseractTargets NAMESPACE Tesseract:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/tesseract)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(
|
||||
EXPORT TesseractTargets
|
||||
NAMESPACE Tesseract::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/tesseract)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
install(FILES
|
||||
include/tesseract/baseapi.h
|
||||
install(
|
||||
FILES include/tesseract/baseapi.h
|
||||
include/tesseract/capi.h
|
||||
include/tesseract/renderer.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/tesseract/version.h
|
||||
|
||||
include/tesseract/ltrresultiterator.h
|
||||
include/tesseract/pageiterator.h
|
||||
include/tesseract/resultiterator.h
|
||||
include/tesseract/osdetect.h
|
||||
|
||||
include/tesseract/publictypes.h
|
||||
|
||||
include/tesseract/ocrclass.h
|
||||
include/tesseract/export.h
|
||||
include/tesseract/unichar.h
|
||||
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/src/endianness.h
|
||||
DESTINATION include/tesseract)
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# uninstall target
|
||||
########################################
|
||||
# ##############################################################################
|
||||
if(NOT TARGET uninstall)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
add_custom_target(
|
||||
uninstall
|
||||
COMMENT "Uninstall installed files"
|
||||
COMMAND ${CMAKE_COMMAND} -P
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
endif()
|
||||
|
||||
# ##############################################################################
|
||||
|
@ -9,50 +9,60 @@ endif()
|
||||
|
||||
if(SW_BUILD)
|
||||
set(ICU_FOUND 1)
|
||||
else() # NOT SW_BUILD
|
||||
find_package(PkgConfig)
|
||||
endif()
|
||||
|
||||
# experimental
|
||||
if (MSVC AND NOT SW_BUILD AND NOT USE_SYSTEM_ICU)
|
||||
# If PkgConfig is not present training tools will not be build,
|
||||
# so it does not make sense to set ICU
|
||||
if(MSVC
|
||||
AND PKG_CONFIG_FOUND
|
||||
AND NOT SW_BUILD
|
||||
AND NOT USE_SYSTEM_ICU)
|
||||
include(CheckTypeSize)
|
||||
check_type_size("void *" SIZEOF_VOID_P)
|
||||
|
||||
if(SIZEOF_VOID_P EQUAL 8)
|
||||
set(X64 1)
|
||||
set(ARCH_DIR_NAME 64)
|
||||
set(ARCH_NAME 64)
|
||||
elseif(SIZEOF_VOID_P EQUAL 4)
|
||||
set(X86 1)
|
||||
set(ARCH_DIR_NAME 32)
|
||||
set(ARCH_NAME 32)
|
||||
else()
|
||||
message(FATAL_ERROR "Cannot determine target architecture")
|
||||
endif()
|
||||
|
||||
set(icu_dir "${CMAKE_CURRENT_BINARY_DIR}/icu")
|
||||
set(icu_archive "${icu_dir}/icu${ARCH_DIR_NAME}.zip")
|
||||
set(ICU_DIR "${CMAKE_CURRENT_BINARY_DIR}/icu")
|
||||
set(ICU_ARCHIVE "${ICU_DIR}/icu${ARCH_NAME}.zip")
|
||||
|
||||
if(X86)
|
||||
set(icu_hash 45167a240b60e36b59a87eda23490ce4)
|
||||
set(ICU_HASH 45167a240b60e36b59a87eda23490ce4)
|
||||
else()
|
||||
set(icu_hash 480c72491576c048de1218c3c5519399)
|
||||
set(ICU_HASH 480c72491576c048de1218c3c5519399)
|
||||
endif()
|
||||
|
||||
message(STATUS "Downloading latest ICU binaries")
|
||||
|
||||
file(DOWNLOAD
|
||||
"https://github.com/unicode-org/icu/releases/download/release-56-1/icu4c-56_1-Win${ARCH_DIR_NAME}-msvc10.zip"
|
||||
"${icu_archive}"
|
||||
set(COMPILER "msvc10")
|
||||
set(ICU_URL "https://github.com/unicode-org/icu/releases/download")
|
||||
SET(ICU_R "56-1")
|
||||
SET(ICU_V "56_1")
|
||||
file(
|
||||
DOWNLOAD
|
||||
"${ICU_URL}/release-${ICU_R}/icu4c-${ICU_V}-Win${ARCH_NAME}-${COMPILER}.zip"
|
||||
"${ICU_ARCHIVE}"
|
||||
SHOW_PROGRESS
|
||||
INACTIVITY_TIMEOUT 300 # seconds
|
||||
EXPECTED_HASH MD5=${icu_hash}
|
||||
)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xz "${icu_archive}"
|
||||
WORKING_DIRECTORY "${icu_dir}"
|
||||
RESULT_VARIABLE __result
|
||||
)
|
||||
EXPECTED_HASH MD5=${ICU_HASH})
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xz "${ICU_ARCHIVE}"
|
||||
WORKING_DIRECTORY "${ICU_DIR}"
|
||||
RESULT_VARIABLE __result)
|
||||
if(NOT __result EQUAL 0)
|
||||
message(FATAL_ERROR "error ${__result}")
|
||||
endif()
|
||||
|
||||
set(ICU_ROOT ${icu_dir}/icu)
|
||||
set(ICU_ROOT ${ICU_DIR}/icu)
|
||||
endif()
|
||||
# experimental
|
||||
|
||||
@ -64,12 +74,11 @@ if (NOT SW_BUILD)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# LIBRARY common_training
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
set(common_training_src
|
||||
set(COMMON_TRAINING_SRC
|
||||
common/commandlineflags.cpp
|
||||
common/commandlineflags.h
|
||||
common/commontraining.cpp
|
||||
@ -77,11 +86,12 @@ set(common_training_src
|
||||
common/ctc.cpp
|
||||
common/ctc.h
|
||||
common/networkbuilder.cpp
|
||||
common/networkbuilder.h
|
||||
)
|
||||
common/networkbuilder.h)
|
||||
|
||||
if(NOT DISABLED_LEGACY_ENGINE)
|
||||
list(APPEND common_training_src
|
||||
list(
|
||||
APPEND
|
||||
COMMON_TRAINING_SRC
|
||||
common/errorcounter.cpp
|
||||
common/errorcounter.h
|
||||
common/intfeaturedist.cpp
|
||||
@ -93,105 +103,130 @@ list(APPEND common_training_src
|
||||
common/sampleiterator.cpp
|
||||
common/sampleiterator.h
|
||||
common/trainingsampleset.cpp
|
||||
common/trainingsampleset.h
|
||||
)
|
||||
common/trainingsampleset.h)
|
||||
endif()
|
||||
|
||||
add_library (common_training ${common_training_src})
|
||||
target_include_directories (common_training PUBLIC common ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_library(common_training ${COMMON_TRAINING_SRC})
|
||||
target_include_directories(common_training PUBLIC common
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(common_training PUBLIC libtesseract)
|
||||
generate_export_header (common_training EXPORT_MACRO_NAME TESS_COMMON_TRAINING_API)
|
||||
generate_export_header(common_training EXPORT_MACRO_NAME
|
||||
TESS_COMMON_TRAINING_API)
|
||||
project_group(common_training "Training Tools")
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# EXECUTABLE ambiguous_words
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
if(NOT DISABLED_LEGACY_ENGINE)
|
||||
add_executable(ambiguous_words ambiguous_words.cpp)
|
||||
target_link_libraries(ambiguous_words common_training)
|
||||
project_group(ambiguous_words "Training Tools")
|
||||
install (TARGETS ambiguous_words RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS ambiguous_words
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
endif()
|
||||
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# EXECUTABLE classifier_tester
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
if(NOT DISABLED_LEGACY_ENGINE)
|
||||
add_executable(classifier_tester classifier_tester.cpp)
|
||||
target_link_libraries(classifier_tester common_training)
|
||||
project_group(classifier_tester "Training Tools")
|
||||
install (TARGETS classifier_tester RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS classifier_tester
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
endif()
|
||||
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# EXECUTABLE combine_tessdata
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
add_executable(combine_tessdata combine_tessdata.cpp)
|
||||
target_link_libraries(combine_tessdata common_training)
|
||||
project_group(combine_tessdata "Training Tools")
|
||||
install (TARGETS combine_tessdata RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS combine_tessdata
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# EXECUTABLE cntraining
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
if(NOT DISABLED_LEGACY_ENGINE)
|
||||
add_executable(cntraining cntraining.cpp)
|
||||
target_link_libraries(cntraining common_training)
|
||||
project_group(cntraining "Training Tools")
|
||||
install (TARGETS cntraining RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS cntraining
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
endif()
|
||||
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# EXECUTABLE dawg2wordlist
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
add_executable(dawg2wordlist dawg2wordlist.cpp)
|
||||
target_link_libraries(dawg2wordlist common_training)
|
||||
project_group(dawg2wordlist "Training Tools")
|
||||
install (TARGETS dawg2wordlist RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS dawg2wordlist
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# EXECUTABLE mftraining
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
if(NOT DISABLED_LEGACY_ENGINE)
|
||||
add_executable(mftraining mftraining.cpp mergenf.cpp mergenf.h)
|
||||
target_link_libraries(mftraining common_training)
|
||||
project_group(mftraining "Training Tools")
|
||||
install (TARGETS mftraining RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS mftraining
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
endif()
|
||||
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# EXECUTABLE shapeclustering
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
if(NOT DISABLED_LEGACY_ENGINE)
|
||||
add_executable(shapeclustering shapeclustering.cpp)
|
||||
target_link_libraries(shapeclustering common_training)
|
||||
project_group(shapeclustering "Training Tools")
|
||||
install (TARGETS shapeclustering RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS shapeclustering
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
endif()
|
||||
|
||||
|
||||
########################################
|
||||
# ##############################################################################
|
||||
# EXECUTABLE wordlist2dawg
|
||||
########################################
|
||||
# ##############################################################################
|
||||
|
||||
add_executable(wordlist2dawg wordlist2dawg.cpp)
|
||||
target_link_libraries(wordlist2dawg common_training)
|
||||
project_group(wordlist2dawg "Training Tools")
|
||||
install (TARGETS wordlist2dawg RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
|
||||
install(
|
||||
TARGETS wordlist2dawg
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
if(ICU_FOUND)
|
||||
|
||||
@ -199,90 +234,105 @@ if (NOT SW_BUILD)
|
||||
include_directories(${ICU_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
########################################
|
||||
# ############################################################################
|
||||
# LIBRARY unicharset_training
|
||||
########################################
|
||||
# ############################################################################
|
||||
|
||||
file(GLOB unicharset_training_src
|
||||
unicharset/*
|
||||
)
|
||||
file(GLOB unicharset_training_src unicharset/*)
|
||||
|
||||
add_library(unicharset_training ${unicharset_training_src})
|
||||
if(SW_BUILD)
|
||||
target_link_libraries (unicharset_training PUBLIC common_training org.sw.demo.unicode.icu.i18n)
|
||||
target_link_libraries(unicharset_training
|
||||
PUBLIC common_training org.sw.demo.unicode.icu.i18n)
|
||||
else()
|
||||
target_link_libraries (unicharset_training PUBLIC common_training ${ICU_LINK_LIBRARIES})
|
||||
target_link_libraries(unicharset_training PUBLIC common_training
|
||||
${ICU_LINK_LIBRARIES})
|
||||
endif()
|
||||
target_include_directories (unicharset_training PUBLIC unicharset ${CMAKE_CURRENT_BINARY_DIR})
|
||||
generate_export_header (unicharset_training EXPORT_MACRO_NAME TESS_UNICHARSET_TRAINING_API)
|
||||
target_include_directories(unicharset_training
|
||||
PUBLIC unicharset ${CMAKE_CURRENT_BINARY_DIR})
|
||||
generate_export_header(unicharset_training EXPORT_MACRO_NAME
|
||||
TESS_UNICHARSET_TRAINING_API)
|
||||
project_group(unicharset_training "Training Tools")
|
||||
|
||||
|
||||
########################################
|
||||
# ############################################################################
|
||||
# EXECUTABLE combine_lang_model
|
||||
########################################
|
||||
# ############################################################################
|
||||
|
||||
add_executable(combine_lang_model combine_lang_model.cpp)
|
||||
target_link_libraries(combine_lang_model unicharset_training)
|
||||
project_group(combine_lang_model "Training Tools")
|
||||
install (TARGETS combine_lang_model RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS combine_lang_model
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
|
||||
########################################
|
||||
# ############################################################################
|
||||
# EXECUTABLE lstmeval
|
||||
########################################
|
||||
# ############################################################################
|
||||
|
||||
add_executable(lstmeval lstmeval.cpp)
|
||||
target_link_libraries(lstmeval unicharset_training ${LIB_pthread})
|
||||
project_group(lstmeval "Training Tools")
|
||||
install (TARGETS lstmeval RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS lstmeval
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
|
||||
########################################
|
||||
# ############################################################################
|
||||
# EXECUTABLE lstmtraining
|
||||
########################################
|
||||
# ############################################################################
|
||||
|
||||
add_executable(lstmtraining lstmtraining.cpp)
|
||||
target_link_libraries(lstmtraining unicharset_training ${LIB_pthread})
|
||||
project_group(lstmtraining "Training Tools")
|
||||
install (TARGETS lstmtraining RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS lstmtraining
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
|
||||
########################################
|
||||
# ############################################################################
|
||||
# EXECUTABLE merge_unicharsets
|
||||
########################################
|
||||
# ############################################################################
|
||||
|
||||
add_executable(merge_unicharsets merge_unicharsets.cpp)
|
||||
target_link_libraries(merge_unicharsets common_training)
|
||||
project_group(merge_unicharsets "Training Tools")
|
||||
install (TARGETS merge_unicharsets RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS merge_unicharsets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
|
||||
########################################
|
||||
# ############################################################################
|
||||
# EXECUTABLE set_unicharset_properties
|
||||
########################################
|
||||
# ############################################################################
|
||||
|
||||
add_executable(set_unicharset_properties set_unicharset_properties.cpp)
|
||||
target_link_libraries(set_unicharset_properties unicharset_training)
|
||||
project_group(set_unicharset_properties "Training Tools")
|
||||
install (TARGETS set_unicharset_properties RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS set_unicharset_properties
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
|
||||
########################################
|
||||
# ############################################################################
|
||||
# EXECUTABLE unicharset_extractor
|
||||
########################################
|
||||
# ############################################################################
|
||||
|
||||
add_executable(unicharset_extractor unicharset_extractor.cpp)
|
||||
target_link_libraries(unicharset_extractor unicharset_training)
|
||||
project_group(unicharset_extractor "Training Tools")
|
||||
install (TARGETS unicharset_extractor RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS unicharset_extractor
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
|
||||
########################################
|
||||
|
||||
if (NOT SW_BUILD)
|
||||
find_package(PkgConfig)
|
||||
endif()
|
||||
# ############################################################################
|
||||
|
||||
if(PKG_CONFIG_FOUND OR SW_BUILD)
|
||||
|
||||
@ -294,51 +344,50 @@ pkg_check_modules(PangoCairo REQUIRED pangocairo)
|
||||
pkg_check_modules(FontConfig REQUIRED fontconfig)
|
||||
endif()
|
||||
|
||||
|
||||
########################################
|
||||
# ##########################################################################
|
||||
# LIBRARY pango_training
|
||||
########################################
|
||||
# ##########################################################################
|
||||
|
||||
file(GLOB pango_training_src
|
||||
pango/*
|
||||
)
|
||||
file(GLOB pango_training_src pango/*)
|
||||
|
||||
add_library(pango_training ${pango_training_src})
|
||||
target_link_libraries(pango_training PUBLIC unicharset_training)
|
||||
if(SW_BUILD)
|
||||
target_link_libraries (pango_training PUBLIC org.sw.demo.gnome.pango.pangocairo)
|
||||
target_link_libraries(pango_training
|
||||
PUBLIC org.sw.demo.gnome.pango.pangocairo)
|
||||
else()
|
||||
if(PKG_CONFIG_FOUND)
|
||||
target_include_directories (pango_training BEFORE PUBLIC ${Cairo_INCLUDE_DIRS} ${Pango_INCLUDE_DIRS})
|
||||
target_include_directories(
|
||||
pango_training BEFORE PUBLIC ${Cairo_INCLUDE_DIRS}
|
||||
${Pango_INCLUDE_DIRS})
|
||||
target_compile_definitions(pango_training PUBLIC -DPANGO_ENABLE_ENGINE)
|
||||
target_link_libraries (pango_training PUBLIC
|
||||
${Pango_LINK_LIBRARIES}
|
||||
${Cairo_LINK_LIBRARIES}
|
||||
${PangoCairo_LINK_LIBRARIES}
|
||||
${PangoFt2_LINK_LIBRARIES}
|
||||
${FontConfig_LINK_LIBRARIES}
|
||||
)
|
||||
target_link_libraries(
|
||||
pango_training
|
||||
PUBLIC ${Pango_LINK_LIBRARIES} ${Cairo_LINK_LIBRARIES}
|
||||
${PangoCairo_LINK_LIBRARIES} ${PangoFt2_LINK_LIBRARIES}
|
||||
${FontConfig_LINK_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
target_include_directories (pango_training PUBLIC pango ${CMAKE_CURRENT_BINARY_DIR})
|
||||
generate_export_header (pango_training EXPORT_MACRO_NAME TESS_PANGO_TRAINING_API)
|
||||
target_include_directories(pango_training
|
||||
PUBLIC pango ${CMAKE_CURRENT_BINARY_DIR})
|
||||
generate_export_header(pango_training EXPORT_MACRO_NAME
|
||||
TESS_PANGO_TRAINING_API)
|
||||
project_group(pango_training "Training Tools")
|
||||
|
||||
|
||||
########################################
|
||||
# ##########################################################################
|
||||
# EXECUTABLE text2image
|
||||
########################################
|
||||
# ##########################################################################
|
||||
|
||||
set(text2image_src
|
||||
text2image.cpp
|
||||
degradeimage.cpp
|
||||
degradeimage.h
|
||||
)
|
||||
set(TEXT2IMAGE_SRC text2image.cpp degradeimage.cpp degradeimage.h)
|
||||
|
||||
add_executable (text2image ${text2image_src})
|
||||
add_executable(text2image ${TEXT2IMAGE_SRC})
|
||||
target_link_libraries(text2image pango_training)
|
||||
project_group(text2image "Training Tools")
|
||||
install (TARGETS text2image RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(
|
||||
TARGETS text2image
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
endif()
|
||||
endif(ICU_FOUND)
|
||||
|
Loading…
Reference in New Issue
Block a user