# 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: jobs: build: name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} strategy: fail-fast: True matrix: config: - { name: "Windows Latest MSVC - cmake", artifact: "Windows-MSVC", os: windows-latest, cc: "cl", cxx: "cl", environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" } steps: - name: Checkout code uses: actions/checkout@v2 with: submodules: recursive - name: Build and Install leptonica dependencies shell: cmd 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 shell: cmd run: | curl -sSL -o zlib1212.zip https://zlib.net/zlib1212.zip unzip.exe zlib1212.zip cd zlib-1.2.12 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 libpng shell: cmd run: | curl -sSL -o lpng1637.zip https://download.sourceforge.net/libpng/lpng1637.zip unzip.exe 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 -DWEBP_BUILD_ANIM_UTILS =OFF # cmake --build build --config Release --target install - 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 cd giflib-master 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 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 --build build --config Release --target install - name: Build and Install openjpeg 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 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 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 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=d:/a/local -DCMAKE_INSTALL_PREFIX=d:/a/local 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 cmake --build build --config Release --target install - 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 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% tesseract -v tesseract --list-langs tesseract test/testing/phototest.tif - - name: Upload Build Results uses: actions/upload-artifact@v2 with: name: tesseract-cmake-win64 # path: d:/a/local retention-days: 5 - name: Download a Build Artifact uses: actions/download-artifact@v3.0.0 with: # Artifact name name: # optional # Destination path path: # optional