Remove more code for builds with disabled legacy engine

Now the Tesseract library no longer includes unused code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-08-13 16:34:46 +02:00
parent f43ca88f29
commit 46e2a0f106
10 changed files with 83 additions and 56 deletions

View File

@ -65,7 +65,6 @@ libtesseract_main_la_SOURCES = \
paragraphs.cpp \
paramsd.cpp \
pgedit.cpp \
recogtraining.cpp \
reject.cpp \
resultiterator.cpp \
tessedit.cpp \
@ -75,15 +74,15 @@ libtesseract_main_la_SOURCES = \
werdit.cpp
if !DISABLED_LEGACY_ENGINE
libtesseract_main_la_SOURCES += \
adaptions.cpp \
docqual.cpp \
equationdetect.cpp \
fixspace.cpp \
fixxht.cpp \
osdetect.cpp \
par_control.cpp \
superscript.cpp \
tessbox.cpp \
tfacepp.cpp
libtesseract_main_la_SOURCES += adaptions.cpp
libtesseract_main_la_SOURCES += docqual.cpp
libtesseract_main_la_SOURCES += equationdetect.cpp
libtesseract_main_la_SOURCES += fixspace.cpp
libtesseract_main_la_SOURCES += fixxht.cpp
libtesseract_main_la_SOURCES += osdetect.cpp
libtesseract_main_la_SOURCES += par_control.cpp
libtesseract_main_la_SOURCES += recogtraining.cpp
libtesseract_main_la_SOURCES += superscript.cpp
libtesseract_main_la_SOURCES += tessbox.cpp
libtesseract_main_la_SOURCES += tfacepp.cpp
endif

View File

@ -297,8 +297,6 @@ void Tesseract::MaximallyChopWord(const GenericVector<TBOX>& boxes,
word_res->FakeClassifyWord(blob_choices.size(), &blob_choices[0]);
}
#endif // ndef DISABLED_LEGACY_ENGINE
/// Helper to compute the dispute resolution metric.
/// Disputed blob resolution. The aim is to give the blob to the most
/// appropriate boxfile box. Most of the time it is obvious, but if
@ -318,8 +316,6 @@ static double BoxMissMetric(const TBOX& box1, const TBOX& box2) {
return 1.0 * (a - overlap_area) * (b - overlap_area) / a / b;
}
#ifndef DISABLED_LEGACY_ENGINE
/// Gather consecutive blobs that match the given box into the best_state
/// and corresponding correct_text.
///

View File

@ -20,25 +20,36 @@ pkginclude_HEADERS = publictypes.h
noinst_HEADERS = \
blamer.h blobbox.h blobs.h blread.h boxread.h boxword.h \
ccstruct.h coutln.h crakedge.h \
debugpixa.h detlinefit.h dppoint.h fontinfo.h \
debugpixa.h detlinefit.h dppoint.h \
imagedata.h \
linlsq.h matrix.h mod128.h normalis.h \
ocrblock.h ocrpara.h ocrrow.h otsuthr.h \
pageres.h params_training_featdef.h \
pageres.h \
pdblock.h points.h polyaprx.h polyblk.h \
quadlsq.h quadratc.h quspline.h ratngs.h rect.h rejctmap.h \
seam.h split.h statistc.h stepblob.h vecfuncs.h werd.h
seam.h split.h statistc.h stepblob.h werd.h
if !DISABLED_LEGACY_ENGINE
noinst_HEADERS += fontinfo.h
noinst_HEADERS += params_training_featdef.h
noinst_HEADERS += vecfuncs.h
endif
noinst_LTLIBRARIES = libtesseract_ccstruct.la
libtesseract_ccstruct_la_SOURCES = \
blamer.cpp blobbox.cpp blobs.cpp blread.cpp boxread.cpp boxword.cpp ccstruct.cpp coutln.cpp \
detlinefit.cpp dppoint.cpp fontinfo.cpp \
detlinefit.cpp dppoint.cpp \
imagedata.cpp \
linlsq.cpp matrix.cpp mod128.cpp normalis.cpp \
ocrblock.cpp ocrpara.cpp ocrrow.cpp otsuthr.cpp \
pageres.cpp pdblock.cpp points.cpp polyaprx.cpp polyblk.cpp \
params_training_featdef.cpp \
quadlsq.cpp quspline.cpp ratngs.cpp rect.cpp rejctmap.cpp \
seam.cpp split.cpp statistc.cpp stepblob.cpp \
vecfuncs.cpp werd.cpp
werd.cpp
if !DISABLED_LEGACY_ENGINE
libtesseract_ccstruct_la_SOURCES += fontinfo.cpp
libtesseract_ccstruct_la_SOURCES += params_training_featdef.cpp
libtesseract_ccstruct_la_SOURCES += vecfuncs.cpp
endif

