Fix cygwin build.

This commit is contained in:
Egor Pugin 2015-09-07 02:49:18 +03:00
parent c0d8a07b9d
commit da3852dc77
3 changed files with 55 additions and 40 deletions

View File

@ -8,7 +8,7 @@
#
###############################################################################
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 2.8.11)
# In-source builds are disabled.
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
@ -46,9 +46,11 @@ set(VERSION_PLAIN ${VERSION_MAJOR}.${VERSION_MINOR})
find_package(Leptonica 1.72 REQUIRED)
if (BUILD_TRAINING)
find_package(ICU COMPONENTS uc i18n)
find_package(OpenCL QUIET)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(Pango pango)
pkg_check_modules(Cairo cairo)
pkg_check_modules(PangoFt2 pangoft2)
@ -83,6 +85,10 @@ if (WIN32)
set(LIB_Ws2_32 Ws2_32)
endif()
if (CYGWIN)
add_definitions(-D__CYGWIN__)
endif()
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")

View File

@ -47,7 +47,7 @@
#define SIGNED signed
#endif
#ifdef _WIN32
#if defined(_WIN32) || defined(__CYGWIN__)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

View File

@ -2,7 +2,7 @@
# tesseract
#
if (STATIC)
if (STATIC OR NOT (WIN32 OR CYGWIN))
########################################
# LIBRARY tessopt
@ -25,7 +25,7 @@ set(common_training_hdr
commontraining.h
)
add_library (common_training ${common_training_src} ${common_training_hdr})
target_link_libraries (common_training tessopt)
target_link_libraries (common_training tesseract tessopt)
project_group (common_training "Training Tools")
@ -43,7 +43,7 @@ project_group (ambiguous_words "Training Tools")
########################################
add_executable (classifier_tester classifier_tester.cpp)
target_link_libraries (classifier_tester tesseract common_training)
target_link_libraries (classifier_tester common_training)
project_group (classifier_tester "Training Tools")
@ -61,7 +61,7 @@ project_group (combine_tessdata "Training Tools")
########################################
add_executable (cntraining cntraining.cpp)
target_link_libraries (cntraining tesseract common_training)
target_link_libraries (cntraining common_training)
project_group (cntraining "Training Tools")
@ -78,8 +78,8 @@ project_group (dawg2wordlist "Training Tools")
# EXECUTABLE mftraining
########################################
add_executable (mftraining mftraining.cpp mergenf.cpp)
target_link_libraries (mftraining tesseract common_training)
add_executable (mftraining mftraining.cpp mergenf.cpp mergenf.h)
target_link_libraries (mftraining common_training)
project_group (mftraining "Training Tools")
@ -88,7 +88,7 @@ project_group (mftraining "Training Tools")
########################################
add_executable (shapeclustering shapeclustering.cpp)
target_link_libraries (shapeclustering tesseract common_training)
target_link_libraries (shapeclustering common_training)
project_group (shapeclustering "Training Tools")
@ -110,53 +110,61 @@ target_link_libraries (wordlist2dawg tesseract)
project_group (wordlist2dawg "Training Tools")
endif(STATIC)
###############################################################################
# UNCHECKED
###############################################################################
if (BUILD_TRAINING)
if (PKG_CONFIG_FOUND)
add_definitions(-DPANGO_ENABLE_ENGINE)
########################################
# LIBRARY training ?
########################################
set(training_src
boxchar.cpp commandlineflags.cpp commontraining.cpp degradeimage.cpp
fileio.cpp ligature_table.cpp normstrngs.cpp pango_font_info.cpp
stringrenderer.cpp tlog.cpp unicharset_training_utils.cpp
)
set(training_hdr
boxchar.h commandlineflags.h commontraining.h degradeimage.h
fileio.h icuerrorcode.h ligature_table.h normstrngs.h
mergenf.h pango_font_info.h stringrenderer.h
tessopt.h tlog.h unicharset_training_utils.h util.h
)
add_library (training ${training_src} ${training_hdr})
project_group (training "Training Tools")
########################################
# EXECUTABLE set_unicharset_properties ?
# EXECUTABLE set_unicharset_properties
########################################
add_executable (set_unicharset_properties
set_unicharset_properties.cpp
unicharset_training_utils.cpp
unicharset_training_utils.h
fileio.cpp
fileio.h
normstrngs.cpp
normstrngs.h
icuerrorcode.h
)
target_link_libraries (set_unicharset_properties tesseract common_training ${ICU_LIBRARIES})
target_link_libraries (set_unicharset_properties common_training ${ICU_LIBRARIES})
project_group (set_unicharset_properties "Training Tools")
########################################
# EXECUTABLE text2image ?
# EXECUTABLE text2image
########################################
add_executable (text2image text2image.cpp)
target_link_libraries (text2image tesseract training tessopt
set(text2image_src
text2image.cpp
boxchar.cpp
boxchar.h
degradeimage.cpp
degradeimage.h
fileio.cpp
fileio.h
ligature_table.cpp
ligature_table.h
normstrngs.cpp
normstrngs.h
pango_font_info.cpp
pango_font_info.h
stringrenderer.cpp
stringrenderer.h
tlog.cpp
tlog.h
util.h
icuerrorcode.h
)
if (CYGWIN)
set(text2image_src ${text2image_src} ../vs2010/port/strcasestr.cpp)
endif()
add_executable (text2image ${text2image_src})
target_link_libraries (text2image tesseract common_training
${ICU_LIBRARIES}
${Pango_LIBRARIES}
${Cairo_LIBRARIES}
@ -166,6 +174,7 @@ target_link_libraries (text2image tesseract training tessopt
)
project_group (text2image "Training Tools")
endif(BUILD_TRAINING)
endif(PKG_CONFIG_FOUND)
endif(STATIC OR NOT (WIN32 OR CYGWIN))
###############################################################################