From ddf1f807784666e50a8d24ce3bd083e20d2517c4 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 22 Aug 2024 23:49:56 -0700 Subject: [PATCH 1/4] Add VCPKG usage to GitHub Actions --- .github/workflows/main.yml | 14 +++--- .github/workflows/test.yml | 16 ++++--- .github/workflows/vcpkg.yml | 92 +++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/vcpkg.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66c19463..424287bf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: matrix: os: [windows-2019, windows-2022] - build_type: [x64-Debug, x64-Release, x64-Debug-Clang, x64-Release-Clang] + build_type: [x64-Debug, x64-Release] arch: [amd64] include: - os: windows-2019 @@ -37,18 +37,18 @@ jobs: - os: windows-2019 build_type: x86-Release arch: amd64_x86 - - os: windows-2019 - build_type: x86-Debug-Clang - arch: amd64_x86 - - os: windows-2019 - build_type: x86-Release-Clang - arch: amd64_x86 - os: windows-2022 build_type: x86-Debug arch: amd64_x86 - os: windows-2022 build_type: x86-Release arch: amd64_x86 + - os: windows-2022 + build_type: x64-Debug-Clang + arch: amd64 + - os: windows-2022 + build_type: x64-Release-Clang + arch: amd64 - os: windows-2022 build_type: x86-Debug-Clang arch: amd64_x86 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33e33dd8..c3856cd3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: matrix: os: [windows-2019, windows-2022] - build_type: [x64-Debug, x64-Release, x64-Debug-Clang, x64-Release-Clang] + build_type: [x64-Debug, x64-Release] arch: [amd64] include: - os: windows-2019 @@ -54,6 +54,12 @@ jobs: - os: windows-2022 build_type: x86-Release arch: amd64_x86 + - os: windows-2022 + build_type: x64-Debug-Clang + arch: amd64 + - os: windows-2022 + build_type: x64-Release-Clang + arch: amd64 - os: windows-2022 build_type: x86-Debug-Clang arch: amd64_x86 @@ -72,10 +78,6 @@ jobs: - os: windows-2022 build_type: arm64ec-Release arch: amd64_arm64 - exclude: - # Exclude failing case due to linker issue. - - os: windows-2022 - build_type: x64-Debug-Clang steps: - uses: actions/checkout@v4 @@ -125,13 +127,13 @@ jobs: with: runVcpkgInstall: true vcpkgJsonGlob: '**/build/vcpkg.json' - vcpkgGitCommitId: 'cacf5994341f27e9a14a7b8724b0634b138ecb30' + vcpkgGitCommitId: '7516a02de04e8f8ff4e4beb8f5bac0565f9bf9da' - name: 'Configure CMake' working-directory: ${{ github.workspace }} shell: pwsh run: > - cmake --preset=${{ matrix.build_type }} -DBUILD_TOOLS=ON -DBUILD_TESTING=ON + cmake --preset=${{ matrix.build_type }} -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_MANIFEST_DIR="${{ github.workspace }}/build" -DVCPKG_TARGET_TRIPLET="${env:VCPKG_DEFAULT_TRIPLET}" diff --git a/.github/workflows/vcpkg.yml b/.github/workflows/vcpkg.yml new file mode 100644 index 00000000..815dfc12 --- /dev/null +++ b/.github/workflows/vcpkg.yml @@ -0,0 +1,92 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkID=512686 + +name: 'CMake (Windows using VCPKG)' + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths-ignore: + - '*.md' + - LICENSE + - build/* + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [windows-2019, windows-2022] + build_type: [x64-Debug-VCPKG] + arch: [amd64] + include: + - os: windows-2022 + build_type: x64-Debug-Clang-VCPKG + arch: amd64 + - os: windows-2022 + build_type: x86-Debug-VCPKG + arch: amd64_x86 + - os: windows-2022 + build_type: arm64-Debug-VCPKG + arch: amd64_arm64 + + steps: + - uses: actions/checkout@v4 + + - name: 'Install Ninja' + run: choco install ninja + + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + + - name: 'Set triplet' + shell: pwsh + run: | + if ("${{ matrix.arch }}" -eq "amd64") + { + echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $env:GITHUB_ENV + } + elseif ("${{ matrix.arch }}" -eq "amd64_x86") + { + echo "VCPKG_DEFAULT_TRIPLET=x86-windows" >> $env:GITHUB_ENV + } + elseif ("${{ matrix.arch }}" -eq "amd64_arm64") + { + if ("${{ matrix.build_type }}" -match "^arm64ec") + { + echo "VCPKG_DEFAULT_TRIPLET=arm64ec-windows" >> $env:GITHUB_ENV + } + else + { + echo "VCPKG_DEFAULT_TRIPLET=arm64-windows" >> $env:GITHUB_ENV + } + } + else + { + echo "::error Unknown architecture/build-type triplet mapping" + } + + - uses: lukka/run-vcpkg@v11 + with: + runVcpkgInstall: true + vcpkgJsonGlob: '**/build/vcpkg.json' + vcpkgGitCommitId: '7516a02de04e8f8ff4e4beb8f5bac0565f9bf9da' + + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: > + cmake --preset=${{ matrix.build_type }} -DBUILD_TESTING=OFF -DBUILD_TOOLS=ON -DENABLE_USE_EIGEN=ON + -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_MANIFEST_DIR="${{ github.workspace }}/build" + -DVCPKG_TARGET_TRIPLET="${env:VCPKG_DEFAULT_TRIPLET}" + + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} From a46a6483c291fe2ea0a0c8be5923d4438b0dc60d Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Fri, 23 Aug 2024 00:07:14 -0700 Subject: [PATCH 2/4] Update presets --- CMakePresets.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 4101284d..9efd759b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -228,12 +228,12 @@ { "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": "x64-Debug-VCPKG-Clang" , "description": "Clang/LLVM for x64 (Debug) uvatlastool", "inherits": [ "base", "x64", "Debug", "VCPKG", "Clang", "Tools" ] }, - { "name": "x64-Release-VCPKG-Clang" , "description": "Clang/LLVM for x64 (Release) uvatlastool", "inherits": [ "base", "x64", "Release", "VCPKG", "Clang", "Tools" ] }, - { "name": "x86-Debug-VCPKG-Clang" , "description": "Clang/LLVM for x86 (Debug) uvatlastool", "inherits": [ "base", "x86", "Debug", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "x86-Release-VCPKG-Clang" , "description": "Clang/LLVM for x86 (Release) uvatlastool", "inherits": [ "base", "x86", "Release", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "arm64-Debug-VCPKG-Clang" , "description": "Clang/LLVM for AArch64 (Debug) uvatlastool", "inherits": [ "base", "ARM64", "Debug", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, - { "name": "arm64-Release-VCPKG-Clang", "description": "Clang/LLVM for AArch64 (Release) uvatlastool", "inherits": [ "base", "ARM64", "Release", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, + { "name": "x64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Debug) uvatlastool", "inherits": [ "base", "x64", "Debug", "VCPKG", "Clang", "Tools" ] }, + { "name": "x64-Release-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Release) uvatlastool", "inherits": [ "base", "x64", "Release", "VCPKG", "Clang", "Tools" ] }, + { "name": "x86-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Debug) uvatlastool", "inherits": [ "base", "x86", "Debug", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "-m32" } }, + { "name": "x86-Release-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Release) uvatlastool", "inherits": [ "base", "x86", "Release", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "-m32" } }, + { "name": "arm64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for AArch64 (Debug) uvatlastool", "inherits": [ "base", "ARM64", "Debug", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, + { "name": "arm64-Release-Clang-VCPKG", "description": "Clang/LLVM for AArch64 (Release) uvatlastool", "inherits": [ "base", "ARM64", "Release", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, { "name": "x64-Debug-Scarlett-Clang" , "description": "Clang/LLVM for x64 (Debug) for Xbox Series X|S", "inherits": [ "base", "x64", "Debug", "Clang", "Scarlett" ] }, { "name": "x64-Release-Scarlett-Clang", "description": "Clang/LLVM for x64 (Release) for Xbox Series X|S", "inherits": [ "base", "x64", "Release", "Clang", "Scarlett" ] }, From 2a1fa5d0f23819bb0599eae7d74644165b78b5b7 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Fri, 23 Aug 2024 00:16:37 -0700 Subject: [PATCH 3/4] Remove failing cases --- .github/workflows/test.yml | 8 +++++--- .github/workflows/vcpkg.yml | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3856cd3..9c8a19e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,9 +54,6 @@ jobs: - os: windows-2022 build_type: x86-Release arch: amd64_x86 - - os: windows-2022 - build_type: x64-Debug-Clang - arch: amd64 - os: windows-2022 build_type: x64-Release-Clang arch: amd64 @@ -78,6 +75,11 @@ jobs: - os: windows-2022 build_type: arm64ec-Release arch: amd64_arm64 + exclude: + # Exclude failing case due to linker issue. + - os: windows-2022 + build_type: x64-Debug-Clang + arch: amd64 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/vcpkg.yml b/.github/workflows/vcpkg.yml index 815dfc12..0e6ecbd0 100644 --- a/.github/workflows/vcpkg.yml +++ b/.github/workflows/vcpkg.yml @@ -27,15 +27,17 @@ jobs: build_type: [x64-Debug-VCPKG] arch: [amd64] include: - - os: windows-2022 - build_type: x64-Debug-Clang-VCPKG - arch: amd64 - os: windows-2022 build_type: x86-Debug-VCPKG arch: amd64_x86 - os: windows-2022 build_type: arm64-Debug-VCPKG arch: amd64_arm64 + exclude: + # Exclude failing case due to linker issue. + - os: windows-2022 + build_type: x64-Debug-Clang-VCPKG + arch: amd64 steps: - uses: actions/checkout@v4 From b5b59da231d102fbee7ee8ceeb11247f3bb4e274 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Fri, 23 Aug 2024 01:16:58 -0700 Subject: [PATCH 4/4] VCPKG adds /external:W0 which results in more warnings --- build/CompilerAndLinker.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/CompilerAndLinker.cmake b/build/CompilerAndLinker.cmake index 8950d5ca..1826feb8 100644 --- a/build/CompilerAndLinker.cmake +++ b/build/CompilerAndLinker.cmake @@ -136,7 +136,8 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") list(APPEND COMPILER_SWITCHES /Zc:lambda) endif() - if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29) + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29) + AND (NOT VCPKG_TOOLCHAIN)) list(APPEND COMPILER_SWITCHES /external:W4) endif()