Skip to content

cmake-win64-min

cmake-win64-min #21

# Build Tesseract on Windows using cmake. No Training Tools.
name: cmake-win64-min
on:
#push:
schedule:
- cron: 0 23 * * *
workflow_dispatch:
env:
ILOC: d:/a/local
jobs:
build:
name: cmake-win64-min
runs-on: windows-latest # windows-2019
steps:
- uses: turtlesec-no/get-ninja@main
- name: Setup Installation Location
run: |
mkdir ${{env.ILOC}}/share/tessdata
- name: download extra files
shell: cmd
run: |
curl -L https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata --output ${{env.ILOC}}/share/tessdata/eng.traineddata
curl -L https://github.com/tesseract-ocr/tessdata/raw/main/osd.traineddata --output ${{env.ILOC}}/share/tessdata/osd.traineddata
curl -L https://github.com/zdenop/test_ga/blob/main/testing/eurotext.bmp --output ${{env.ILOC}}/share/eurotext.bmp
curl -L https://github.com/unicode-org/icu/releases/download/release-75-1/icu4c-75_1-Win64-MSVC2022.zip --output icu4c-75_1-Win64-MSVC2022.zip
unzip.exe -qq icu4c-75_1-Win64-MSVC2022.zip -d ${{env.ILOC}}/
- name: Uninstall Perl
run: |
choco uninstall strawberryperl
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build and Install leptonica
shell: cmd
run: |
echo "Building leptonica..."
git clone --depth 1 https://github.com/DanBloomberg/leptonica.git
cd leptonica
cmake -G Ninja -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=cl -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DSW_BUILD=OFF -DBUILD_PROG=OFF -DBUILD_SHARED_LIBS=ON
cmake --build build --target install
- name: Build and Install tesseract
id: build_tess
shell: cmd
run: |
git clone --depth 1 https://github.com/zdenop/tesseract.git
cd tesseract
cmake -G Ninja -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_COMPILER=cl -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_TRAINING_TOOLS=ON -DOPENMP_BUILD=ON
cmake --build build --target install
- name: Upload Build Results
uses: actions/upload-artifact@v4
with:
name: tesseract-${{ steps.build_tess.outputs.version }}-VS2022_win64
path: ${{env.ILOC}}
retention-days: 7
- name: Display Tesseract Version and Test Command Line Usage
shell: cmd
run: |
echo "Setting TESSDATA_PREFIX..."
set TESSDATA_PREFIX=${{env.ILOC}}/share/tessdata
echo "Setting PATH..."
set PATH=${{env.ILOC}}/bin;%PATH%
echo "Checking installed tesseract version..."
tesseract -v
echo "Checking installed langs"
tesseract --list-langs
echo "Checking OCR process"
tesseract ${{env.ILOC}}/share/eurotext.bmp -