automake: Flat build for src/api

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-11-26 10:57:28 +01:00
parent 9ed3887432
commit cafb1bbfd7
5 changed files with 133 additions and 129 deletions

View File

@ -22,7 +22,7 @@ endif
SUBDIRS = src/arch src/ccutil src/viewer src/cutil src/opencl src/ccstruct
SUBDIRS += src/dict src/classify src/wordrec src/textord src/lstm
SUBDIRS += src/ccmain src/api . tessdata doc unittest
SUBDIRS += src/ccmain . tessdata doc unittest
EXTRA_DIST = README.md LICENSE
EXTRA_DIST += aclocal.m4 config configure.ac autogen.sh
@ -84,6 +84,122 @@ pkginclude_HEADERS += include/tesseract/strngs.h
pkginclude_HEADERS += include/tesseract/thresholder.h
pkginclude_HEADERS += include/tesseract/unichar.h
# Rules for all subdirectories.
AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\"
AM_CPPFLAGS += -I$(top_builddir)/include
AM_CPPFLAGS += -I$(top_srcdir)/include
if DISABLED_LEGACY_ENGINE
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
endif
if VISIBILITY
AM_CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
endif
AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
# Rules for src/api.
libtesseract_api_la_CPPFLAGS = $(AM_CPPFLAGS)
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/arch
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/ccmain
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/ccstruct
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/ccutil
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/classify
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/cutil
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/dict
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/opencl
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/textord
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/viewer
libtesseract_api_la_CPPFLAGS += -I$(top_srcdir)/src/wordrec
if VISIBILITY
libtesseract_api_la_CPPFLAGS += -DTESS_EXPORTS
endif
if HAVE_LIBCURL
libtesseract_api_la_CPPFLAGS += $(libcurl_CFLAGS) -DHAVE_LIBCURL
endif
noinst_LTLIBRARIES = libtesseract_api.la
libtesseract_api_la_SOURCES = src/api/baseapi.cpp
libtesseract_api_la_SOURCES += src/api/altorenderer.cpp
libtesseract_api_la_SOURCES += src/api/capi.cpp
libtesseract_api_la_SOURCES += src/api/hocrrenderer.cpp
libtesseract_api_la_SOURCES += src/api/lstmboxrenderer.cpp
libtesseract_api_la_SOURCES += src/api/pdfrenderer.cpp
libtesseract_api_la_SOURCES += src/api/renderer.cpp
libtesseract_api_la_SOURCES += src/api/wordstrboxrenderer.cpp
lib_LTLIBRARIES = libtesseract.la
libtesseract_la_LDFLAGS = $(LEPTONICA_LIBS) $(OPENCL_LDFLAGS) $(libarchive_LIBS)
libtesseract_la_LDFLAGS += $(libcurl_LIBS)
libtesseract_la_LDFLAGS += $(TENSORFLOW_LIBS)
libtesseract_la_SOURCES =
# Dummy C++ source to cause C++ linking.
# see http://www.gnu.org/s/hello/manual/automake/Libtool-Convenience-Libraries.html#Libtool-Convenience-Libraries
nodist_EXTRA_libtesseract_la_SOURCES = dummy.cxx
libtesseract_la_LIBADD = \
libtesseract_api.la \
src/ccmain/libtesseract_main.la \
src/textord/libtesseract_textord.la \
src/wordrec/libtesseract_wordrec.la \
src/classify/libtesseract_classify.la \
src/dict/libtesseract_dict.la \
src/arch/libtesseract_arch.la \
src/arch/libtesseract_native.la \
src/lstm/libtesseract_lstm.la \
src/ccstruct/libtesseract_ccstruct.la \
src/cutil/libtesseract_cutil.la \
src/viewer/libtesseract_viewer.la \
src/ccutil/libtesseract_ccutil.la \
src/opencl/libtesseract_opencl.la
if AVX_OPT
libtesseract_la_LIBADD += src/arch/libtesseract_avx.la
endif
if AVX2_OPT
libtesseract_la_LIBADD += src/arch/libtesseract_avx2.la
endif
if FMA_OPT
libtesseract_la_LIBADD += src/arch/libtesseract_fma.la
endif
if SSE41_OPT
libtesseract_la_LIBADD += src/arch/libtesseract_sse.la
endif
libtesseract_la_LDFLAGS += -version-info $(GENERIC_LIBRARY_VERSION) $(NOUNDEFINED)
bin_PROGRAMS = tesseract
tesseract_SOURCES = src/api/tesseractmain.cpp
tesseract_CPPFLAGS =
tesseract_CPPFLAGS += -I$(top_srcdir)/src/arch
tesseract_CPPFLAGS += -I$(top_srcdir)/src/ccstruct
tesseract_CPPFLAGS += -I$(top_srcdir)/src/ccutil
tesseract_CPPFLAGS += -I$(top_srcdir)/src/dict
tesseract_CPPFLAGS += -I$(top_srcdir)/src/viewer
tesseract_CPPFLAGS += $(AM_CPPFLAGS)
if VISIBILITY
tesseract_CPPFLAGS += -DTESS_IMPORTS
endif
tesseract_LDADD = libtesseract.la
tesseract_LDFLAGS = $(OPENCL_LDFLAGS)
tesseract_LDADD += $(LEPTONICA_LIBS)
tesseract_LDADD += $(OPENMP_CXXFLAGS)
tesseract_LDADD += $(TENSORFLOW_LIBS)
tesseract_LDADD += $(libarchive_LIBS)
tesseract_LDADD += $(libcurl_LIBS)
if T_WIN
tesseract_LDADD += -ltiff
tesseract_LDADD += -lws2_32
libtesseract_la_LDFLAGS += -no-undefined -Wl,--as-needed -lws2_32
endif
if ADD_RT
tesseract_LDADD += -lrt
endif
# fuzzer-api is used for fuzzing tests.
# They are run by OSS-Fuzz https://oss-fuzz.com/, but can also be run locally.
# Note: -fsanitize=fuzzer currently requires the clang++ compiler.

