Skip to content

Commit

Permalink
Merge branch 'main' into improve-build-for-android-integrate-with-cpu…
Browse files Browse the repository at this point in the history
…_features-library
  • Loading branch information
zdenop authored Jun 23, 2022
2 parents 12cd761 + 18fb5aa commit a96b2ab
Show file tree
Hide file tree
Showing 150 changed files with 2,444 additions and 2,354 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/autotools-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
#push:
schedule:
- cron: 0 20 * * *
workflow_dispatch:
jobs:

brew:
Expand Down Expand Up @@ -42,7 +43,7 @@ jobs:
- name: Configure Tesseract
run: |
./configure '--disable-shared' '--disable-openmp' '--disable-doc' '--with-pic' 'CXX=${{ matrix.config.cxx }}' 'CXXFLAGS=-g -O2' "PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig:$(brew --prefix)/opt/libarchive/lib/pkgconfig:$(brew --prefix)/opt/libffi/lib/pkgconfig"
./configure '--disable-shared' '--disable-openmp' '--disable-doc' '--with-pic' 'CXX=${{ matrix.config.cxx }}' 'CXXFLAGS=-g -O2'
- name: Make and Install Tesseract
run: |
Expand Down Expand Up @@ -130,6 +131,9 @@ jobs:
- name: Install Macports
run: |
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci; source ./macports-ci install
# --remove-brew does not remove the Homebrew entries in bin,
# so remove them now.
rm -v $(brew --prefix)/bin/*
- name: Install Dependencies
run: |
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/autotools-openmp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: autotools-openmp
# autotools on Ubuntu - run benchmark test. '--enable-openmp' no training tools
on:
#push:
#schedule:
# - cron: 0 20 * * *
workflow_dispatch:
jobs:

linux:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- { name: 18.04-openmp, os: ubuntu-18.04 }
- { name: 20.04-openmp, os: ubuntu-20.04 }

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- 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: Install dependencies
run: |
sudo apt-get update
sudo apt-get install autoconf libleptonica-dev -y
sudo apt-get install libpango1.0-dev -y
sudo apt-get install cabextract libarchive-dev -y
sudo apt-get install libcurl4-openssl-dev libcurl4 curl -y
- name: Setup Tesseract
run: |
mkdir -p m4
./autogen.sh
- name: Configure Tesseract
run: |
./configure '--disable-shared' '--enable-openmp' '--disable-doc' 'CXX=g++' 'CXXFLAGS=-g -O2'
grep -i OpenMP config.log
- name: Make and Install Tesseract
run: |
make
sudo make install
- name: Setup for Tesseract benchmark using image from issue 263 fifteen times in a list file
run: |
wget -O i263_speed.jpg https://cloud.githubusercontent.com/assets/9968625/13674495/ac261db4-e6ab-11e5-9b4a-ad91d5b4ff87.jpg
printf 'i263_speed.jpg\n%.0s' {1..15} > benchmarks.list
- name: Run Tesseract using image from issue 263 with tessdata_fast
run: |
lscpu
free
g++ --version
tesseract -v
time tesseract benchmarks.list - --tessdata-dir ../tessdata_fast > /dev/null 2>&1
echo "tessdata_fast"
- name: Run Tesseract using image from issue 263 with tessdata_fast and OpenMP Thread Limit
run: |
for lmt in {1..3}; do
time OMP_THREAD_LIMIT=$lmt tesseract benchmarks.list - --tessdata-dir ../tessdata_fast > /dev/null 2>&1 && echo "OMP_THREAD_LIMIT=" $lmt "tessdata_fast"
done
- name: Run Tesseract using image from issue 263 with tessdata_best and OpenMP Thread Limit
run: |
for lmt in {1..3}; do
time OMP_THREAD_LIMIT=$lmt tesseract benchmarks.list - --tessdata-dir ../tessdata_best > /dev/null 2>&1 && echo "OMP_THREAD_LIMIT=" $lmt "tessdata_best"
done
- name: Run Tesseract using image from issue 263 with tessdata and OpenMP Thread Limit
run: |
for lmt in {1..3}; do
time OMP_THREAD_LIMIT=$lmt tesseract benchmarks.list - --tessdata-dir ../tessdata > /dev/null 2>&1 && echo "OMP_THREAD_LIMIT=" $lmt "tessdata"
done
138 changes: 77 additions & 61 deletions .github/workflows/cmake-win64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,138 +5,154 @@ on:
#push:
schedule:
- cron: 0 23 * * *
workflow_dispatch:

env:
ILOC: d:/a/local

jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC - cmake",
os: windows-latest,
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
}

name: cmake-win64
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: ilammy/setup-nasm@v1
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
submodules: recursive

- name: Build and Install leptonica dependencies
shell: cmd
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Setup Instalation Location
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
mkdir ${{env.ILOC}}
- name: Build and Install zlib-ng
shell: cmd
run: |
curl -sSL -o zlib1211.zip https://zlib.net/zlib1211.zip
unzip.exe zlib1211.zip
cd zlib-1.2.11
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
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 lpng1637.zip
unzip.exe -qq 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
- 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
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 giflib-master.zip
unzip -qq 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 -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=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
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 openjpeg
- name: Build and Install webp
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
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
cd jbigkit-2.1
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
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
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
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 clone --depth 1 https://gitlab.com/libtiff/libtiff.git
cd libtiff
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
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 -DBUILD_PROG=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local
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: |
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
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: |
git clone --depth 1 https://github.com/tesseract-ocr/tessconfigs
mkdir d:/a/local/share
move tessconfigs d:/a/local/share
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
set TESSDATA_PREFIX=d:/a/local/share/tessconfigs
set PATH=d:/a/local/bin;%PATH%
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
13 changes: 8 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,26 @@ jobs:
steps:
- name: Install compilers on Linux
run: |
sudo apt-get update
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 libleptonica-dev -y
sudo apt-get install libarchive-dev libcurl4-openssl-dev -y
sudo apt-get install libpango1.0-dev -y
sudo apt-get install cabextract -y
sudo apt-get install ninja-build -y
cmake --version
if: runner.os == 'Linux'

- name: Install dependencies on macOS
run: |
brew install autoconf automake
brew install leptonica
brew install cairo pango icu4c
brew install libarchive
brew install pango
brew install cabextract
brew install ninja
ninja --version
Expand Down Expand Up @@ -147,15 +150,15 @@ jobs:
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
${{ 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 libarchive libcurl) -pthread -std=c++11
./basicapitest
if: runner.os == 'Linux'

- name: Build and run basicapitest (macOS)
run: |
export "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build/inst/lib/pkgconfig/:$PKG_CONFIG_PATH"
export "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build/inst/lib/pkgconfig/:$(brew --prefix)/opt/libarchive/lib/pkgconfig:$(brew --prefix)/Library/Homebrew/os/mac/pkgconfig/11:$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 ` -lcurl -pthread -std=c++11
${{ 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 libarchive libcurl) -pthread -std=c++11
./basicapitest
if: runner.os == 'macOS'

Expand Down
Loading

0 comments on commit a96b2ab

Please sign in to comment.