mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-21 05:21:35 +08:00
159 lines
7.1 KiB
YAML
159 lines
7.1 KiB
YAML
# Based on https://github.com/zdenop/tesserocr/actions/runs/691257659/workflow
|
|
# Build Tesseract on Windows using cmake. No Training Tools.
|
|
name: cmake-win64
|
|
on:
|
|
#push:
|
|
schedule:
|
|
- cron: 0 23 * * *
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
ILOC: d:/a/local
|
|
|
|
jobs:
|
|
build:
|
|
name: cmake-win64
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: ilammy/setup-nasm@v1
|
|
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
- name: Get the version
|
|
id: get_version
|
|
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
|
- name: Setup Instalation Location
|
|
run: |
|
|
mkdir ${{env.ILOC}}
|
|
- name: Build and Install zlib-ng
|
|
shell: cmd
|
|
run: |
|
|
git clone --depth 1 https://github.com/zlib-ng/zlib-ng.git
|
|
cd zlib-ng
|
|
cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_SHARED_LIBS=OFF -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF -DINSTALL_UTILS=OFF
|
|
cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF -DINSTALL_UTILS=OFF
|
|
cmake --build build --config Release --target install
|
|
cd ..
|
|
|
|
- name: Build and Install libpng
|
|
shell: cmd
|
|
run: |
|
|
curl -sSL -o lpng1637.zip https://download.sourceforge.net/libpng/lpng1637.zip
|
|
unzip.exe -qq lpng1637.zip
|
|
cd lpng1637
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DPNG_TESTS=OFF -DPNG_SHARED=OFF
|
|
cmake --build build --config Release --target install
|
|
cd ..
|
|
|
|
- name: Build and Install giflib
|
|
shell: cmd
|
|
run: |
|
|
curl -sSL -o giflib-master.zip https://codeload.github.com/xbmc/giflib/zip/master
|
|
unzip -qq giflib-master.zip
|
|
cd giflib-master
|
|
cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}}
|
|
cmake --build build --config Release --target install
|
|
cd ..
|
|
|
|
- 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=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DWITH_TURBOJPEG=OFF -DENABLE_SHARED=OFF
|
|
cmake --build build --config Release --target install
|
|
cd ..
|
|
|
|
- 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=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_EXTRAS=OFF
|
|
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.git
|
|
cd jbigkit
|
|
cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_PROGRAMS=OFF -DBUILD_TOOLS=OFF -DCMAKE_WARN_DEPRECATED=OFF
|
|
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/build/cmake
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DZSTD_BUILD_PROGRAMS=OFF -DBUILD_TESTING=OFF
|
|
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.git
|
|
cd libtiff
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -Dtiff-tools=OFF -Dtiff-tests=OFF -Dtiff-contrib=OFF -Dtiff-docs=OFF
|
|
cmake --build build --config Release --target install
|
|
cd ..
|
|
|
|
- name: Build and Install openjpeg
|
|
shell: cmd
|
|
run: |
|
|
git clone --depth 1 https://github.com/uclouvain/openjpeg.git
|
|
cd openjpeg
|
|
cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_CODEC=OFF -DBUILD_TESTING=OFF -DBUILD_DOC=OFF -DCMAKE_WARN_DEPRECATED=OFF
|
|
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 -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DSW_BUILD=OFF -DBUILD_PROG=OFF -DBUILD_SHARED_LIBS=ON
|
|
cmake --build build --config Release --target install
|
|
|
|
- name: Build and Install libarchive
|
|
shell: cmd
|
|
run: |
|
|
git clone --depth 1 https://github.com/libarchive/libarchive.git
|
|
cd libarchive
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DENABLE_TEST=OFF
|
|
cmake --build build --config Release --target install
|
|
|
|
- name: Remove not needed tools Before building tesseract
|
|
shell: cmd
|
|
run: >
|
|
rm -Rf ${{env.ILOC}}/bin/*.exe
|
|
|
|
- name: Build and Install tesseract
|
|
shell: cmd
|
|
run: |
|
|
REM cmake -E env CXXFLAGS="/Qpar /fp:fast"
|
|
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON -DENABLE_LTO=ON -DBUILD_TRAINING_TOOLS=OFF -DFAST_FLOAT=ON -DGRAPHICS_DISABLED=ON -DOPENMP_BUILD=ON
|
|
cmake --build build --config Release --target install
|
|
|
|
- name: Display Tesseract Version and Test Command Line Usage
|
|
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
|
|
set TESSDATA_PREFIX=${{env.ILOC}}/share/tessdata
|
|
set PATH=${{env.ILOC}}/bin;%PATH%
|
|
tesseract -v
|
|
tesseract --list-langs
|
|
tesseract test/testing/phototest.tif -
|
|
|
|
- name: Upload Build Results
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: tesseract-${{ steps.get_version.outputs.VERSION }}-VS2019_win64
|
|
path: ${{env.ILOC}}
|
|
retention-days: 5
|