File tree Expand file tree Collapse file tree 4 files changed +48
-4
lines changed
Expand file tree Collapse file tree 4 files changed +48
-4
lines changed Original file line number Diff line number Diff line change 44 pull_request :
55 branches : [main, master]
66
7- name : " clang 19 "
7+ name : " clang19-rhub "
88
99jobs :
1010 check :
Original file line number Diff line number Diff line change 1+ on :
2+ push :
3+ branches : [main, master]
4+ pull_request :
5+ branches : [main, master]
6+
7+ name : " gcc14-rhub"
8+
9+ jobs :
10+ check :
11+ runs-on : ubuntu-latest
12+ container :
13+ image : ghcr.io/r-hub/containers/gcc14:latest
14+
15+ steps :
16+ - uses : actions/checkout@v4
17+
18+ - name : Install dependencies
19+ run : |
20+ R -q -e 'pak::pkg_install(c("deps::.", "any::rcmdcheck"), dependencies = TRUE)'
21+
22+ - uses : r-lib/actions/check-r-package@v2
Original file line number Diff line number Diff line change 6565CXX11CPP=` ${R_HOME} /bin/R CMD config CXXCPP`
6666fi
6767
68- # Create a temporary C++ file to test the compatibility with Tesseract
68+ # Create temporary C++ files to test the compatibility with Tesseract
69+ cat << EOF > conftest.cpp
70+ #include <tesseract/baseapi.h>
71+ #include <string>
72+
73+ int main() {
74+ tesseract::TessBaseAPI api;
75+ std::string val;
76+ // This fails to link on older Tesseract
77+ api.GetVariableAsString("test", &val);
78+ return 0;
79+ }
80+ EOF
81+
82+ if ${CXX11} -std=gnu++11 -c conftest.cpp -o conftest.o ${PKG_CFLAGS} ; then
83+ CXXFLAGS=" $CXXFLAGS -DTESSERACT_HAS_GETVARIABLEASSTRING"
84+ echo " Using GetVariableAsString()"
85+ else
86+ echo " Using GetStringVariable()"
87+ fi
88+
6989cat << EOF > conftest.cpp
7090#include <tesseract/baseapi.h>
7191#include <allheaders.h>
Original file line number Diff line number Diff line change @@ -124,7 +124,8 @@ tesseract::TessBaseAPI *get_engine(TessPtr engine) {
124124 writable::logicals out (params.size ());
125125 STRING str;
126126 for (int i = 0 ; i < params.size (); i++) {
127- #if TESSERACT_MAJOR_VERSION >= 5
127+ #if defined(TESSERACT_HAS_GETVARIABLEASSTRING)
128+ // Use the newer API
128129 out[i] = api->GetVariableAsString (std::string (params.at (i)).c_str (), &str);
129130#else
130131 const char *value =
@@ -175,7 +176,8 @@ tesseract::TessBaseAPI *get_engine(TessPtr engine) {
175176 std::vector<std::string> values;
176177 for (int i = 0 ; i < params.size (); ++i) {
177178 STRING str;
178- #if TESSERACT_MAJOR_VERSION >= 5
179+ #if defined(TESSERACT_HAS_GETVARIABLEASSTRING)
180+ // Use the newer API
179181 if (api->GetVariableAsString (std::string (params.at (i)).c_str (), &str)) {
180182 values.push_back (str);
181183#else
You can’t perform that action at this time.
0 commit comments