diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml new file mode 100644 index 0000000..4d2ef25 --- /dev/null +++ b/.github/workflows/cmake-multi-platform.yml @@ -0,0 +1,52 @@ +name: CMake Build Pipeline + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + build_type: [Release] + include: + - os: windows-latest + c_compiler: cl + cpp_compiler: cl + # Windows (MSVC) puts the .exe in a subfolder named after the build type + bin_path: ./Release/TestApp.exe + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + # Linux (GCC) puts the binary directly in the build folder with no extension + bin_path: ./TestApp + + steps: + - uses: actions/checkout@v4 + + - name: Install Dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libopencv-dev libtesseract-dev libleptonica-dev + + - name: Configure CMake + run: > + cmake -B build + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S . + + - name: Build + run: cmake --build build --config ${{ matrix.build_type }} + + - name: Test + working-directory: ${{ github.workspace }}/build + # This now uses the correct path defined in your matrix above! + run: ${{ matrix.bin_path }}