From bf0a83907b51ff79b7c06bb4c0123d115f646dcd Mon Sep 17 00:00:00 2001 From: "rajesh.katikam@gmail.com" Date: Tue, 12 Nov 2013 10:40:40 +0000 Subject: [PATCH] Cleaned up configure.ac and Makefile.am in multiple folder to use OPENCL paths git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@910 d0cd1f9f-072b-0410-8dd7-cf729c803f20 --- Makefile.am | 2 +- api/Makefile.am | 14 ++++++++++---- ccmain/Makefile.am | 8 +++++--- ccstruct/Makefile.am | 8 ++++++-- configure.ac | 20 +++++++++++++++++--- opencl/Makefile.am | 8 +++++++- textord/Makefile.am | 8 ++++++-- 7 files changed, 52 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index 69913783c9..fca38a3ef3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,7 +14,7 @@ endif .PHONY: install-langs ScrollView.jar install-jars $(TRAINING_SUBDIR) -SUBDIRS = ccutil viewer cutil image ccstruct dict classify wordrec neural_networks/runtime textord cube ccmain api . tessdata +SUBDIRS = ccutil viewer cutil image opencl ccstruct dict classify wordrec neural_networks/runtime textord cube ccmain api . tessdata EXTRA_DIST = eurotext.tif phototest.tif ReleaseNotes \ aclocal.m4 config configure.ac autogen.sh tesseract.spec contrib \ diff --git a/api/Makefile.am b/api/Makefile.am index 798402f246..1bf593c62f 100644 --- a/api/Makefile.am +++ b/api/Makefile.am @@ -4,7 +4,10 @@ AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\"\ -I$(top_srcdir)/textord -I$(top_srcdir)/dict \ -I$(top_srcdir)/classify -I$(top_srcdir)/ccmain \ -I$(top_srcdir)/wordrec -I$(top_srcdir)/cutil \ - #-I$(top_srcdir)/opencl + -I$(top_srcdir)/opencl +if USE_OPENCL +AM_CPPFLAGS += -I$(OPENCL_HDR_PATH) +endif if VISIBILITY AM_CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden endif @@ -30,7 +33,8 @@ libtesseract_api_la_LIBADD = \ ../cutil/libtesseract_cutil.la \ ../viewer/libtesseract_viewer.la \ ../ccutil/libtesseract_ccutil.la \ - #../opencl/libtesseract_opencl.la + ../opencl/libtesseract_opencl.la + endif libtesseract_api_la_CPPFLAGS = $(AM_CPPFLAGS) if VISIBILITY @@ -58,7 +62,7 @@ libtesseract_la_LIBADD = \ ../cutil/libtesseract_cutil.la \ ../viewer/libtesseract_viewer.la \ ../ccutil/libtesseract_ccutil.la \ - #../opencl/libtesseract_opencl.la + ../opencl/libtesseract_opencl.la libtesseract_la_LDFLAGS += -version-info $(GENERIC_LIBRARY_VERSION) @@ -66,7 +70,9 @@ bin_PROGRAMS = tesseract tesseract_SOURCES = $(top_srcdir)/api/tesseractmain.cpp tesseract_LDADD = libtesseract.la tesseract_CPPFLAGS = $(AM_CPPFLAGS) - +if USE_OPENCL +tesseract_LDADD += $(OPENCL_LIB) +endif if MINGW tesseract_LDADD += -lws2_32 libtesseract_la_LDFLAGS += -no-undefined -Wl,--as-needed -lws2_32 diff --git a/ccmain/Makefile.am b/ccmain/Makefile.am index 937bd67d3a..e958e4cc09 100644 --- a/ccmain/Makefile.am +++ b/ccmain/Makefile.am @@ -5,8 +5,10 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/classify -I$(top_srcdir)/dict \ -I$(top_srcdir)/wordrec -I$(top_srcdir)/cutil \ -I$(top_srcdir)/neural_networks/runtime -I$(top_srcdir)/cube \ - -I$(top_srcdir)/textord - + -I$(top_srcdir)/textord -I$(top_srcdir)/opencl +if USE_OPENCL +AM_CPPFLAGS += -I$(OPENCL_HDR_PATH) +endif if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ -fvisibility=hidden -fvisibility-inlines-hidden @@ -37,7 +39,7 @@ libtesseract_main_la_LIBADD = \ ../classify/libtesseract_classify.la \ ../cutil/libtesseract_cutil.la \ ../cube/libtesseract_cube.la \ - #../opencl/libtesseract_opencl.la + ../opencl/libtesseract_opencl.la endif diff --git a/ccstruct/Makefile.am b/ccstruct/Makefile.am index e3d8a040bd..4447ff4fe8 100644 --- a/ccstruct/Makefile.am +++ b/ccstruct/Makefile.am @@ -1,6 +1,10 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/ccutil -I$(top_srcdir)/cutil \ - -I$(top_srcdir)/image -I$(top_srcdir)/viewer + -I$(top_srcdir)/image -I$(top_srcdir)/viewer \ + -I$(top_srcdir)/opencl +if USE_OPENCL +AM_CPPFLAGS += -I$(OPENCL_HDR_PATH) +endif if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ @@ -28,7 +32,7 @@ libtesseract_ccstruct_la_LIBADD = \ ../cutil/libtesseract_cutil.la \ ../image/libtesseract_image.la \ ../viewer/libtesseract_viewer.la \ - #../opencl/libtesseract_opencl.la + ../opencl/libtesseract_opencl.la endif libtesseract_ccstruct_la_SOURCES = \ diff --git a/configure.ac b/configure.ac index 7cd9929969..13ddf9f891 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,8 @@ AC_SUBST(GENERIC_VERSION) AM_CONDITIONAL(MINGW, false) AM_CONDITIONAL(GRAPHICS_DISABLED, false) +OPENCL_HDR_PATH="" +OPENCL_LIB="" ############################# # # Platform specific setup @@ -121,6 +123,20 @@ if test "$enable_embedded" = "yes"; then AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED]) fi +# check whether to build opencl version +AC_MSG_CHECKING(--enable-opencl argument) +AC_ARG_ENABLE([opencl], + [ --enable-opencl enable opencl build (default=no)], + [enable_opencl=$enableval], + [enable_opencl="no"]) +AC_MSG_RESULT($enable_opencl) +AM_CONDITIONAL([USE_OPENCL], [test "$enable_opencl" = "yes"]) +if test "$enable_opencl" = "yes"; then + AC_SUBST([AM_CPPFLAGS], [-DUSE_OPENCL]) + AC_SUBST([OPENCL_HDR_PATH],["/opt/AMDAPP/include"]) + AC_SUBST([OPENCL_LIB],["-lOpenCL"]) +fi + # check whether to build tesseract with -fvisibility=hidden -fvisibility-inlines-hidden # http://gcc.gnu.org/wiki/Visibility # http://groups.google.com/group/tesseract-dev/browse_thread/thread/976645ae98189127 @@ -336,13 +352,11 @@ AM_CONDITIONAL(ENABLE_TRAINING, $have_icu) # Final Tasks and Output # ---------------------------------------- -#CPPFLAGS="$CPPFLAGS -DUSE_OPENCL -I/opt/AMDAPP/include -I../opencl" -#LIBS="$LIBS -lOpenCL" # Output files AC_CONFIG_FILES([Makefile tesseract.pc]) AC_CONFIG_FILES(api/Makefile) AC_CONFIG_FILES(ccmain/Makefile) -#AC_CONFIG_FILES(opencl/Makefile) +AC_CONFIG_FILES(opencl/Makefile) AC_CONFIG_FILES(ccstruct/Makefile) AC_CONFIG_FILES(ccutil/Makefile) AC_CONFIG_FILES(classify/Makefile) diff --git a/opencl/Makefile.am b/opencl/Makefile.am index 7a52e16b80..b4ea562f12 100644 --- a/opencl/Makefile.am +++ b/opencl/Makefile.am @@ -1,4 +1,7 @@ -AM_CPPFLAGS += -I$(top_srcdir)/ccutil -I$(top_srcdir)/ccstruct -I$(top_srcdir)/ccmain +AM_CPPFLAGS += -I$(top_srcdir)/ccutil -I$(top_srcdir)/ccstruct -I$(top_srcdir)/ccmain +if USE_OPENCL +AM_CPPFLAGS += -I$(OPENCL_HDR_PATH) +endif noinst_HEADERS = \ openclwrapper.h oclkernels.h opencl_device_selection.h @@ -10,6 +13,9 @@ libtesseract_opencl_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) libtesseract_opencl_la_LIBADD = \ ../ccutil/libtesseract_ccutil.la \ ../viewer/libtesseract_viewer.la +if USE_OPENCL +libtesseract_opencl_la_LDFLAGS += $(OPENCL_LIB) +endif endif libtesseract_opencl_la_SOURCES = \ diff --git a/textord/Makefile.am b/textord/Makefile.am index 44e39c93e6..b1b11af6a8 100644 --- a/textord/Makefile.am +++ b/textord/Makefile.am @@ -3,7 +3,11 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/image -I$(top_srcdir)/viewer \ -I$(top_srcdir)/ccmain -I$(top_srcdir)/wordrec -I$(top_srcdir)/api \ - -I$(top_srcdir)/cutil -I$(top_srcdir)/classify -I$(top_srcdir)/dict + -I$(top_srcdir)/cutil -I$(top_srcdir)/classify -I$(top_srcdir)/dict \ + -I$(top_srcdir)/opencl +if USE_OPENCL +AM_CPPFLAGS += -I$(OPENCL_HDR_PATH) +endif if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ @@ -38,7 +42,7 @@ libtesseract_textord_la_LIBADD = \ ../cutil/libtesseract_cutil.la \ ../classify/libtesseract_classify.la \ ../dict/libtesseract_dict.la \ - #../opencl/libtesseract_opencl.la + ../opencl/libtesseract_opencl.la endif libtesseract_textord_la_SOURCES = \