From c10b1afd3e766b6b49994e9d563c1bb4e1cd9eec Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Mon, 11 Nov 2024 18:45:37 -0800 Subject: [PATCH] Add GitHub Actions to validate UWP via CMake (#509) --- .github/workflows/main.yml | 20 +------ .github/workflows/uwp.yml | 72 ++++++++++++++++++++++++ .github/workflows/vcpkg.yml | 18 +++++- .github/workflows/win10.yml | 108 ++++++++++++++++++++++++++++++++++++ CMakePresets.json | 60 +++++++++++++------- build/vcpkg.json | 4 -- 6 files changed, 240 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/uwp.yml create mode 100644 .github/workflows/win10.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af5df04..fd5fabc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ # # http://go.microsoft.com/fwlink/?LinkId=248929 -name: 'CMake (Windows)' +name: 'CMake (Windows 8)' on: push: @@ -60,18 +60,6 @@ jobs: - os: windows-2022 build_type: x86-Release-Clang arch: amd64_x86 - - os: windows-2022 - build_type: arm64-Debug - arch: amd64_arm64 - - os: windows-2022 - build_type: arm64-Release - arch: amd64_arm64 - - os: windows-2022 - build_type: arm64ec-Debug - arch: amd64_arm64 - - os: windows-2022 - build_type: arm64ec-Release - arch: amd64_arm64 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -91,12 +79,10 @@ jobs: working-directory: ${{ github.workspace }} run: cmake --build out\build\${{ matrix.build_type }} - - if: matrix.arch != 'amd64_arm64' - name: 'Configure CMake (Spectre)' + - name: 'Configure CMake (Spectre)' working-directory: ${{ github.workspace }} run: cmake --preset=${{ matrix.build_type }} -DENABLE_SPECTRE_MITIGATION=ON - - if: matrix.arch != 'amd64_arm64' - name: 'Build (Spectre)' + - name: 'Build (Spectre)' working-directory: ${{ github.workspace }} run: cmake --build out\build\${{ matrix.build_type }} diff --git a/.github/workflows/uwp.yml b/.github/workflows/uwp.yml new file mode 100644 index 0000000..ef14237 --- /dev/null +++ b/.github/workflows/uwp.yml @@ -0,0 +1,72 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkId=248929 + +name: 'CMake (UWP)' + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths-ignore: + - '*.md' + - LICENSE + - '.nuget/*' + - build/*.cmd + - build/*.json + - build/*.props + - build/*.ps1 + - build/*.targets + - build/*.yml + +permissions: + contents: read + +jobs: + build: + runs-on: windows-2022 + + strategy: + fail-fast: false + + matrix: + build_type: [x64-Debug-UWP, x64-Release-UWP, x64-Debug-UWP-Clang, x64-Release-UWP-Clang] + arch: [amd64] + include: + - build_type: x86-Debug-UWP + arch: amd64_x86 + - build_type: x86-Release-UWP + arch: amd64_x86 + - build_type: x86-Debug-UWP-Clang + arch: amd64_x86 + - build_type: x86-Release-UWP-Clang + arch: amd64_x86 + - build_type: arm64-Debug-UWP + arch: amd64_arm64 + - build_type: arm64-Release-UWP + arch: amd64_arm64 + - build_type: arm64-Debug-UWP-Clang + arch: amd64_arm64 + - build_type: arm64-Release-UWP-Clang + arch: amd64_arm64 + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: 'Install Ninja' + run: choco install ninja + + - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + with: + arch: ${{ matrix.arch }} + uwp: true + + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: cmake --preset=${{ matrix.build_type }} + + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} diff --git a/.github/workflows/vcpkg.yml b/.github/workflows/vcpkg.yml index 8b2fbe8..06ab349 100644 --- a/.github/workflows/vcpkg.yml +++ b/.github/workflows/vcpkg.yml @@ -39,6 +39,15 @@ jobs: - os: windows-2022 build_type: arm64-Debug-VCPKG arch: amd64_arm64 + - os: windows-2022 + build_type: arm64ec-Debug-VCPKG + arch: amd64_arm64 + - os: windows-2022 + build_type: x64-Debug-MinGW + arch: amd64 + - os: windows-2022 + build_type: x64-Release-MinGW + arch: amd64 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -55,7 +64,14 @@ jobs: run: | if ("${{ matrix.arch }}" -eq "amd64") { - echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $env:GITHUB_ENV + if ("${{ matrix.build_type }}" -match "MinGW") + { + echo "VCPKG_DEFAULT_TRIPLET=x64-mingw-static" >> $env:GITHUB_ENV + } + else + { + echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $env:GITHUB_ENV + } } elseif ("${{ matrix.arch }}" -eq "amd64_x86") { diff --git a/.github/workflows/win10.yml b/.github/workflows/win10.yml new file mode 100644 index 0000000..5f998b7 --- /dev/null +++ b/.github/workflows/win10.yml @@ -0,0 +1,108 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkId=248929 + +name: 'CMake (Windows 10/Windows 11)' + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths-ignore: + - '*.md' + - LICENSE + - '.nuget/*' + - build/*.cmd + - build/*.json + - build/*.props + - build/*.ps1 + - build/*.targets + - build/*.yml + +permissions: + contents: read + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [windows-2019, windows-2022] + build_type: [x64-Debug-Win10, x64-Release-Win10] + arch: [amd64] + include: + - os: windows-2019 + build_type: x86-Debug-Win10 + arch: amd64_x86 + - os: windows-2019 + build_type: x86-Release-Win10 + arch: amd64_x86 + - os: windows-2022 + build_type: x86-Debug-Win10 + arch: amd64_x86 + - os: windows-2022 + build_type: x86-Release-Win10 + arch: amd64_x86 + - os: windows-2022 + build_type: arm64-Debug + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64-Release + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64ec-Debug + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64ec-Release + arch: amd64_arm64 + - os: windows-2022 + build_type: x64-Debug-Win10-Clang + arch: amd64 + - os: windows-2022 + build_type: x64-Release-Win10-Clang + arch: amd64 + - os: windows-2022 + build_type: x86-Debug-Win10-Clang + arch: amd64_x86 + - os: windows-2022 + build_type: x86-Release-Win10-Clang + arch: amd64_x86 + - os: windows-2022 + build_type: arm64-Debug-Clang + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64-Release-Clang + arch: amd64_arm64 + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: 'Install Ninja' + run: choco install ninja + + - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + with: + arch: ${{ matrix.arch }} + + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: cmake --preset=${{ matrix.build_type }} + + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} + + - if: matrix.arch != 'amd64_arm64' + name: 'Configure CMake (Spectre)' + working-directory: ${{ github.workspace }} + run: cmake --preset=${{ matrix.build_type }} -DENABLE_SPECTRE_MITIGATION=ON + + - if: matrix.arch != 'amd64_arm64' + name: 'Build (Spectre)' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} diff --git a/CMakePresets.json b/CMakePresets.json index 43e459f..d0dec1f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -45,6 +45,10 @@ "strategy": "external" }, "cacheVariables": { "DIRECTX_ARCH": "arm64ec" }, + "environment": { + "CFLAGS": "/arm64EC", + "CXXFLAGS": "/arm64EC" + }, "hidden": true }, @@ -85,6 +89,22 @@ "strategy": "external" } }, + { + "name": "Clang-X86", + "environment": { + "CFLAGS": "-m32", + "CXXFLAGS": "-m32" + }, + "hidden": true + }, + { + "name": "Clang-AArch64", + "environment": { + "CFLAGS": "--target=arm64-pc-windows-msvc", + "CXXFLAGS": "--target=arm64-pc-windows-msvc" + }, + "hidden": true + }, { "name": "GNUC", "hidden": true, @@ -161,7 +181,7 @@ }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x86-mingw-static", - "VCPKG_HOST_TRIPLET": "x86-mingw-static" + "VCPKG_HOST_TRIPLET": "x64-windows" } }, { @@ -172,7 +192,7 @@ }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-mingw-static", - "VCPKG_HOST_TRIPLET": "x64-mingw-static" + "VCPKG_HOST_TRIPLET": "x64-windows" } }, { @@ -237,8 +257,8 @@ { "name": "arm64-Debug" , "description": "MSVC for ARM64 (Debug) for Windows 10", "inherits": [ "base", "ARM64", "Debug", "MSVC", "Win10" ] }, { "name": "arm64-Release" , "description": "MSVC for ARM64 (Release) for Windows 10", "inherits": [ "base", "ARM64", "Release", "MSVC", "Win10" ] }, - { "name": "arm64ec-Debug" , "description": "MSVC for ARM64EC (Debug) for Windows 10", "inherits": [ "base", "ARM64EC", "Debug", "MSVC", "Win10" ], "environment": { "CXXFLAGS": "/arm64EC" } }, - { "name": "arm64ec-Release" , "description": "MSVC for ARM64EC (Release) for Windows 10", "inherits": [ "base", "ARM64EC", "Release", "MSVC", "Win10" ], "environment": { "CXXFLAGS": "/arm64EC" } }, + { "name": "arm64ec-Debug" , "description": "MSVC for ARM64EC (Debug) for Windows 10", "inherits": [ "base", "ARM64EC", "Debug", "MSVC", "Win10" ] }, + { "name": "arm64ec-Release" , "description": "MSVC for ARM64EC (Release) for Windows 10", "inherits": [ "base", "ARM64EC", "Release", "MSVC", "Win10" ] }, { "name": "x64-Debug-UWP" , "description": "MSVC for x64 (Debug) for UWP", "inherits": [ "base", "x64", "Debug", "MSVC", "UWP" ] }, { "name": "x64-Release-UWP" , "description": "MSVC for x64 (Release) for UWP", "inherits": [ "base", "x64", "Release", "MSVC", "UWP" ] }, @@ -265,38 +285,38 @@ { "name": "arm64-Debug-VCPKG" , "description": "MSVC for ARM64 (Debug) using VCPKG", "inherits": [ "base", "ARM64", "Debug", "MSVC", "VCPKG", "Win10" ] }, { "name": "arm64-Release-VCPKG" , "description": "MSVC for ARM64 (Release) using VCPKG", "inherits": [ "base", "ARM64", "Release", "MSVC", "VCPKG", "Win10" ] }, - { "name": "arm64ec-Debug-VCPKG" , "description": "MSVC for ARM64EC (Debug) using VCPKG", "inherits": [ "base", "ARM64EC", "Debug", "MSVC", "VCPKG", "Win10" ], "environment": { "CXXFLAGS": "/arm64EC" }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, - { "name": "arm64ec-Release-VCPKG", "description": "MSVC for ARM64EC (Release) using VCPKG", "inherits": [ "base", "ARM64EC", "Release", "MSVC", "VCPKG", "Win10" ], "environment": { "CXXFLAGS": "/arm64EC" }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, + { "name": "arm64ec-Debug-VCPKG" , "description": "MSVC for ARM64EC (Debug) using VCPKG", "inherits": [ "base", "ARM64EC", "Debug", "MSVC", "VCPKG", "Win10" ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, + { "name": "arm64ec-Release-VCPKG", "description": "MSVC for ARM64EC (Release) using VCPKG", "inherits": [ "base", "ARM64EC", "Release", "MSVC", "VCPKG", "Win10" ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, { "name": "x64-Debug-Clang" , "description": "Clang/LLVM for x64 (Debug) for Windows 8", "inherits": [ "base", "x64", "Debug", "Clang" ] }, { "name": "x64-Release-Clang" , "description": "Clang/LLVM for x64 (Release) for Windows 8", "inherits": [ "base", "x64", "Release", "Clang" ] }, - { "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 8", "inherits": [ "base", "x86", "Debug", "Clang" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release) for Windows 8", "inherits": [ "base", "x86", "Release", "Clang" ], "environment": { "CXXFLAGS": "-m32" } }, + { "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 8", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86" ] }, + { "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release) for Windows 8", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86" ] }, { "name": "x64-Debug-Win10-Clang" , "description": "Clang/LLVM for x64 (Debug) for Windows 10", "inherits": [ "base", "x64", "Debug", "Clang", "Win10" ] }, { "name": "x64-Release-Win10-Clang" , "description": "Clang/LLVM for x64 (Release) for Windows 10", "inherits": [ "base", "x64", "Release", "Clang", "Win10" ] }, - { "name": "x86-Debug-Win10-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 10", "inherits": [ "base", "x86", "Debug", "Clang", "Win10" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "x86-Release-Win10-Clang" , "description": "Clang/LLVM for x86 (Release) for Windows 10", "inherits": [ "base", "x86", "Release", "Clang", "Win10" ], "environment": { "CXXFLAGS": "-m32" } }, + { "name": "x86-Debug-Win10-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 10", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "Win10" ] }, + { "name": "x86-Release-Win10-Clang" , "description": "Clang/LLVM for x86 (Release) for Windows 10", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "Win10" ] }, - { "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for Windows 10", "inherits": [ "base", "ARM64", "Debug", "Clang", "Win10" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, - { "name": "arm64-Release-Clang" , "description": "Clang/LLVM for AArch64 (Release) for Windows 10", "inherits": [ "base", "ARM64", "Release", "Clang", "Win10" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, + { "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for Windows 10", "inherits": [ "base", "ARM64", "Debug", "Clang", "Clang-AArch64", "Win10" ] }, + { "name": "arm64-Release-Clang" , "description": "Clang/LLVM for AArch64 (Release) for Windows 10", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64", "Win10" ] }, { "name": "x64-Debug-UWP-Clang" , "description": "Clang/LLVM for x64 (Debug) for UWP", "inherits": [ "base", "x64", "Debug", "Clang", "UWP" ] }, { "name": "x64-Release-UWP-Clang" , "description": "Clang/LLVM for x64 (Release) for UWP", "inherits": [ "base", "x64", "Release", "Clang", "UWP" ] }, - { "name": "x86-Debug-UWP-Clang" , "description": "Clang/LLVM for x86 (Debug) for UWP", "inherits": [ "base", "x86", "Debug", "Clang", "UWP" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "x86-Release-UWP-Clang" , "description": "Clang/LLVM for x86 (Release) for UWP", "inherits": [ "base", "x86", "Release", "Clang", "UWP" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "arm64-Debug-UWP-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, - { "name": "arm64-Release-UWP-Clang", "description": "Clang/LLVM for AArch64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, + { "name": "x86-Debug-UWP-Clang" , "description": "Clang/LLVM for x86 (Debug) for UWP", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "UWP" ] }, + { "name": "x86-Release-UWP-Clang" , "description": "Clang/LLVM for x86 (Release) for UWP", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "UWP" ] }, + { "name": "arm64-Debug-UWP-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "Clang", "Clang-AArch64", "UWP" ] }, + { "name": "arm64-Release-UWP-Clang", "description": "Clang/LLVM for AArch64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64", "UWP" ] }, { "name": "x64-Debug-Win7-Clang" , "description": "Clang/LLVM for x64 (Debug) for Windows 7 w/ XAudio2Redist", "inherits": [ "base", "x64", "Debug", "Clang", "Win7", "VCPKG" ] }, { "name": "x64-Release-Win7-Clang", "description": "Clang/LLVM for x64 (Release) for Windows 7 w/ XAudio2Redist", "inherits": [ "base", "x64", "Release", "Clang", "Win7", "VCPKG" ] }, - { "name": "x86-Debug-Win7-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 7 w/ XAudio2Redist", "inherits": [ "base", "x86", "Debug", "Clang", "Win7", "VCPKG" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "x86-Release-Win7-Clang", "description": "Clang/LLVM for x86 (Release) for Windows 7 w/ XAudio2Redist", "inherits": [ "base", "x86", "Release", "Clang", "Win7", "VCPKG" ], "environment": { "CXXFLAGS": "-m32" } }, + { "name": "x86-Debug-Win7-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 7 w/ XAudio2Redist", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "Win7", "VCPKG" ] }, + { "name": "x86-Release-Win7-Clang", "description": "Clang/LLVM for x86 (Release) for Windows 7 w/ XAudio2Redist", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "Win7", "VCPKG" ] }, { "name": "x64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Debug) using VCPKG", "inherits": [ "base", "x64", "Debug", "Clang", "VCPKG" ] }, { "name": "x64-Release-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Release) using VCPKG", "inherits": [ "base", "x64", "Release", "Clang", "VCPKG" ] }, - { "name": "x86-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Debug) using VCPKG", "inherits": [ "base", "x86", "Debug", "Clang", "VCPKG" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "x86-Release-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Release) using VCPKG", "inherits": [ "base", "x86", "Release", "Clang", "VCPKG" ], "environment": { "CXXFLAGS": "-m32" } }, + { "name": "x86-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Debug) using VCPKG", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "VCPKG" ] }, + { "name": "x86-Release-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Release) using VCPKG", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "VCPKG" ] }, { "name": "x64-Debug-GDK-Clang" , "description": "Clang/LLVM for x64 (Debug) with Microsoft GDK", "inherits": [ "base", "x64", "Debug", "Clang", "GDK" ] }, { "name": "x64-Release-GDK-Clang" , "description": "Clang/LLVM for x64 (Release) with Microsoft GDK", "inherits": [ "base", "x64", "Release", "Clang", "GDK" ] }, diff --git a/build/vcpkg.json b/build/vcpkg.json index 12f0ff5..545dcaf 100644 --- a/build/vcpkg.json +++ b/build/vcpkg.json @@ -2,10 +2,6 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "dependencies": [ "directxmath", - { - "name": "directx-dxc", - "host": true - }, "directx-headers", { "name": "xaudio2redist",