2021-04-07 01:15:08 +08:00
|
|
|
# Based on https://github.com/zdenop/tesserocr/actions/runs/691257659/workflow
|
|
|
|
# Build Tesseract on Windows using cmake. No Training Tools.
|
|
|
|
name: cmake-win64
|
|
|
|
on:
|
2021-04-07 01:28:55 +08:00
|
|
|
#push:
|
2021-04-07 01:15:08 +08:00
|
|
|
schedule:
|
|
|
|
- cron: 0 23 * * *
|
2022-06-02 19:27:33 +08:00
|
|
|
workflow_dispatch:
|
2021-04-07 01:15:08 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: ${{ matrix.config.name }}
|
|
|
|
runs-on: ${{ matrix.config.os }}
|
|
|
|
strategy:
|
2022-06-02 19:27:33 +08:00
|
|
|
fail-fast: True
|
2021-04-07 01:15:08 +08:00
|
|
|
matrix:
|
|
|
|
config:
|
|
|
|
- {
|
2022-06-02 19:27:33 +08:00
|
|
|
name: "Windows Latest MSVC - cmake", artifact: "Windows-MSVC",
|
2021-04-07 01:15:08 +08:00
|
|
|
os: windows-latest,
|
2022-06-02 19:27:33 +08:00
|
|
|
cc: "cl", cxx: "cl",
|
2021-04-07 01:15:08 +08:00
|
|
|
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
|
|
|
|
}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Build and Install leptonica dependencies
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
mkdir d:/a/local
|
|
|
|
set PKG_CONFIG_PATH=d:/a/local/lib/pkgconfig
|
|
|
|
echo "PKG_CONFIG_PATH=d:/a/local/lib/pkgconfig" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Build and Install zlib
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
2022-06-02 15:07:50 +08:00
|
|
|
curl -sSL -o zlib1212.zip https://zlib.net/zlib1212.zip
|
2022-06-02 15:00:20 +08:00
|
|
|
unzip.exe zlib1212.zip
|
2022-06-02 15:07:50 +08:00
|
|
|
cd zlib-1.2.12
|
2021-04-07 01:15:08 +08:00
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
|
|
|
|
- name: Build and Install libpng
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
2021-04-29 16:12:43 +08:00
|
|
|
curl -sSL -o lpng1637.zip https://download.sourceforge.net/libpng/lpng1637.zip
|
2021-04-07 01:15:08 +08:00
|
|
|
unzip.exe lpng1637.zip
|
|
|
|
cd lpng1637
|
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
|
2022-06-02 20:06:28 +08:00
|
|
|
# - name: Build and Install webp
|
|
|
|
# shell: cmd
|
|
|
|
# run: |
|
|
|
|
# git clone --depth 1 https://github.com/webmproject/libwebp.git && cd libwebp
|
|
|
|
# cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local -DWEBP_BUILD_ANIM_UTILS =OFF
|
|
|
|
# cmake --build build --config Release --target install
|
2021-04-07 01:15:08 +08:00
|
|
|
|
|
|
|
- name: Build and Install giflib
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
curl -sSL -o giflib-master.zip https://codeload.github.com/xbmc/giflib/zip/master
|
|
|
|
unzip giflib-master.zip
|
|
|
|
cd giflib-master
|
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
|
|
|
|
- name: Build and Install libjpeg
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo.git
|
|
|
|
cd libjpeg-turbo
|
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
|
|
|
|
- name: Build and Install openjpeg
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
git clone --depth 1 https://github.com/uclouvain/openjpeg.git
|
|
|
|
cd openjpeg
|
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
- name: Build and Install jbigkit
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
git clone --depth 1 https://github.com/zdenop/jbigkit
|
|
|
|
cd jbigkit-2.1
|
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
- name: Build and Install zstd
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
git clone --depth 1 https://github.com/facebook/zstd.git
|
|
|
|
cd zstd
|
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
- name: Build and Install libtiff
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
git clone --depth 1 https://gitlab.com/libtiff/libtiff
|
|
|
|
cd libtiff
|
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
- name: Build and Install leptonica
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
echo "Building leptonica..."
|
|
|
|
git clone --depth 1 https://github.com/DanBloomberg/leptonica.git && cd leptonica
|
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_PROG=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
|
|
|
|
- name: Build and Install tesseract
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_TRAINING_TOOLS=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON -DOPENMP_BUILD=OFF -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
|
|
|
|
cmake --build build --config Release --target install
|
|
|
|
|
2021-05-17 21:18:43 +08:00
|
|
|
- name: Display Tesseract Version and Test Command Line Usage
|
2021-04-07 01:15:08 +08:00
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
git clone --depth 1 https://github.com/tesseract-ocr/tessconfigs
|
|
|
|
mkdir d:/a/local/share
|
|
|
|
move tessconfigs d:/a/local/share
|
2021-09-13 13:42:46 +08:00
|
|
|
curl -L https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata --output d:/a/local/share/tessconfigs/eng.traineddata
|
|
|
|
curl -L https://github.com/tesseract-ocr/tessdata/raw/main/osd.traineddata --output d:/a/local/share/tessconfigs/osd.traineddata
|
2021-04-07 01:15:08 +08:00
|
|
|
set TESSDATA_PREFIX=d:/a/local/share/tessconfigs
|
|
|
|
set PATH=d:/a/local/bin;%PATH%
|
|
|
|
tesseract -v
|
|
|
|
tesseract --list-langs
|
|
|
|
tesseract test/testing/phototest.tif -
|
2022-06-03 02:19:25 +08:00
|
|
|
|
|
|
|
- name: Upload Build Results
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: tesseract-cmake-win64
|
2022-06-03 02:55:26 +08:00
|
|
|
path: d:/a/local
|
2022-06-03 02:19:25 +08:00
|
|
|
retention-days: 5
|
|
|
|
|
|
|
|
- name: Download a Build Artifact
|
|
|
|
uses: actions/download-artifact@v3.0.0
|
|
|
|
with:
|
|
|
|
# Artifact name
|
|
|
|
name: # optional
|
|
|
|
# Destination path
|
|
|
|
path: # optional
|
|
|
|
|