mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-07 09:52:40 +08:00
Get OpenCL to compile on OS X
However, the output of the OpenCL build is garbage....
This commit is contained in:
parent
8d5abff34a
commit
7b85eeafe2
5
.gitignore
vendored
5
.gitignore
vendored
@ -64,3 +64,8 @@ training/wordlist2dawg
|
|||||||
*.cube.*
|
*.cube.*
|
||||||
*.tesseract_cube.*
|
*.tesseract_cube.*
|
||||||
*.traineddata
|
*.traineddata
|
||||||
|
|
||||||
|
# OpenCL
|
||||||
|
tesseract_opencl_profile_devices.dat
|
||||||
|
kernel*.bin
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\"\
|
|||||||
-I$(top_srcdir)/classify -I$(top_srcdir)/ccmain \
|
-I$(top_srcdir)/classify -I$(top_srcdir)/ccmain \
|
||||||
-I$(top_srcdir)/wordrec -I$(top_srcdir)/cutil \
|
-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)
|
AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
|
||||||
endif
|
|
||||||
if VISIBILITY
|
if VISIBILITY
|
||||||
AM_CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
AM_CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||||
endif
|
endif
|
||||||
@ -78,9 +78,9 @@ endif
|
|||||||
|
|
||||||
tesseract_LDADD = libtesseract.la
|
tesseract_LDADD = libtesseract.la
|
||||||
|
|
||||||
if USE_OPENCL
|
|
||||||
tesseract_LDADD += $(OPENCL_LIB)
|
tesseract_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
endif
|
|
||||||
if OPENMP
|
if OPENMP
|
||||||
tesseract_LDADD += $(OPENMP_CFLAGS)
|
tesseract_LDADD += $(OPENMP_CFLAGS)
|
||||||
endif
|
endif
|
||||||
|
@ -5,9 +5,9 @@ AM_CPPFLAGS += \
|
|||||||
-I$(top_srcdir)/classify -I$(top_srcdir)/dict \
|
-I$(top_srcdir)/classify -I$(top_srcdir)/dict \
|
||||||
-I$(top_srcdir)/wordrec -I$(top_srcdir)/cutil \
|
-I$(top_srcdir)/wordrec -I$(top_srcdir)/cutil \
|
||||||
-I$(top_srcdir)/textord -I$(top_srcdir)/opencl
|
-I$(top_srcdir)/textord -I$(top_srcdir)/opencl
|
||||||
if USE_OPENCL
|
|
||||||
AM_CPPFLAGS += -I$(OPENCL_HDR_PATH)
|
AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
|
||||||
endif
|
|
||||||
if VISIBILITY
|
if VISIBILITY
|
||||||
AM_CPPFLAGS += -DTESS_EXPORTS \
|
AM_CPPFLAGS += -DTESS_EXPORTS \
|
||||||
-fvisibility=hidden -fvisibility-inlines-hidden
|
-fvisibility=hidden -fvisibility-inlines-hidden
|
||||||
|
@ -2,9 +2,7 @@ AM_CPPFLAGS += \
|
|||||||
-I$(top_srcdir)/ccutil -I$(top_srcdir)/cutil \
|
-I$(top_srcdir)/ccutil -I$(top_srcdir)/cutil \
|
||||||
-I$(top_srcdir)/viewer \
|
-I$(top_srcdir)/viewer \
|
||||||
-I$(top_srcdir)/opencl
|
-I$(top_srcdir)/opencl
|
||||||
if USE_OPENCL
|
AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
|
||||||
AM_CPPFLAGS += -I$(OPENCL_HDR_PATH)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if VISIBILITY
|
if VISIBILITY
|
||||||
AM_CPPFLAGS += -DTESS_EXPORTS \
|
AM_CPPFLAGS += -DTESS_EXPORTS \
|
||||||
|
40
configure.ac
40
configure.ac
@ -99,7 +99,7 @@ case "${host_os}" in
|
|||||||
AM_CONDITIONAL(ADD_RT, true)
|
AM_CONDITIONAL(ADD_RT, true)
|
||||||
;;
|
;;
|
||||||
*darwin*)
|
*darwin*)
|
||||||
OPENCL_LIBS="-framework OpenCL"
|
OPENCL_LIBS=""
|
||||||
OPENCL_INC=""
|
OPENCL_INC=""
|
||||||
AM_CONDITIONAL(ADD_RT, false)
|
AM_CONDITIONAL(ADD_RT, false)
|
||||||
;;
|
;;
|
||||||
@ -212,6 +212,8 @@ m4_define([MY_CHECK_FRAMEWORK],
|
|||||||
)
|
)
|
||||||
|
|
||||||
have_opencl_lib=false
|
have_opencl_lib=false
|
||||||
|
OPENCL_CPPFLAGS=''
|
||||||
|
OPENCL_LDFLAGS=''
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
*darwin* | *-macos10*)
|
*darwin* | *-macos10*)
|
||||||
echo "checking for OpenCL framework"
|
echo "checking for OpenCL framework"
|
||||||
@ -219,30 +221,32 @@ case "${host_os}" in
|
|||||||
if test $my_cv_framework_OpenCL = yes; then
|
if test $my_cv_framework_OpenCL = yes; then
|
||||||
have_opencl_lib=true
|
have_opencl_lib=true
|
||||||
fi
|
fi
|
||||||
AC_SUBST(OPENCL_OSX, [yes])
|
AC_SUBST([AM_CPPFLAGS], [-DUSE_OPENCL])
|
||||||
|
OPENCL_CPPFLAGS=""
|
||||||
|
OPENCL_LDFLAGS="-framework OpenCL"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# default
|
# default
|
||||||
AC_CHECK_LIB(OpenCL, clGetPlatformIDs, have_opencl_lib=true, have_opencl_lib=false)
|
AC_CHECK_LIB(OpenCL, clGetPlatformIDs, have_opencl_lib=true, have_opencl_lib=false)
|
||||||
AC_SUBST(OPENCL_OSX, [no])
|
if test "$enable_opencl" = "yes"; then
|
||||||
|
if !($have_opencl); then
|
||||||
|
AC_MSG_ERROR(Required OpenCL headers not found!)
|
||||||
|
fi
|
||||||
|
if !($have_opencl_lib); then
|
||||||
|
AC_MSG_ERROR(Required OpenCL library not found!)
|
||||||
|
fi
|
||||||
|
if !($have_tiff); then
|
||||||
|
AC_MSG_ERROR(Required TIFF headers not found! Try to install libtiff-dev?? package.)
|
||||||
|
fi
|
||||||
|
AC_SUBST([AM_CPPFLAGS], [-DUSE_OPENCL])
|
||||||
|
OPENCL_CPPFLAGS="-I${OPENCL_INC}"
|
||||||
|
OPENCL_LDFLAGS="-l${OPENCL_LIBS}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test "$enable_opencl" = "yes"; then
|
|
||||||
if !($have_opencl); then
|
|
||||||
AC_MSG_ERROR(Required OpenCL headers not found!)
|
|
||||||
fi
|
|
||||||
if !($have_opencl_lib); then
|
|
||||||
AC_MSG_ERROR(Required OpenCL library not found!)
|
|
||||||
fi
|
|
||||||
if !($have_tiff); then
|
|
||||||
AC_MSG_ERROR(Required TIFF headers not found! Try to install libtiff-dev?? package.)
|
|
||||||
fi
|
|
||||||
AC_SUBST([AM_CPPFLAGS], [-DUSE_OPENCL])
|
|
||||||
AC_SUBST([OPENCL_HDR_PATH],[$OPENCL_INC])
|
|
||||||
AC_SUBST([OPENCL_LIB],[$OPENCL_LIBS])
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL([USE_OPENCL], [test "$enable_opencl" = "yes"])
|
AM_CONDITIONAL([USE_OPENCL], [test "$enable_opencl" = "yes"])
|
||||||
|
AC_SUBST(OPENCL_CPPFLAGS)
|
||||||
|
AC_SUBST(OPENCL_LDFLAGS)
|
||||||
|
|
||||||
# check whether to build tesseract with -fvisibility=hidden -fvisibility-inlines-hidden
|
# check whether to build tesseract with -fvisibility=hidden -fvisibility-inlines-hidden
|
||||||
# http://gcc.gnu.org/wiki/Visibility
|
# http://gcc.gnu.org/wiki/Visibility
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
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 $(OPENCL_CFLAGS)
|
||||||
if USE_OPENCL
|
|
||||||
if OPENCL_OSX
|
|
||||||
AM_CFLAGS += -framework OpenCL
|
|
||||||
else
|
|
||||||
AM_CPPFLAGS += -I$(OPENCL_HDR_PATH)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
openclwrapper.h oclkernels.h opencl_device_selection.h
|
openclwrapper.h oclkernels.h opencl_device_selection.h
|
||||||
|
|
||||||
@ -13,17 +6,10 @@ if !USING_MULTIPLELIBS
|
|||||||
noinst_LTLIBRARIES = libtesseract_opencl.la
|
noinst_LTLIBRARIES = libtesseract_opencl.la
|
||||||
else
|
else
|
||||||
lib_LTLIBRARIES = libtesseract_opencl.la
|
lib_LTLIBRARIES = libtesseract_opencl.la
|
||||||
libtesseract_opencl_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION)
|
libtesseract_opencl_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) $(OPENCL_LDFLAGS)
|
||||||
libtesseract_opencl_la_LIBADD = \
|
libtesseract_opencl_la_LIBADD = \
|
||||||
../ccutil/libtesseract_ccutil.la \
|
../ccutil/libtesseract_ccutil.la \
|
||||||
../viewer/libtesseract_viewer.la
|
../viewer/libtesseract_viewer.la
|
||||||
if USE_OPENCL
|
|
||||||
if OPENCL_OSX
|
|
||||||
libtesseract_opencl_la_LDFLAGS += -framework OpenCL
|
|
||||||
else
|
|
||||||
libtesseract_opencl_la_LDFLAGS += $(OPENCL_LIB)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libtesseract_opencl_la_SOURCES = \
|
libtesseract_opencl_la_SOURCES = \
|
||||||
|
@ -5,9 +5,8 @@ AM_CPPFLAGS += \
|
|||||||
-I$(top_srcdir)/ccmain -I$(top_srcdir)/wordrec -I$(top_srcdir)/api \
|
-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
|
-I$(top_srcdir)/opencl
|
||||||
if USE_OPENCL
|
|
||||||
AM_CPPFLAGS += -I$(OPENCL_HDR_PATH)
|
AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
|
||||||
endif
|
|
||||||
|
|
||||||
if VISIBILITY
|
if VISIBILITY
|
||||||
AM_CPPFLAGS += -DTESS_EXPORTS \
|
AM_CPPFLAGS += -DTESS_EXPORTS \
|
||||||
|
@ -298,16 +298,14 @@ noinst_HEADERS += ../vs2010/port/strcasestr.h
|
|||||||
libtesseract_training_la_SOURCES += ../vs2010/port/strcasestr.cpp
|
libtesseract_training_la_SOURCES += ../vs2010/port/strcasestr.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_OPENCL
|
ambiguous_words_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
ambiguous_words_LDADD += $(OPENCL_LIB)
|
classifier_tester_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
classifier_tester_LDADD += $(OPENCL_LIB)
|
cntraining_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
cntraining_LDADD += $(OPENCL_LIB)
|
combine_tessdata_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
combine_tessdata_LDADD += $(OPENCL_LIB)
|
dawg2wordlist_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
dawg2wordlist_LDADD += $(OPENCL_LIB)
|
mftraining_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
mftraining_LDADD += $(OPENCL_LIB)
|
set_unicharset_properties_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
set_unicharset_properties_LDADD += $(OPENCL_LIB)
|
shapeclustering_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
shapeclustering_LDADD += $(OPENCL_LIB)
|
text2image_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
text2image_LDADD += $(OPENCL_LIB)
|
unicharset_extractor_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
unicharset_extractor_LDADD += $(OPENCL_LIB)
|
wordlist2dawg_LDFLAGS = $(OPENCL_LDFLAGS)
|
||||||
wordlist2dawg_LDADD += $(OPENCL_LIB)
|
|
||||||
endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user