Skip to content

cmake: Fix set statement#4560

Open
stweil wants to merge 1 commit into
tesseract-ocr:mainfrom
stweil:fix_cmake
Open

cmake: Fix set statement#4560
stweil wants to merge 1 commit into
tesseract-ocr:mainfrom
stweil:fix_cmake

Conversation

@stweil

@stweil stweil commented Jun 4, 2026

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@zdenop

zdenop commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

IMO current cmake -Bbuild -DSW_BUILD=OFF -DBUILD_TRAINING_TOOLS=ON -DDISABLED_LEGACY_ENGINE=ON does not work without following patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b0cfb793..d39f78b56 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -667,81 +667,6 @@ include(cmake/SourceLists.cmake)
 set(TESSERACT_SRC ${TESSERACT_SRC_CORE})
 
 if(DISABLED_LEGACY_ENGINE)
-  # prepend path to list of source files
-  function(prepend_path srcs path)
-    set(tmp, "")
-    foreach(src IN LISTS ${srcs})
-      list(APPEND tmp ${path}/${src})
-    endforeach(src ${srcs})
-    set(${srcs}
-        ${tmp}
-        PARENT_SCOPE)
-  endfunction()
-
-  set(TESSERACT_SRC_LEGACY
-      src/ccmain/adaptions.cpp
-      src/ccmain/docqual.cpp
-      src/ccmain/equationdetect.cpp
-      src/ccmain/fixspace.cpp
-      src/ccmain/fixxht.cpp
-      src/ccmain/osdetect.cpp
-      src/ccmain/par_control.cpp
-      src/ccmain/recogtraining.cpp
-      src/ccmain/superscript.cpp
-      src/ccmain/tessbox.cpp
-      src/ccmain/tfacepp.cpp
-      src/ccstruct/fontinfo.cpp
-      src/ccstruct/params_training_featdef.cpp
-      src/ccutil/ambigs.cpp
-      src/ccutil/bitvector.cpp
-      src/ccutil/indexmapbidi.cpp
-      src/classify/adaptive.cpp
-      src/classify/adaptmatch.cpp
-      src/classify/blobclass.cpp
-      src/classify/cluster.cpp
-      src/classify/clusttool.cpp
-      src/classify/cutoffs.cpp
-      src/classify/featdefs.cpp
-      src/classify/float2int.cpp
-      src/classify/fpoint.cpp
-      src/classify/intfeaturespace.cpp
-      src/classify/intfx.cpp
-      src/classify/intmatcher.cpp
-      src/classify/intproto.cpp
-      src/classify/kdtree.cpp
-      src/classify/mf.cpp
-      src/classify/mfoutline.cpp
-      src/classify/mfx.cpp
-      src/classify/normfeat.cpp
-      src/classify/normmatch.cpp
-      src/classify/ocrfeatures.cpp
-      src/classify/outfeat.cpp
-      src/classify/picofeat.cpp
-      src/classify/protos.cpp
-      src/classify/shapeclassifier.cpp
-      src/classify/shapetable.cpp
-      src/classify/tessclassifier.cpp
-      src/classify/trainingsample.cpp
-      src/dict/permdawg.cpp
-      src/dict/hyphen.cpp
-      src/wordrec/associate.cpp
-      src/wordrec/chop.cpp
-      src/wordrec/chopper.cpp
-      src/wordrec/drawfx.cpp
-      src/wordrec/findseam.cpp
-      src/wordrec/gradechop.cpp
-      src/wordrec/language_model.cpp
-      src/wordrec/lm_consistency.cpp
-      src/wordrec/lm_pain_points.cpp
-      src/wordrec/lm_state.cpp
-      src/wordrec/outlines.cpp
-      src/wordrec/params_model.cpp
-      src/wordrec/pieces.cpp
-      src/wordrec/plotedges.cpp
-      src/wordrec/render.cpp
-      src/wordrec/segsearch.cpp
-      src/wordrec/wordclass.cpp)
-  prepend_path(TESSERACT_SRC_LEGACY "${CMAKE_CURRENT_SOURCE_DIR}")
   list(REMOVE_ITEM TESSERACT_SRC ${TESSERACT_SRC_LEGACY})
 endif(DISABLED_LEGACY_ENGINE)
 
@@ -793,18 +718,6 @@ endif(HAVE_NEON)
 # Use explicit header file lists from SourceLists.cmake
 set(TESSERACT_HDR ${TESSERACT_HDR_INCLUDE} ${TESSERACT_HDR_INTERNAL})
 
-set(TESSERACT_SRC
-    ${TESSERACT_SRC}
-    src/api/baseapi.cpp
-    src/api/capi.cpp
-    src/api/renderer.cpp
-    src/api/altorenderer.cpp
-    src/api/pagerenderer.cpp
-    src/api/hocrrenderer.cpp
-    src/api/lstmboxrenderer.cpp
-    src/api/pdfrenderer.cpp
-    src/api/wordstrboxrenderer.cpp)
-
 set(TESSERACT_CONFIGS
     tessdata/configs/alto
     tessdata/configs/ambigs.train
diff --git a/src/classify/classify.h b/src/classify/classify.h
index e42d5674e..e03b8f791 100644
--- a/src/classify/classify.h
+++ b/src/classify/classify.h
@@ -31,7 +31,7 @@
 
 namespace tesseract {
 
-class Classify : public CCStruct {
+class TESS_API Classify : public CCStruct {
 public:
   Classify();
   virtual ~Classify();
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
index 6a91c62fc..a660c9b18 100644
--- a/unittest/CMakeLists.txt
+++ b/unittest/CMakeLists.txt
@@ -40,7 +40,6 @@ set(TRAINING_TESTS
     lstm_recode_test.cc
     lstm_squashed_test.cc
     lstm_test.cc
-    lstm_test.cc
     normstrngs_test.cc
     unichar_test.cc
     unicharcompress_test.cc
@@ -51,8 +50,7 @@ set(TRAINING_TESTS
     validate_myanmar_test.cc
     validator_test.cc)
 
-set(PANGO_TESTS ligature_table_test.cc pango_font_info_test.cc
-                pango_font_info_test.cc stringrenderer_test.cc)
+set(PANGO_TESTS ligature_table_test.cc pango_font_info_test.cc stringrenderer_test.cc)
 
 set(LEGACY_TESTS
     applybox_test.cc
@@ -63,7 +61,8 @@ set(LEGACY_TESTS
     mastertrainer_test.cc
     osd_test.cc
     params_model_test.cc
-    shapetable_test.cc)
+    shapetable_test.cc
+    textlineprojection_test.cc)
 
 if(BUILD_TRAINING_TOOLS AND PANGO_FOUND)
   list(APPEND COMMON_INCLUDE_DIRS
-- 

@stweil

stweil commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

IMO current cmake -Bbuild -DSW_BUILD=OFF -DBUILD_TRAINING_TOOLS=ON -DDISABLED_LEGACY_ENGINE=ON does not work without following patch

@zdenop, what will go wrong without your patch? Should I wait with this PR, or can I merge it?
Okay, the build without training tools works, but with -DBUILD_TRAINING_TOOLS=ON I also get a build error. Do you want to send a PR with your fix?

@zdenop

zdenop commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

I can sent PR later today or tomorrow.

@zdenop

zdenop commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

done #4562

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants