Skip to content

Commit

Permalink
Merge pull request #1744 from stweil/fix
Browse files Browse the repository at this point in the history
 Fix build with legacy engine disabled
  • Loading branch information
zdenop authored Jul 4, 2018
2 parents 20e53b1 + 60fcff5 commit d1e0a4b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
3 changes: 0 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ AC_ARG_ENABLE([legacy],
[enable_legacy=$enableval],
[enable_legacy="yes"])
AC_MSG_RESULT([$enable_legacy])
if test "$enable_legacy" = "no"; then
AC_DEFINE([DISABLED_LEGACY_ENGINE], [], [Disable the legacy OCR engine])
fi
AM_CONDITIONAL([DISABLED_LEGACY_ENGINE], test "$enable_legacy" = "no")

# check whether to build embedded version
Expand Down
4 changes: 4 additions & 0 deletions src/api/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\" \

AM_CPPFLAGS += $(OPENCL_CPPFLAGS)

if DISABLED_LEGACY_ENGINE
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
endif

if VISIBILITY
AM_CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
endif
Expand Down
8 changes: 6 additions & 2 deletions src/api/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,12 @@ TESS_API char** TESS_CALL TessBaseAPIGetAvailableLanguagesAsVector(const TessBas
return arr;
}

#ifndef DISABLED_LEGACY_ENGINE
TESS_API int TESS_CALL TessBaseAPIInitLangMod(TessBaseAPI* handle, const char* datapath, const char* language)
{
return handle->InitLangMod(datapath, language);
}
#endif

TESS_API void TESS_CALL TessBaseAPIInitForAnalysePage(TessBaseAPI* handle)
{
Expand Down Expand Up @@ -336,10 +338,12 @@ TESS_API char* TESS_CALL TessBaseAPIRect(TessBaseAPI* handle, const unsigned cha
return handle->TesseractRect(imagedata, bytes_per_pixel, bytes_per_line, left, top, width, height);
}

#ifndef DISABLED_LEGACY_ENGINE
TESS_API void TESS_CALL TessBaseAPIClearAdaptiveClassifier(TessBaseAPI* handle)
{
handle->ClearAdaptiveClassifier();
}
#endif

TESS_API void TESS_CALL TessBaseAPISetImage(TessBaseAPI* handle, const unsigned char* imagedata, int width, int height,
int bytes_per_pixel, int bytes_per_line)
Expand Down Expand Up @@ -543,6 +547,8 @@ TESS_API BOOL TESS_CALL TessBaseAPIDetectOS(TessBaseAPI* handle, OSResults* resu
return FALSE; // Unsafe ABI, return FALSE always
}

#ifndef DISABLED_LEGACY_ENGINE

TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(TessBaseAPI* handle,
int* orient_deg, float* orient_conf, const char** script_name, float* script_conf)
{
Expand All @@ -551,8 +557,6 @@ TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(TessBaseAPI* handle,
return (BOOL)success;
}

#ifndef DISABLED_LEGACY_ENGINE

TESS_API void TESS_CALL TessBaseAPIGetFeaturesForBlob(TessBaseAPI* handle, TBLOB* blob, INT_FEATURE_STRUCT* int_features,
int* num_features, int* FeatureOutlineIndex)
{
Expand Down
4 changes: 4 additions & 0 deletions src/ccmain/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ AM_CPPFLAGS += \
AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
AM_CPPFLAGS += $(OPENMP_CXXFLAGS)

if DISABLED_LEGACY_ENGINE
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
endif

if VISIBILITY
AM_CPPFLAGS += -DTESS_EXPORTS \
-fvisibility=hidden -fvisibility-inlines-hidden
Expand Down
4 changes: 4 additions & 0 deletions src/classify/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ AM_CPPFLAGS += \
-I$(top_srcdir)/src/dict \
-I$(top_srcdir)/src/viewer

if DISABLED_LEGACY_ENGINE
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
endif

if VISIBILITY
AM_CPPFLAGS += -DTESS_EXPORTS \
-fvisibility=hidden -fvisibility-inlines-hidden
Expand Down
4 changes: 4 additions & 0 deletions src/training/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ AM_CPPFLAGS += \

EXTRA_DIST = language-specific.sh tesstrain.sh tesstrain_utils.sh

if DISABLED_LEGACY_ENGINE
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
endif

# TODO: training programs can not be linked to shared library created
# with -fvisibility
if VISIBILITY
Expand Down
4 changes: 4 additions & 0 deletions src/wordrec/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ AM_CPPFLAGS += \
-I$(top_srcdir)/src/dict \
-I$(top_srcdir)/src/viewer

if DISABLED_LEGACY_ENGINE
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
endif

if VISIBILITY
AM_CPPFLAGS += -DTESS_EXPORTS \
-fvisibility=hidden -fvisibility-inlines-hidden
Expand Down

0 comments on commit d1e0a4b

Please sign in to comment.