tesseract/.github/workflows/cmake.yml
Shree Devi Kumar 52dba02954 Add vcpkg build
2021-02-03 10:32:52 +00:00

116 lines
4.9 KiB
YAML

name: cmake
# cmake build of tesseract and training tools with gcc and clang on ubuntu.
# cmake build of tesseract and training tools with gcc and clang on macOS homebrew using Ninja.
# test command line version of tesseract.
on:
#push:
schedule:
- cron: 0 21 * * *
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- { name: macos-10.15-clang-cmake-build, os: macos-10.15, cc: clang, cxx: clang++ }
- { name: macos-10.15-gcc-cmake-build, os: macos-10.15, cc: gcc, cxx: g++ }
- { name: ubuntu-18.04-clang-7-cmake-build, os: ubuntu-18.04, cc: clang-7, cxx: clang++-7 }
- { name: ubuntu-18.04-clang-8-cmake-build, os: ubuntu-18.04, cc: clang-8, cxx: clang++-8 }
- { name: ubuntu-18.04-clang-9-cmake-build, os: ubuntu-18.04, cc: clang-9, cxx: clang++-9 }
- { name: ubuntu-18.04-clang-10-cmake-build, os: ubuntu-18.04, cc: clang-10, cxx: clang++-10 }
- { name: ubuntu-18.04-gcc-7-cmake-build, os: ubuntu-18.04, cc: gcc-7, cxx: g++-7 }
- { name: ubuntu-18.04-gcc-8-cmake-build, os: ubuntu-18.04, cc: gcc-8, cxx: g++-8 }
- { name: ubuntu-18.04-gcc-9-cmake-build, os: ubuntu-18.04, cc: gcc-9, cxx: g++-9 }
- { name: ubuntu-18.04-gcc-10-cmake-build, os: ubuntu-18.04, cc: gcc-10, cxx: g++-10 }
- { name: ubuntu-20.04-clang-7-cmake-build, os: ubuntu-20.04, cc: clang-7, cxx: clang++-7 }
- { name: ubuntu-20.04-clang-8-cmake-build, os: ubuntu-20.04, cc: clang-8, cxx: clang++-8 }
- { name: ubuntu-20.04-clang-9-cmake-build, os: ubuntu-20.04, cc: clang-9, cxx: clang++-9 }
- { name: ubuntu-20.04-clang-10-cmake-build, os: ubuntu-20.04, cc: clang-10, cxx: clang++-10 }
- { name: ubuntu-20.04-gcc-7-cmake-build, os: ubuntu-20.04, cc: gcc-7, cxx: g++-7 }
- { name: ubuntu-20.04-gcc-8-cmake-build, os: ubuntu-20.04, cc: gcc-8, cxx: g++-8 }
- { name: ubuntu-20.04-gcc-9-cmake-build, os: ubuntu-20.04, cc: gcc-9, cxx: g++-9 }
- { name: ubuntu-20.04-gcc-10-cmake-build, os: ubuntu-20.04, cc: gcc-10, cxx: g++-10 }
steps:
- name: Install compilers on Linux
run: |
sudo apt-get install ${{ matrix.config.cc }} ${{ matrix.config.cxx }} -y
if: runner.os == 'Linux'
- name: Install dependencies on Linux
run: |
sudo apt-get install libleptonica-dev libpango1.0-dev -y
if: runner.os == 'Linux'
- name: Install dependencies on macOS
run: |
brew install cmake ninja leptonica pango libarchive icu4c
ninja --version
cmake --version
if: runner.os == 'macOS'
- name: Checkout Source
uses: actions/checkout@v2
with:
submodules: recursive
- name: Configure (Linux)
run: |
mkdir build && cd build
cmake -DCMAKE_CC_COMPILER=${{ matrix.config.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-DCMAKE_INSTALL_PREFIX=inst \
-DCMAKE_BUILD_TYPE=Release ..
if: runner.os == 'Linux'
- name: Configure (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 \
-DCMAKE_BUILD_TYPE=Release \
-G Ninja \
-DCMAKE_C_COMPILER=${{ matrix.config.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-DCMAKE_INSTALL_PREFIX:PATH=inst
if: runner.os == 'macOS'
- name: Build
run: |
cmake --build build --config Release --target install
- name: Display Tesseract Version
run: |
build/inst/bin/tesseract -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: Run Tesseract on phototest.tif and raaj.tif
run: |
build/inst/bin/tesseract test/testing/phototest.tif - --tessdata-dir ../tessdata
build/inst/bin/tesseract test/testing/raaj.tif - -l hin --tessdata-dir ../tessdata
- name: Display Training Tools Version
run: |
build/inst/bin/lstmtraining -v
build/inst/bin/text2image -v
- name: Display Compiler Version
run: |
${{ matrix.config.cc }} --version
${{ matrix.config.cxx }} --version
git log -3 --pretty=format:'%h %ad %s | %an'
if: always()