View File

@ -16,26 +16,36 @@ pkginclude_HEADERS = \
unichar.h
noinst_HEADERS = \
ambigs.h bits16.h bitvector.h ccutil.h clst.h doubleptr.h elst2.h \
ambigs.h bits16.h ccutil.h clst.h doubleptr.h elst2.h \
elst.h errcode.h fileerr.h \
genericheap.h globaloc.h host.h \
indexmapbidi.h kdpair.h lsterr.h \
kdpair.h lsterr.h \
object_cache.h params.h qrsequence.h sorthelper.h \
scanutils.h tessdatamanager.h tprintf.h \
unicharcompress.h unicharmap.h unicharset.h unicity_table.h unicodes.h \
universalambigs.h
if !DISABLED_LEGACY_ENGINE
noinst_HEADERS += bitvector.h
noinst_HEADERS += indexmapbidi.h
endif
noinst_LTLIBRARIES = libtesseract_ccutil.la
libtesseract_ccutil_la_SOURCES = \
ambigs.cpp bitvector.cpp \
ambigs.cpp \
ccutil.cpp clst.cpp \
elst2.cpp elst.cpp errcode.cpp \
globaloc.cpp indexmapbidi.cpp \
globaloc.cpp \
mainblk.cpp \
serialis.cpp strngs.cpp scanutils.cpp \
tessdatamanager.cpp tprintf.cpp \
unichar.cpp unicharcompress.cpp unicharmap.cpp unicharset.cpp unicodes.cpp \
params.cpp universalambigs.cpp
if !DISABLED_LEGACY_ENGINE
libtesseract_ccutil_la_SOURCES += bitvector.cpp
libtesseract_ccutil_la_SOURCES += indexmapbidi.cpp
endif
AM_CPPFLAGS += $(libarchive_CFLAGS)

View File

@ -15,14 +15,12 @@ AM_CPPFLAGS += -DTESS_EXPORTS \
-fvisibility=hidden -fvisibility-inlines-hidden
endif
noinst_HEADERS = \
blobclass.h \
classify.h
noinst_HEADERS = classify.h
if !DISABLED_LEGACY_ENGINE
noinst_HEADERS += \
adaptive.h \
cluster.h \
noinst_HEADERS += adaptive.h
noinst_HEADERS += blobclass.h
noinst_HEADERS += cluster.h \
clusttool.h \
featdefs.h \
float2int.h \
@ -48,15 +46,13 @@ endif
noinst_LTLIBRARIES = libtesseract_classify.la
libtesseract_classify_la_SOURCES = \
blobclass.cpp \
classify.cpp
libtesseract_classify_la_SOURCES = classify.cpp
if !DISABLED_LEGACY_ENGINE
libtesseract_classify_la_SOURCES += \
adaptive.cpp \
adaptmatch.cpp \
cluster.cpp \
libtesseract_classify_la_SOURCES += adaptive.cpp
libtesseract_classify_la_SOURCES += adaptmatch.cpp
libtesseract_classify_la_SOURCES += blobclass.cpp
libtesseract_classify_la_SOURCES += cluster.cpp \
clusttool.cpp \
cutoffs.cpp \
featdefs.cpp \

View File

