mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-11 23:19:04 +08:00
ea446b1eae
Signed-off-by: Stefan Weil <sw@weilnetz.de>
153 lines
6.5 KiB
YAML
153 lines
6.5 KiB
YAML
name: cmake
|
|
# cmake build of tesseract and training tools on ubuntu and macOS homebrew using Ninja.
|
|
# test command line version of tesseract. run basicapitest.
|
|
on:
|
|
#push:
|
|
schedule:
|
|
- cron: 0 21 * * *
|
|
|
|
jobs:
|
|
basictests:
|
|
name: ${{ matrix.config.name }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
|
|
- { name: macos-10.15-clang-12-cmake, os: macos-10.15, cxx: clang++ } # defualt
|
|
- { name: macos-10.15-clang-11-cmake, os: macos-10.15, cxx: '$(brew --prefix llvm)/bin/clang++' } #installed
|
|
- { name: macos-10.15-gcc-8-cmake, os: macos-10.15, cxx: g++-8 } #installed
|
|
- { name: macos-10.15-gcc-9-cmake, os: macos-10.15, cxx: g++-9 } #installed
|
|
- { name: macos-10.15-gcc-10-cmake, os: macos-10.15, cxx: g++-10 } #installed
|
|
|
|
- { name: ubuntu-18.04-clang-7-cmake, os: ubuntu-18.04, cxx: clang++-7 }
|
|
- { name: ubuntu-18.04-clang-8-cmake, os: ubuntu-18.04, cxx: clang++-8 } #installed
|
|
- { name: ubuntu-18.04-clang-9-cmake, os: ubuntu-18.04, cxx: clang++-9 } #installed
|
|
- { name: ubuntu-18.04-clang-10-cmake, os: ubuntu-18.04, cxx: clang++-10 }
|
|
|
|
- { name: ubuntu-18.04-gcc-7-cmake, os: ubuntu-18.04, cxx: g++-7 } #installed
|
|
- { name: ubuntu-18.04-gcc-8-cmake, os: ubuntu-18.04, cxx: g++-8 } #installed
|
|
- { name: ubuntu-18.04-gcc-9-cmake, os: ubuntu-18.04, cxx: g++-9 } #installed
|
|
- { name: ubuntu-18.04-gcc-10-cmake, os: ubuntu-18.04, cxx: g++-10 } #installed
|
|
|
|
- { name: ubuntu-20.04-clang-7-cmake, os: ubuntu-20.04, cxx: clang++-7 }
|
|
- { name: ubuntu-20.04-clang-8-cmake, os: ubuntu-20.04, cxx: clang++-8 } #installed
|
|
- { name: ubuntu-20.04-clang-9-cmake, os: ubuntu-20.04, cxx: clang++-9 } #installed
|
|
- { name: ubuntu-20.04-clang-10-cmake, os: ubuntu-20.04, cxx: clang++-10 } #installed
|
|
|
|
- { name: ubuntu-20.04-gcc-7-cmake, os: ubuntu-20.04, cxx: g++-7 } #installed
|
|
- { name: ubuntu-20.04-gcc-8-cmake, os: ubuntu-20.04, cxx: g++-8 } #installed
|
|
- { name: ubuntu-20.04-gcc-9-cmake, os: ubuntu-20.04, cxx: g++-9 } #installed
|
|
- { name: ubuntu-20.04-gcc-10-cmake, os: ubuntu-20.04, cxx: g++-10 } #installed
|
|
|
|
steps:
|
|
- name: Install compilers on Linux
|
|
run: |
|
|
sudo apt-get install ${{ matrix.config.cxx }} -y
|
|
if: runner.os == 'Linux'
|
|
|
|
# sudo apt-get install libarchive-dev libcurl4-openssl-dev libcurl4 curl -y
|
|
- name: Install dependencies on Linux
|
|
run: |
|
|
sudo apt-get install autoconf-archive libleptonica-dev -y
|
|
sudo apt-get install libicu-dev libpango1.0-dev libcairo2-dev -y
|
|
sudo apt-get install cabextract -y
|
|
sudo apt-get install ninja-build -y
|
|
if: runner.os == 'Linux'
|
|
|
|
- name: Install dependencies on macOS
|
|
run: |
|
|
brew install automake autoconf-archive
|
|
brew install leptonica
|
|
brew install cairo pango icu4c
|
|
brew install cabextract
|
|
brew install ninja
|
|
ninja --version
|
|
cmake --version
|
|
if: runner.os == 'macOS'
|
|
|
|
- name: Checkout Source
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Configure Tesseract (Linux)
|
|
run: |
|
|
mkdir build
|
|
mkdir inst
|
|
cmake \
|
|
-S . \
|
|
-B build \
|
|
-G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DOPENMP_BUILD=OFF \
|
|
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
|
|
-DCMAKE_INSTALL_PREFIX:PATH=inst
|
|
if: runner.os == 'Linux'
|
|
|
|
- name: Configure Tesseract (macOS)
|
|
shell: bash
|
|
run: |
|
|
set -e
|
|
export PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig:$(brew --prefix)/opt/libarchive/lib/pkgconfig:/$(brew --prefix)/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH
|
|
mkdir build
|
|
mkdir inst
|
|
cmake \
|
|
-S . \
|
|
-B build \
|
|
-G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DOPENMP_BUILD=OFF \
|
|
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
|
|
-DCMAKE_INSTALL_PREFIX:PATH=inst
|
|
if: runner.os == 'macOS'
|
|
|
|
- name: Build Tesseract
|
|
run: |
|
|
cmake --build build --config Release --target install
|
|
|
|
- name: Display Tesseract Version
|
|
run: |
|
|
build/inst/bin/tesseract -v
|
|
|
|
- name: Display Training Tools Version
|
|
run: |
|
|
build/inst/bin/lstmtraining -v
|
|
build/inst/bin/text2image -v
|
|
|
|
- name: Download fonts, tessdata and langdata required for tests
|
|
run: |
|
|
git clone https://github.com/egorpugin/tessdata tessdata_unittest
|
|
cp tessdata_unittest/fonts/* test/testing/
|
|
mv tessdata_unittest/* ../
|
|
|
|
- name: List languages in different tessdata-dir
|
|
run: |
|
|
build/inst/bin/tesseract --list-langs --tessdata-dir ../tessdata
|
|
build/inst/bin/tesseract --list-langs --tessdata-dir ../tessdata_best
|
|
build/inst/bin/tesseract --list-langs --tessdata-dir ../tessdata_fast
|
|
|
|
- name: Run Tesseract on test images in different languages
|
|
run: |
|
|
build/inst/bin/tesseract test/testing/phototest.tif - --oem 1 --tessdata-dir ../tessdata
|
|
build/inst/bin/tesseract test/testing/raaj.tif - -l hin --oem 1 --tessdata-dir ../tessdata
|
|
build/inst/bin/tesseract test/testing/viet.tif - -l vie --oem 1 --tessdata-dir ../tessdata
|
|
build/inst/bin/tesseract test/testing/hebrew.png - -l heb --oem 1 --tessdata-dir ../tessdata
|
|
build/inst/bin/tesseract test/testing/eurotext.tif - -l fra --oem 1 --tessdata-dir ../tessdata_best
|
|
build/inst/bin/tesseract test/testing/arabic.tif - -l ara --oem 1 --psm 6 --tessdata-dir ../tessdata
|
|
|
|
- name: Build and run basicapitest
|
|
run: |
|
|
export "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build/inst/lib/pkgconfig/:$PKG_CONFIG_PATH"
|
|
cd test
|
|
${{ matrix.config.cxx }} -o basicapitest testing/basicapitest.cpp "-I$GITHUB_WORKSPACE/build/inst/include" "-L$GITHUB_WORKSPACE/build/inst/lib" `pkg-config --cflags --libs tesseract lept ` -pthread -std=c++11
|
|
./basicapitest
|
|
|
|
- name: Display Compiler Version
|
|
run: |
|
|
${{ matrix.config.cxx }} --version
|
|
git log -3 --pretty=format:'%h %ad %s | %an'
|
|
if: always()
|
|
|