View File

@ -488,7 +488,6 @@ fi
# Output files
AC_CONFIG_FILES([include/tesseract/version.h])
AC_CONFIG_FILES([Makefile tesseract.pc])
AC_CONFIG_FILES([src/api/Makefile])
AC_CONFIG_FILES([src/arch/Makefile])
AC_CONFIG_FILES([src/ccmain/Makefile])
AC_CONFIG_FILES([src/opencl/Makefile])

View File

@ -1,110 +0,0 @@
AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\" \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/arch \
-I$(top_srcdir)/src/lstm \
-I$(top_srcdir)/src/ccutil \
-I$(top_srcdir)/src/ccstruct \
-I$(top_srcdir)/src/viewer \
-I$(top_srcdir)/src/textord \
-I$(top_srcdir)/src/dict \
-I$(top_srcdir)/src/classify \
-I$(top_srcdir)/src/ccmain \
-I$(top_srcdir)/src/wordrec \
-I$(top_srcdir)/src/cutil \
-I$(top_srcdir)/src/opencl
AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
if DISABLED_LEGACY_ENGINE
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
endif
if VISIBILITY
AM_CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
endif
lib_LTLIBRARIES =
noinst_LTLIBRARIES = libtesseract_api.la
libtesseract_api_la_CPPFLAGS = $(AM_CPPFLAGS)
if VISIBILITY
libtesseract_api_la_CPPFLAGS += -DTESS_EXPORTS
endif
if HAVE_LIBCURL
libtesseract_api_la_CPPFLAGS += $(libcurl_CFLAGS) -DHAVE_LIBCURL
endif
libtesseract_api_la_SOURCES = baseapi.cpp capi.cpp
libtesseract_api_la_SOURCES += altorenderer.cpp
libtesseract_api_la_SOURCES += hocrrenderer.cpp
libtesseract_api_la_SOURCES += lstmboxrenderer.cpp
libtesseract_api_la_SOURCES += pdfrenderer.cpp
libtesseract_api_la_SOURCES += wordstrboxrenderer.cpp
libtesseract_api_la_SOURCES += renderer.cpp
lib_LTLIBRARIES += libtesseract.la
libtesseract_la_LDFLAGS = $(LEPTONICA_LIBS) $(OPENCL_LDFLAGS) $(libarchive_LIBS)
libtesseract_la_LDFLAGS += $(libcurl_LIBS)
libtesseract_la_LDFLAGS += $(TENSORFLOW_LIBS)
libtesseract_la_SOURCES =
# Dummy C++ source to cause C++ linking.
# see http://www.gnu.org/s/hello/manual/automake/Libtool-Convenience-Libraries.html#Libtool-Convenience-Libraries
nodist_EXTRA_libtesseract_la_SOURCES = dummy.cxx
libtesseract_la_LIBADD = \
libtesseract_api.la \
../ccmain/libtesseract_main.la \
../textord/libtesseract_textord.la \
../wordrec/libtesseract_wordrec.la \
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../arch/libtesseract_arch.la \
../arch/libtesseract_native.la \
../lstm/libtesseract_lstm.la \
../ccstruct/libtesseract_ccstruct.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccutil/libtesseract_ccutil.la \
../opencl/libtesseract_opencl.la
if AVX_OPT
libtesseract_la_LIBADD += ../arch/libtesseract_avx.la
endif
if AVX2_OPT
libtesseract_la_LIBADD += ../arch/libtesseract_avx2.la
endif
if FMA_OPT
libtesseract_la_LIBADD += ../arch/libtesseract_fma.la
endif
if SSE41_OPT
libtesseract_la_LIBADD += ../arch/libtesseract_sse.la
endif
libtesseract_la_LDFLAGS += -version-info $(GENERIC_LIBRARY_VERSION) $(NOUNDEFINED)
bin_PROGRAMS = tesseract
tesseract_SOURCES = tesseractmain.cpp
tesseract_CPPFLAGS = $(AM_CPPFLAGS)
if VISIBILITY
tesseract_CPPFLAGS += -DTESS_IMPORTS
endif
tesseract_LDADD = libtesseract.la
tesseract_LDFLAGS = $(OPENCL_LDFLAGS)
tesseract_LDADD += $(LEPTONICA_LIBS)
tesseract_LDADD += $(OPENMP_CXXFLAGS)
tesseract_LDADD += $(TENSORFLOW_LIBS)
tesseract_LDADD += $(libarchive_LIBS)
tesseract_LDADD += $(libcurl_LIBS)
if T_WIN
tesseract_LDADD += -ltiff
tesseract_LDADD += -lws2_32
libtesseract_la_LDFLAGS += -no-undefined -Wl,--as-needed -lws2_32
endif
if ADD_RT
tesseract_LDADD += -lrt
endif