@ -23,11 +23,9 @@
#include <cstdio>
#include "classify.h"
#ifndef DISABLED_LEGACY_ENGINE
#include "featdefs.h"
#include "mf.h"
#include "normfeat.h"
#endif // ndef DISABLED_LEGACY_ENGINE
static const char kUnknownFontName[] = "UnknownFont";
@ -38,6 +36,7 @@ namespace tesseract {
/**----------------------------------------------------------------------------
Public Code
----------------------------------------------------------------------------**/
// Finds the name of the training font and returns it in fontname, by cutting
// it out based on the expectation that the filename is of the form:
// /path/to/dir/[lang].[fontname].exp[num]
@ -62,8 +61,6 @@ void ExtractFontName(const STRING& filename, STRING* fontname) {
/*---------------------------------------------------------------------------*/
#ifndef DISABLED_LEGACY_ENGINE
// Extracts features from the given blob and saves them in the tr_file_data_
// member variable.
// fontname: Name of font that this blob was printed in.
@ -111,6 +108,4 @@ bool Classify::WriteTRFile(const STRING& filename) {
return result;
}
#endif // ndef DISABLED_LEGACY_ENGINE
} // namespace tesseract.

View File

@ -7,14 +7,18 @@ AM_CPPFLAGS += -DTESS_EXPORTS \
-fvisibility=hidden -fvisibility-inlines-hidden
endif
noinst_HEADERS = \
bitvec.h callcpp.h \
emalloc.h \
oldlist.h
noinst_HEADERS = bitvec.h callcpp.h
if !DISABLED_LEGACY_ENGINE
noinst_HEADERS += emalloc.h
noinst_HEADERS += oldlist.h
endif
noinst_LTLIBRARIES = libtesseract_cutil.la
libtesseract_cutil_la_SOURCES = \
callcpp.cpp \
emalloc.cpp \
oldlist.cpp
libtesseract_cutil_la_SOURCES = callcpp.cpp
if !DISABLED_LEGACY_ENGINE
libtesseract_cutil_la_SOURCES += emalloc.cpp
libtesseract_cutil_la_SOURCES += oldlist.cpp
endif

View File

@ -17,5 +17,9 @@ noinst_LTLIBRARIES = libtesseract_dict.la
libtesseract_dict_la_SOURCES = \
context.cpp \
dawg.cpp dawg_cache.cpp dict.cpp hyphen.cpp \
dawg.cpp dawg_cache.cpp dict.cpp \
permdawg.cpp stopper.cpp trie.cpp
if !DISABLED_LEGACY_ENGINE
libtesseract_dict_la_SOURCES += hyphen.cpp
endif

View File

@ -23,7 +23,6 @@ noinst_HEADERS = \
ccnontextdetect.h cjkpitch.h colfind.h colpartition.h colpartitionset.h \
colpartitiongrid.h \
devanagari_processing.h drawtord.h edgblob.h edgloop.h \
equationdetectbase.h \
fpchop.h gap_map.h imagefind.h linefind.h makerow.h oldbasel.h \
pithsync.h pitsync1.h scanedg.h sortflts.h strokewidth.h \
tabfind.h tablefind.h tabvector.h \
@ -31,6 +30,10 @@ noinst_HEADERS = \
topitch.h tordmain.h tovars.h \
underlin.h wordseg.h workingpartset.h
if !DISABLED_LEGACY_ENGINE
noinst_HEADERS += equationdetectbase.h
endif
noinst_LTLIBRARIES = libtesseract_textord.la
libtesseract_textord_la_SOURCES = \
@ -38,10 +41,13 @@ libtesseract_textord_la_SOURCES = \
ccnontextdetect.cpp cjkpitch.cpp colfind.cpp colpartition.cpp colpartitionset.cpp \
colpartitiongrid.cpp devanagari_processing.cpp \
drawtord.cpp edgblob.cpp edgloop.cpp \
equationdetectbase.cpp \
fpchop.cpp gap_map.cpp imagefind.cpp linefind.cpp makerow.cpp oldbasel.cpp \
pithsync.cpp pitsync1.cpp scanedg.cpp sortflts.cpp strokewidth.cpp \
tabfind.cpp tablefind.cpp tabvector.cpp \
tablerecog.cpp textlineprojection.cpp textord.cpp \
topitch.cpp tordmain.cpp tospace.cpp tovars.cpp \
underlin.cpp wordseg.cpp workingpartset.cpp
if !DISABLED_LEGACY_ENGINE
libtesseract_textord_la_SOURCES += equationdetectbase.cpp
endif

View File

@ -119,7 +119,9 @@ check_PROGRAMS += baseapi_test
if TENSORFLOW
check_PROGRAMS += baseapi_thread_test
endif # TENSORFLOW
if !DISABLED_LEGACY_ENGINE
check_PROGRAMS += bitvector_test
endif # !DISABLED_LEGACY_ENGINE
endif # ENABLE_TRAINING
check_PROGRAMS += cleanapi_test
check_PROGRAMS += colpartition_test
@ -128,13 +130,17 @@ check_PROGRAMS += commandlineflags_test
check_PROGRAMS += dawg_test
endif # ENABLE_TRAINING
check_PROGRAMS += denorm_test
if !DISABLED_LEGACY_ENGINE
if TENSORFLOW
check_PROGRAMS += equationdetect_test
endif # TENSORFLOW
endif # !DISABLED_LEGACY_ENGINE
check_PROGRAMS += fileio_test
check_PROGRAMS += heap_test
check_PROGRAMS += imagedata_test
if !DISABLED_LEGACY_ENGINE
check_PROGRAMS += indexmapbidi_test
endif # !DISABLED_LEGACY_ENGINE
check_PROGRAMS += intfeaturemap_test
check_PROGRAMS += intsimdmatrix_test
check_PROGRAMS += lang_model_test