Update cmake-multi-platform.yml

This commit is contained in:
Sakimotor 2025-03-03 10:08:47 +01:00 committed by GitHub
parent 1d7852d709
commit 73467700c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,21 +1,16 @@
name: CMake on multiple platforms name: CMake with Clang and Ninja
on: on:
push:
pull_request:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build: build:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
build_type: [Release] build_type: [Release, Debug]
c_compiler: [clang, clang-cl]
include: include:
- os: windows-latest - os: windows-latest
c_compiler: clang-cl c_compiler: clang-cl
@ -23,43 +18,35 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
c_compiler: clang c_compiler: clang
cpp_compiler: clang++ cpp_compiler: clang++
exclude:
- os: ubuntu-latest
c_compiler: clang-cl
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
submodules: recursive # Ensure submodules are cloned
- name: Set up Clang-Cl on Windows - name: Install Ninja (Linux)
if: runner.os == 'Windows' if: runner.os == 'Linux'
shell: pwsh run: sudo apt-get update && sudo apt-get install -y ninja-build
run: | shell: bash
echo "Setting up Clang-Cl..."
echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CXX=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "Using Clang Version:"
clang-cl --version
- name: Install Ninja on Windows - name: Install Ninja (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
run: | run: choco install ninja
choco install ninja --no-progress shell: powershell
shell: pwsh
- name: Configure CMake - name: Configure CMake
run: > run: >
cmake -B ${{ github.workspace }}/build cmake -B ${{ github.workspace }}/build
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-G Ninja -G Ninja
-S ${{ github.workspace }} -S ${{ github.workspace }}
shell: bash
- name: Build - name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }} run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }}
shell: bash
- name: Test - name: Test
working-directory: ${{ github.workspace }}/build working-directory: ${{ github.workspace }}/build
run: ctest --build-config ${{ matrix.build_type }} run: ctest --build-config ${{ matrix.build_type }}
shell: bash