View File

@ -71,7 +71,6 @@ noinst_LTLIBRARIES = libtesseract_training.la libtesseract_tessopt.la
libtesseract_training_la_LIBADD = \
../cutil/libtesseract_cutil.la
# ../api/libtesseract.la
libtesseract_training_la_SOURCES = \
boxchar.cpp \
@ -137,7 +136,7 @@ ambiguous_words_LDADD = \
libtesseract_training.la \
libtesseract_tessopt.la
ambiguous_words_LDADD += \
../api/libtesseract.la
../../libtesseract.la
classifier_tester_SOURCES = classifier_tester.cpp
#classifier_tester_LDFLAGS = -static
@ -145,7 +144,7 @@ classifier_tester_LDADD = \
libtesseract_training.la \
libtesseract_tessopt.la
classifier_tester_LDADD += \
../api/libtesseract.la
../../libtesseract.la
cntraining_SOURCES = cntraining.cpp
#cntraining_LDFLAGS = -static
@ -153,7 +152,7 @@ cntraining_LDADD = \
libtesseract_training.la \
libtesseract_tessopt.la
cntraining_LDADD += \
../api/libtesseract.la
../../libtesseract.la
mftraining_SOURCES = mftraining.cpp mergenf.cpp
#mftraining_LDFLAGS = -static
@ -162,7 +161,7 @@ mftraining_LDADD = \
libtesseract_tessopt.la \
$(ICU_UC_LIBS)
mftraining_LDADD += \
../api/libtesseract.la
../../libtesseract.la
shapeclustering_SOURCES = shapeclustering.cpp
#shapeclustering_LDFLAGS = -static
@ -170,7 +169,7 @@ shapeclustering_LDADD = \
libtesseract_training.la \
libtesseract_tessopt.la
shapeclustering_LDADD += \
../api/libtesseract.la
../../libtesseract.la
endif
combine_lang_model_SOURCES = combine_lang_model.cpp
@ -180,19 +179,19 @@ combine_lang_model_LDADD = \
libtesseract_tessopt.la \
$(ICU_I18N_LIBS) $(ICU_UC_LIBS)
combine_lang_model_LDADD += \
../api/libtesseract.la
../../libtesseract.la
combine_tessdata_SOURCES = combine_tessdata.cpp
#combine_tessdata_LDFLAGS = -static
combine_tessdata_LDADD = \
../api/libtesseract.la
../../libtesseract.la
dawg2wordlist_SOURCES = dawg2wordlist.cpp
#dawg2wordlist_LDFLAGS = -static
dawg2wordlist_LDADD = \
libtesseract_tessopt.la
dawg2wordlist_LDADD += \
../api/libtesseract.la
../../libtesseract.la
lstmeval_SOURCES = lstmeval.cpp
#lstmeval_LDFLAGS = -static
@ -201,7 +200,7 @@ lstmeval_LDADD = \
libtesseract_tessopt.la \
$(ICU_UC_LIBS)
lstmeval_LDADD += \
../api/libtesseract.la
../../libtesseract.la
lstmtraining_SOURCES = lstmtraining.cpp
#lstmtraining_LDFLAGS = -static
@ -210,14 +209,14 @@ lstmtraining_LDADD = \
libtesseract_tessopt.la \
$(ICU_I18N_LIBS) $(ICU_UC_LIBS)
lstmtraining_LDADD += \
../api/libtesseract.la
../../libtesseract.la
merge_unicharsets_SOURCES = merge_unicharsets.cpp
#merge_unicharsets_LDFLAGS = -static
merge_unicharsets_LDADD = \
libtesseract_tessopt.la
merge_unicharsets_LDADD += \
../api/libtesseract.la
../../libtesseract.la
set_unicharset_properties_SOURCES = set_unicharset_properties.cpp
set_unicharset_properties_LDADD = \
@ -225,7 +224,7 @@ set_unicharset_properties_LDADD = \
libtesseract_tessopt.la \
$(ICU_I18N_LIBS) $(ICU_UC_LIBS)
set_unicharset_properties_LDADD += \
../api/libtesseract.la
../../libtesseract.la
text2image_SOURCES = text2image.cpp
#text2image_LDFLAGS = -static
@ -234,7 +233,7 @@ text2image_LDADD = \
libtesseract_tessopt.la \
$(ICU_I18N_LIBS) $(ICU_UC_LIBS)
text2image_LDADD += \
../api/libtesseract.la
../../libtesseract.la
text2image_LDADD += $(ICU_UC_LIBS) -lpango-1.0 -lpangocairo-1.0
text2image_LDADD += -lgobject-2.0 -lglib-2.0 -lcairo -lpangoft2-1.0 -lfontconfig
@ -245,14 +244,14 @@ unicharset_extractor_LDADD = \
libtesseract_tessopt.la \
$(ICU_I18N_LIBS) $(ICU_UC_LIBS)
unicharset_extractor_LDADD += \
../api/libtesseract.la
../../libtesseract.la
wordlist2dawg_SOURCES = wordlist2dawg.cpp
#wordlist2dawg_LDFLAGS = -static
wordlist2dawg_LDADD = \
libtesseract_tessopt.la
wordlist2dawg_LDADD += \
../api/libtesseract.la
../../libtesseract.la
if T_WIN
if !DISABLED_LEGACY_ENGINE

View File

@ -104,7 +104,7 @@ ABSEIL_LIBS = libabseil.la
GTEST_LIBS = libgtest.la libgtest_main.la -lpthread
GMOCK_LIBS = libgmock.la libgmock_main.la
TESS_LIBS = $(GTEST_LIBS)
TESS_LIBS += $(top_builddir)/src/api/libtesseract.la $(libarchive_LIBS)
TESS_LIBS += $(top_builddir)/libtesseract.la $(libarchive_LIBS)
TESS_LIBS += $(TENSORFLOW_LIBS)
TRAINING_LIBS = $(top_builddir)/src/training/libtesseract_training.la
TRAINING_LIBS += $(top_builddir)/src/training/libtesseract_tessopt.la