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 4
4
pull_request :
5
5
branches : [main, master]
6
6
7
- name : " clang 19 "
7
+ name : " clang19-rhub "
8
8
9
9
jobs :
10
10
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 65
65
CXX11CPP=` ${R_HOME} /bin/R CMD config CXXCPP`
66
66
fi
67
67
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
+
69
89
cat << EOF > conftest.cpp
70
90
#include <tesseract/baseapi.h>
71
91
#include <allheaders.h>
Original file line number Diff line number Diff line change @@ -124,7 +124,8 @@ tesseract::TessBaseAPI *get_engine(TessPtr engine) {
124
124
writable::logicals out (params.size ());
125
125
STRING str;
126
126
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
128
129
out[i] = api->GetVariableAsString (std::string (params.at (i)).c_str (), &str);
129
130
#else
130
131
const char *value =
@@ -175,7 +176,8 @@ tesseract::TessBaseAPI *get_engine(TessPtr engine) {
175
176
std::vector<std::string> values;
176
177
for (int i = 0 ; i < params.size (); ++i) {
177
178
STRING str;
178
- #if TESSERACT_MAJOR_VERSION >= 5
179
+ #if defined(TESSERACT_HAS_GETVARIABLEASSTRING)
180
+ // Use the newer API
179
181
if (api->GetVariableAsString (std::string (params.at (i)).c_str (), &str)) {
180
182
values.push_back (str);
181
183
#else
You can’t perform that action at this time.
0 commit comments