From 5ca0581da2a08daa56b10754ef2f02c621c1bc99 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Sat, 16 Sep 2023 16:32:09 +0200 Subject: [PATCH] Add test matrix for ninja + cl / clang-cl --- .github/workflows/test.yaml | 55 +++++++++++++++++++++++++++++++++++++ CMakePresets.json | 32 +++++++++------------ 2 files changed, 68 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bd019821..fc7f8ade 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -180,6 +180,61 @@ jobs: working-directory: build run: ctest --output-on-failure --build-config Debug -j 3 + windows_ninja_cl: + name: Test Windows Visual Studio + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - windows-2022 + arch: + - x86_64 + - i686 + - aarch64 + compiler: + - cl + - clang-cl + include: + - os: windows-2022 + vs_version: vs-2022 + cmake: 3.22.6 + - rust: 1.54.0 + # Override rust version for x86_64 + - arch: x86_64 + rust: 1.46.0 + # Add variable mapping for ilammy/msvc-dev-cmd action + - arch: x86_64 + msvc_dev_arch: amd64 + - arch: i686 + msvc_dev_arch: amd64_x86 + - arch: aarch64 + msvc_dev_arch: amd64_arm64 + + steps: + - uses: actions/checkout@v4 + - name: Install CMake + uses: corrosion-rs/install-cmake@v2 + with: + cmake: ${{ matrix.cmake }} + ninja: 1.10.0 + - name: Install Rust + id: install_rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{matrix.rust}} + targets: ${{matrix.arch}}-pc-windows-msvc + - name: Setup MSVC Development Environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.msvc_dev_arch }} + if: matrix.compiler == 'cl' + - name: New configure + run: cmake -S. -Bbuild "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "ninja-${{ matrix.arch }}-pc-windows-msvc-${{ matrix.compiler }}" + - name: Run Tests + working-directory: build + run: ctest --output-on-failure --build-config Debug -j 3 + # test_cxxbridge: # name: Test cxxbridge integration # runs-on: ${{ matrix.os }} diff --git a/CMakePresets.json b/CMakePresets.json index f5659645..73c4b362 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -132,32 +132,30 @@ "inherits": ["vs-platform-arm64", "vs-2022"] }, { - "name": "_compiler", + "name": "clang", "hidden": true, "cacheVariables": { - "CMAKE_C_COMPILER": "${presetName}", - "CMAKE_CXX_COMPILER": "${presetName}" + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++" } }, - { - "name": "clang", - "hidden": true, - "inherits": ["_compiler"] - }, { "name": "clang-cl", "hidden": true, - "inherits": ["_compiler"] + "inherits": ["windows-only"], + "cacheVariables": { + "CMAKE_C_COMPILER": "clang-cl", + "CMAKE_CXX_COMPILER": "clang-cl" + } }, { "name": "cl", "hidden": true, - "inherits": ["_compiler"] - }, - { - "name": "gcc", - "hidden": true, - "inherits": ["_compiler"] + "inherits": ["windows-only"], + "cacheVariables": { + "CMAKE_C_COMPILER": "cl", + "CMAKE_CXX_COMPILER": "cl" + } }, { "name": "ninja-x86_64-pc-windows-msvc-cl", @@ -170,10 +168,6 @@ { "name": "ninja-x86_64-pc-windows-gnu-clang", "inherits": ["ninja", "x86_64-pc-windows-gnu", "clang"] - }, - { - "name": "ninja-x86_64-pc-windows-gnu-gcc", - "inherits": ["ninja", "x86_64-pc-windows-gnu", "gcc"] } ] }