tesseract/.github/workflows/cmake-win64.yml

155 lines
7.0 KiB
YAML
Raw Normal View History

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
env:
ILOC: d:/a/local
2021-04-07 01:15:08 +08:00
jobs:
build:
2022-06-08 21:15:54 +08:00
name: cmake-win64
runs-on: windows-latest
2021-04-07 01:15:08 +08:00
steps:
- uses: ilammy/setup-nasm@v1
2022-06-08 21:31:57 +08:00
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} ) (${GITHUB_REF#refs/*/})"
uses: actions/checkout@v3
2021-04-07 01:15:08 +08:00
with:
submodules: recursive
2022-06-08 21:31:57 +08:00
- name: Setup Instalation Location
2021-04-07 01:15:08 +08:00
run: |
mkdir ${{env.ILOC}}
2022-06-08 21:31:57 +08:00
- name: Build and Install zlib-ng
2021-04-07 01:15:08 +08:00
shell: cmd
run: |
git clone --depth 1 https://github.com/zlib-ng/zlib-ng.git
2022-06-08 21:15:54 +08:00
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 ..
2021-04-07 01:15:08 +08:00
- 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
unzip.exe -qq lpng1637.zip
2021-04-07 01:15:08 +08:00
cd lpng1637
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DPNG_TESTS=OFF -DPNG_SHARED=OFF
2021-04-07 01:15:08 +08:00
cmake --build build --config Release --target install
cd ..
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 -qq giflib-master.zip
2021-04-07 01:15:08 +08:00
cd giflib-master
cmake -Bbuild -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}}
2021-04-07 01:15:08 +08:00
cmake --build build --config Release --target install
cd ..
2021-04-07 01:15:08 +08:00
- 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
2021-04-07 01:15:08 +08:00
cmake --build build --config Release --target install
cd ..
2021-04-07 01:15:08 +08:00
- name: Build and Install webp
2021-04-07 01:15:08 +08:00
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
2021-04-07 01:15:08 +08:00
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_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_PROGRAMS=OFF -DBUILD_TOOLS=OFF -DCMAKE_WARN_DEPRECATED=OFF
2021-04-07 01:15:08 +08:00
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
2021-04-07 01:15:08 +08:00
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=${{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
2021-04-07 01:15:08 +08:00
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
2021-04-07 01:15:08 +08:00
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 instal
- name: Remove not needed tools Before building tesseract
shell: cmd
run: >
rm -Rf ${{env.ILOC}}/bin/*.exe
2021-04-07 01:15:08 +08:00
- name: Build and Install tesseract
shell: cmd
run: |
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
2021-04-07 01:15:08 +08:00
cmake --build build --config Release --target install
- name: Display Tesseract Version and Test Command Line Usage
2021-04-07 01:15:08 +08:00
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%
2021-04-07 01:15:08 +08:00
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-${{env.RELEASE_VERSION}}-VS2019_win64
path: ${{env.ILOC}}
2022-06-03 02:19:25 +08:00
retention-days: 5