-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
164 lines (142 loc) · 4.69 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
project(tesseract-ocr)
cmake_minimum_required(VERSION 2.8)
include_directories(${LEPTONICA_INCLUDE_DIRS})
add_definitions(-DUSE_STD_NAMESPACE)
add_definitions(-fPIC)
add_definitions(-DWINDLLNAME="tesseract")
if(WIN32)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /Zi")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd /Zi")
# Multithreaded building
if(MSVC_VERSION GREATER 1400)
set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${PROCESSOR_COUNT}")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} /MP${PROCESSOR_COUNT}")
endif()
endif()
set(DUMMY_CPP "${CMAKE_BINARY_DIR}/dummy.cpp")
file(WRITE "${DUMMY_CPP}" "//autogenerated file by cmake\n")
add_subdirectory(ccutil)
add_subdirectory(viewer)
add_subdirectory(cutil)
add_subdirectory(opencl)
add_subdirectory(ccstruct)
add_subdirectory(dict)
add_subdirectory(classify)
add_subdirectory(wordrec)
add_subdirectory(neural_networks/runtime)
add_subdirectory(textord)
add_subdirectory(cube)
add_subdirectory(ccmain)
add_subdirectory(api)
add_subdirectory(tessdata)
add_subdirectory(doc)
####### Build merged static lib #######
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
include(MergeStaticLibraries)
list(APPEND TESSERACT_LIBRARY_SRCS "${DUMMY_CPP}")
if (WIN32)
list(APPEND TESSERACT_LIBRARY_SRCS msvsport/gettimeofday.cpp)
endif()
add_library(tesseract_static STATIC ${TESSERACT_LIBRARY_SRCS})
list(APPEND TESSERACT_LIBRARIES
tesseract_api_static
tesseract_main_static
tesseract_cube_static
tesseract_neural_static
tesseract_textord_static
tesseract_wordrec_static
tesseract_classify_static
tesseract_dict_static
tesseract_ccstruct_static
tesseract_cutil_static
tesseract_viewer_static
tesseract_ccutil_static
tesseract_opencl_static
)
set(TESSERACT_LIBRARIES_PATHS "")
foreach (LIB ${TESSERACT_LIBRARIES})
get_target_property(LIB_FILE ${LIB} LOCATION)
target_link_libraries(tesseract_static ${STATIC_LIB_LINK} ${LIB_FILE})
set(TESSERACT_LIBRARIES_PATHS "${TESSERACT_LIBRARIES_PATHS};${LIB_FILE}")
endforeach()
target_link_libraries(tesseract_static ${STATIC_LIB_LINK} ${LEPTONICA_LIBRARIES})
if(WIN32)
target_link_libraries(tesseract_static ws2_32.lib)
endif()
add_dependencies(tesseract_static ${TESSERACT_LIBRARIES})
set(CMAKE_BUILD_TYPE release)
MERGE_STATIC_LIBRARIES (tesseract_static ALL
"${LEPTONICA_LIBRARIES}${TESSERACT_LIBRARIES_PATHS}"
)
install(TARGETS tesseract_static DESTINATION lib)
########### install files ###############
# install(FILES tesseract.pc DESTINATION )
#original Makefile.am contents follow:
### run autogen.sh to create Makefile.in from this file
#ACLOCAL_AMFLAGS = -I m4
#
#if ENABLE_TRAINING
#TRAINING_SUBDIR = training
#training:
# @cd "$(top_builddir)/training" && $(MAKE)
#training-install:
# @cd "$(top_builddir)/training" && $(MAKE) install
#clean-local:
# @cd "$(top_builddir)/training" && $(MAKE) clean
#else
#training:
# @echo "Need to reconfigure project, so there are no errors"
#endif
#
#.PHONY: install-langs ScrollView.jar install-jars $(TRAINING_SUBDIR)
#
#SUBDIRS = ccutil viewer cutil opencl ccstruct dict classify wordrec neural_networks/runtime textord cube ccmain api . tessdata doc
#
#EXTRA_DIST = ReleaseNotes \
# aclocal.m4 config configure.ac autogen.sh contrib \
# tesseract.pc.in $(TRAINING_SUBDIR) java doc testing
#
#DIST_SUBDIRS = $(SUBDIRS) $(TRAINING_SUBDIR)
#
#uninstall-hook:
# rm -rf $(DESTDIR)$(includedir)
#
#dist-hook:
## Need to remove .svn directories from directories
## added using EXTRA_DIST. $(distdir)/tessdata would in
## theory suffice.
# rm -rf `find $(distdir) -name .svn`
# rm -rf `find $(distdir) -name .git`
# rm -rf `find $(distdir) -name .deps`
# rm -rf `find $(distdir) -name .libs`
# rm -rf `find $(distdir) -name *.o`
# rm -rf `find $(distdir) -name *.lo`
# rm -rf `find $(distdir) -name *.la`
# rm -rf `find $(distdir)/training -executable -type f`
# rm -rf $(distdir)/doc/html/*
#
#ScrollView.jar:
# @cd "$(top_builddir)/java" && $(MAKE) $@
#
#install-jars:
# @cd "$(top_builddir)/java" && $(MAKE) $@
#
#doc-dummy:
#
#doc: doc-dummy
# -srcdir="$(top_srcdir)" builddir="$(top_builddir)" \
# version="@PACKAGE_VERSION@" name="@PACKAGE_NAME@" \
# doxygen $(top_srcdir)/doc/Doxyfile
#
#doc-pack: doc
# -chmod a+r $(top_srcdir)/doc/html/*
# @tar --create --directory=$(top_srcdir)/doc/html --verbose --file=- . | gzip -c -9 > $(top_srcdir)/@PACKAGE_NAME@-@[email protected];
#
#doc-clean:
# rm -rf $(top_srcdir)/doc/html/*
#
#pkgconfigdir = $(libdir)/pkgconfig
#pkgconfig_DATA = tesseract.pc