Merge branch 'master' of github.com-egorpugin:tesseract-ocr/tesseract

This commit is contained in:
Egor Pugin 2019-07-14 08:45:07 +03:00
commit 757a885a59
3 changed files with 46 additions and 30 deletions

View File

@ -115,22 +115,22 @@ if (STATIC)
set(LIBRARY_TYPE)
endif()
# Compiler specific environments
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CLANG 1)
endif()
if (WIN32)
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
if (NOT CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -Og")
elseif(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
if (NOT CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
if(CLANG)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-unused-command-line-argument")
endif()
set(LIB_Ws2_32 Ws2_32)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Wall /bigobj")
elseif(CLANG)
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)
@ -141,14 +141,15 @@ if (OPENMP_BUILD)
endif()
endif()
if (CYGWIN)
add_definitions(-D__CYGWIN__)
endif()
if (UNIX)
elseif(UNIX)
if (NOT ANDROID)
set(LIB_pthread pthread)
endif()
elseif(WIN32)
set(LIB_Ws2_32 Ws2_32)
endif()
###############################################################################

View File

@ -31,3 +31,4 @@ after_build:
artifacts:
- path: tesseract.zip
name: tesseract-$(APPVEYOR_BUILD_VERSION)

View File

@ -10,7 +10,11 @@ AC_INIT([tesseract],
[m4_esyscmd_s([test -d .git && git describe --abbrev=4 || cat VERSION])],
[https://github.com/tesseract-ocr/tesseract/issues],,
[https://github.com/tesseract-ocr/tesseract/])
# Store command like options for CXXFLAGS
OLD_CXXFLAGS=$CXXFLAGS
AC_PROG_CXX([g++ clang++])
# reset compiler flags to initial flags
AC_LANG([C++])
AC_LANG_COMPILER_REQUIRE
CXXFLAGS=${CXXFLAGS:-""}
@ -284,17 +288,39 @@ AC_ARG_ENABLE([tessdata-prefix],
AC_MSG_RESULT([$tessdata_prefix])
AM_CONDITIONAL([NO_TESSDATA_PREFIX], [test "$tessdata_prefix" = "no"])
# Detect Clang compiler
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[CLANG=yes], [CLANG=no])
AC_MSG_RESULT([$CLANG])
# Check whether to enable debugging
AC_MSG_CHECKING([whether to enable debugging])
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [turn on debugging [default=no]]))
AC_MSG_RESULT([$enable_debug])
if test x"$enable_debug" = x"yes"; then
AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -O0 -DDEBUG"
AM_CPPFLAGS="$AM_CPPFLAGS -g -Wall -DDEBUG"
CXXFLAGS=${CXXFLAGS:-"-O2"}
AM_CPPFLAGS="$AM_CPPFLAGS -g -Wall -DDEBUG -pedantic"
AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -DDEBUG -pedantic"
if test "x$CLANG" = "xyes"; then
# https://clang.llvm.org/docs/CommandGuide/clang.html
# clang treats -Og as -O1
AM_CPPFLAGS="$AM_CPPFLAGS -O0"
AM_CXXFLAGS="$AM_CXXFLAGS -O0"
else
AM_CPPFLAGS="$AM_CPPFLAGS -Og"
AM_CXXFLAGS="$AM_CXXFLAGS -Og"
fi
else
AM_CXXFLAGS="$AM_CXXFLAGS -O2 -DNDEBUG"
AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"
AM_CPPFLAGS="$AM_CPPFLAGS -O2 -DNDEBUG"
fi
#localedir='${prefix}/share/locale'
@ -326,18 +352,6 @@ LT_INIT
# ----------------------------------------
# C++ related options
# ----------------------------------------
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[CLANG=yes], [CLANG=no])
AC_MSG_RESULT([$CLANG])
dnl **********************
dnl Turn on C++11 or newer
dnl **********************