Skip to content

Commit c590cb9

Browse files
authored
use clang-cl for Windows (instead of clang)
1 parent 67d6019 commit c590cb9

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

.github/workflows/cmake.yml

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,7 @@ jobs:
2222
- name: Check formatting
2323
run: |
2424
git fetch --depth=1 origin master
25-
FILES=$(git ls-files '*.cpp' '*.hpp' '*.h' '*.ixx')
26-
if [ -n "$FILES" ]; then
27-
clang-format -style=file -output-replacements-xml $FILES | grep "<replacement " >/dev/null \
28-
&& { echo "Code is not properly formatted"; exit 1; } \
29-
|| echo "All good"
30-
else
31-
echo "No files to format"
32-
fi
25+
clang-format -style=file -output-replacements-xml $(git ls-files '*.cpp' '*.h' '*.ixx' '*.hpp') | grep "<replacement " && echo "Code is not properly formatted" && exit 1 || echo "All good"
3326
3427
build:
3528
name: Build project
@@ -62,30 +55,30 @@ jobs:
6255
fi
6356
shell: bash
6457

65-
- name: Configure (Ubuntu + clang)
66-
if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang'
58+
- name: Configure CMake
6759
run: |
6860
mkdir build
6961
cd build
70-
cmake -G Ninja -DCMAKE_CXX_COMPILER=clang++ ..
62+
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
63+
if [ "${{ matrix.compiler }}" == "clang" ]; then
64+
cmake -G Ninja -DCMAKE_CXX_COMPILER=clang++ ..
65+
fi
66+
elif [ "${{ matrix.os }}" == "windows-latest" ]; then
67+
if [ "${{ matrix.compiler }}" == "msvc" ]; then
68+
# Force the real MSVC toolset (cl.exe)
69+
cmake -G "Visual Studio 17 2022" -A x64 ..
70+
elif [ "${{ matrix.compiler }}" == "clang" ]; then
71+
# Explicit clang-cl on Windows
72+
cmake -G Ninja -DCMAKE_CXX_COMPILER=clang-cl ..
73+
fi
74+
fi
7175
shell: bash
7276

73-
- name: Configure (Windows + msvc)
74-
if: matrix.os == 'windows-latest' && matrix.compiler == 'msvc'
75-
run: |
76-
mkdir build
77-
cd build
78-
cmake -G "Visual Studio 17 2022" -A x64 ..
79-
shell: pwsh
80-
81-
- name: Configure (Windows + clang)
82-
if: matrix.os == 'windows-latest' && matrix.compiler == 'clang'
83-
run: |
84-
mkdir build
85-
cd build
86-
cmake -G Ninja -DCMAKE_CXX_COMPILER=clang++ ..
87-
shell: pwsh
88-
8977
- name: Build
90-
run: cmake --build build --config Release
78+
run: |
79+
if [ "${{ matrix.os }}" == "windows-latest" ] && [ "${{ matrix.compiler }}" == "msvc" ]; then
80+
cmake --build build --config Release
81+
else
82+
cmake --build build --config Release
83+
fi
9184
shell: bash

0 commit comments

Comments
 (0)