Skip to content

Commit 72f1a5c

Browse files
committed
remove winlibs
1 parent f9b7257 commit 72f1a5c

File tree

7 files changed

+41
-110
lines changed

7 files changed

+41
-110
lines changed

configure

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,6 @@ elif [ "$PKGCONFIG_CFLAGS_TESSERACT" ] || [ "$PKGCONFIG_LIBS_TESSERACT" ]; then
3535
echo "Found pkg-config cflags and libs!"
3636
PKG_CFLAGS="${PKGCONFIG_CFLAGS_TESSERACT}"
3737
PKG_LIBS="${PKGCONFIG_LIBS_TESSERACT}"
38-
elif [ `uname` = "Darwin" ]; then
39-
test ! "$CI" && brew --version 2>/dev/null
40-
if [ $? -eq 0 ]; then
41-
BREWDIR=`brew --prefix`
42-
PKG_CFLAGS="-I$BREWDIR/include/tesseract -I$BREWDIR/include/leptonica"
43-
PKG_LIBS="-L$BREWDIR/lib $PKG_LIBS"
44-
else
45-
echo "Homebrew is not installed. Visit https://brew.sh/ for information on how to install it."
46-
echo "Tesseract can be installed with 'brew install tesseract'."
47-
exit 1
48-
fi
4938
fi
5039

5140
# For debugging

man/cpp11tesseract-package.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Makevars.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
11
PKG_CPPFLAGS=@cflags@
22
PKG_LIBS=@libs@
3-
4-
PKG_CXXFLAGS=$(C_VISIBILITY)
5-
6-
all: clean
7-
8-
clean:
9-
rm -f $(SHLIB) $(OBJECTS)

src/Makevars.win

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
# Tesseract configuration
22

3-
RWINLIB = ../windows/tesseract
4-
PKG_CPPFLAGS = -I${RWINLIB}/include -I${RWINLIB}/include/leptonica
5-
6-
PKG_LIBS = -L${RWINLIB}/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} \
7-
-L${RWINLIB}/lib \
8-
-ltesseract -lleptonica \
9-
-ltiff -lopenjp2 -lwebp -lsharpyuv -ljpeg -lgif -lpng16 -lz \
10-
-lws2_32
11-
12-
# Compile
13-
14-
all: clean winlibs
15-
16-
clean:
17-
rm -Rf $(OBJECTS) $(SHLIB)
18-
19-
winlibs:
20-
mkdir -p ../inst
21-
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" ${VERSION}
22-
cp -Rf ../windows/tessdata ../inst/
23-
cp -Rf ${RWINLIB}/share/tessdata ../inst/
24-
25-
.PHONY: all winlibs clean
26-
3+
PKG_CONFIG_NAME = tesseract-ocr
4+
PKG_CONFIG ?= $(BINPREF)pkg-config
5+
PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_NAME))
6+
PKG_CPPFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_CONFIG_NAME))

src/cpp11tesseract.cpp

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,4 @@
1-
#include <memory>
2-
#include <list>
3-
#include <string>
4-
#include <vector>
5-
#include <tesseract/baseapi.h> // tesseract
6-
#include <allheaders.h> // leptonica
7-
#include <cpp11.hpp>
8-
9-
using namespace cpp11;
10-
11-
inline void tess_finalizer(tesseract::TessBaseAPI* engine) {
12-
engine->End();
13-
delete engine;
14-
}
15-
16-
typedef cpp11::external_pointer<tesseract::TessBaseAPI, tess_finalizer> TessPtr;
17-
18-
inline void set_tesseract_options(tesseract::TessBaseAPI* engine,
19-
cpp11::list options) {
20-
for (int i = 0; i < options.size(); ++i) {
21-
std::string key = cpp11::as_cpp<std::string>(options.names()[i]);
22-
std::string value = cpp11::as_cpp<std::string>(options[i]);
23-
engine->SetVariable(key.c_str(), value.c_str());
24-
}
25-
}
26-
27-
inline TessPtr make_tess_ptr(tesseract::TessBaseAPI* engine,
28-
cpp11::list options = cpp11::list()) {
29-
set_tesseract_options(engine, options);
30-
return TessPtr(engine);
31-
}
1+
#include "cpp11tesseract_types.h"
322

333
#if TESSERACT_MAJOR_VERSION < 5
344
#include <tesseract/genericvector.h>
@@ -37,10 +7,17 @@ inline TessPtr make_tess_ptr(tesseract::TessBaseAPI* engine,
377
#define GenericVector std::vector
388
#endif
399

10+
#include <memory>
11+
#include <list>
12+
#include <string>
13+
#include <vector>
14+
4015
[[cpp11::register]] int tesseract_major_version() {
4116
return TESSERACT_MAJOR_VERSION;
4217
}
4318

19+
using namespace cpp11;
20+
4421
/* libtesseract 4.0 insisted that the engine is initiated in 'C' locale.
4522
* We do this as exemplified in the example code in the libc manual:
4623
* https://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html

src/cpp11tesseract_types.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <tesseract/baseapi.h> // tesseract
2+
#include <allheaders.h> // leptonica
3+
4+
#include <cpp11.hpp>
5+
6+
inline void tess_finalizer(tesseract::TessBaseAPI* engine) {
7+
engine->End();
8+
delete engine;
9+
}
10+
11+
typedef cpp11::external_pointer<tesseract::TessBaseAPI, tess_finalizer> TessPtr;
12+
13+
inline void set_tesseract_options(tesseract::TessBaseAPI* engine,
14+
cpp11::list options) {
15+
for (int i = 0; i < options.size(); ++i) {
16+
std::string key = cpp11::as_cpp<std::string>(options.names()[i]);
17+
std::string value = cpp11::as_cpp<std::string>(options[i]);
18+
engine->SetVariable(key.c_str(), value.c_str());
19+
}
20+
}
21+
22+
inline TessPtr make_tess_ptr(tesseract::TessBaseAPI* engine,
23+
cpp11::list options = cpp11::list()) {
24+
set_tesseract_options(engine, options);
25+
return TessPtr(engine);
26+
}

tools/winlibs.R

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)