Added: CI mingw build #56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CMake on multiple platforms | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| build_type: [Release] | |
| c_compiler: [gcc, clang, cl, x86_64-w64-mingw32-gcc] | |
| include: | |
| - os: windows-latest | |
| c_compiler: cl | |
| cpp_compiler: cl | |
| exe_suffix: .exe | |
| mingw: false | |
| - os: ubuntu-latest | |
| c_compiler: gcc | |
| cpp_compiler: g++ | |
| exe_suffix: "" | |
| mingw: false | |
| - os: ubuntu-latest | |
| c_compiler: clang | |
| cpp_compiler: clang++ | |
| exe_suffix: "" | |
| mingw: false | |
| - os: ubuntu-latest | |
| c_compiler: x86_64-w64-mingw32-gcc | |
| cpp_compiler: x86_64-w64-mingw32-g++ | |
| exe_suffix: .exe | |
| mingw: true | |
| exclude: | |
| - os: windows-latest | |
| c_compiler: gcc | |
| - os: windows-latest | |
| c_compiler: clang | |
| - os: windows-latest | |
| c_compiler: x86_64-w64-mingw32-gcc | |
| - os: ubuntu-latest | |
| c_compiler: cl | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install MinGW (only if mingw is true) | |
| if: matrix.mingw == true | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y mingw-w64 | |
| - name: Update submodules | |
| run: git submodule update --init --recursive --depth 1 | |
| - name: Set build directory | |
| id: vars | |
| run: echo "dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
| - name: Configure CMake | |
| run: > | |
| cmake -S . -B ${{ github.workspace }}/build | |
| -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | |
| -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| ${{ matrix.mingw && '-DCMAKE_TOOLCHAIN_FILE=mingw-w64-x86_64.cmake' || '' }} | |
| - name: Build | |
| run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }} | |
| - name: Run tests | |
| if: matrix.mingw == false | |
| working-directory: >- | |
| ${{ github.workspace }}/build/Example${{ | |
| matrix.os == 'windows-latest' && format('/{0}', matrix.build_type) || '' | |
| }} | |
| run: ./ImageLoaderExample${{ matrix.exe_suffix }} |