From 4335e553596a0ad5b136d3aa9fc898c906d226b4 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:40:46 +0000 Subject: [PATCH 1/3] ci: Run vcpkg with path prefix The GHA VS installation includes its own vcpkg package manager, which is available since VS 17.6. This change avoids any ambiguity about which copy of vcpkg we run. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1381d8a23e5..d2e609cd312 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -279,7 +279,7 @@ jobs: run: | Set-Location "$env:VCPKG_INSTALLATION_ROOT" Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)" - vcpkg --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install + .\vcpkg.exe --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install git rev-parse HEAD | Out-File -FilePath "$env:GITHUB_WORKSPACE\vcpkg_commit" Get-Content -Path "$env:GITHUB_WORKSPACE\vcpkg_commit" From 1a889f7ea043fc61865511a0d143321bbdc540a5 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:47:28 +0000 Subject: [PATCH 2/3] ci: Set MSVC toolset version explicitly This change avoids toolset incompatibilities that cause linker errors. --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2e609cd312..9419a0f19ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -197,6 +197,8 @@ jobs: run: | msbuild -version | Out-File -FilePath "$env:GITHUB_WORKSPACE\msbuild_version" Get-Content -Path "$env:GITHUB_WORKSPACE\msbuild_version" + $env:VCToolsVersion | Out-File -FilePath "$env:GITHUB_WORKSPACE\toolset_version" + Get-Content -Path "$env:GITHUB_WORKSPACE\toolset_version" $env:CI_QT_URL | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_url" $env:CI_QT_CONF | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_conf" @@ -279,6 +281,7 @@ jobs: run: | Set-Location "$env:VCPKG_INSTALLATION_ROOT" Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)" + Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_PLATFORM_TOOLSET_VERSION $env:VCToolsVersion)" .\vcpkg.exe --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install git rev-parse HEAD | Out-File -FilePath "$env:GITHUB_WORKSPACE\vcpkg_commit" Get-Content -Path "$env:GITHUB_WORKSPACE\vcpkg_commit" @@ -293,7 +296,7 @@ jobs: uses: actions/cache@v3 with: path: ~/AppData/Local/vcpkg/archives - key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('vcpkg_commit', 'msbuild_version', 'build_msvc/vcpkg.json') }} + key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('vcpkg_commit', 'msbuild_version', 'toolset_version', 'build_msvc/vcpkg.json') }} - name: Generate project files run: py -3 build_msvc\msvc-autogen.py From 70100f8584c762cbc6cbc09d05cc4e9d22a3ec75 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:47:49 +0000 Subject: [PATCH 3/3] Revert "ci: Avoid toolset ambiguity that MSVC can't handle" This reverts commit 91d5bd8ac9a28725c735f8e6900bc85673bb190a. --- .github/workflows/ci.yml | 49 ---------------------------------------- 1 file changed, 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9419a0f19ab..cdf8e8e6c5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,55 +138,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Fix Visual Studio installation - # Avoid toolset ambiguity that MSVC can't handle. - run: | - Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" - $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" - $componentsToRemove= @( - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM.Spectre" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM64.Spectre" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM64" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM.Spectre" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM64.Spectre" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM64" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.Spectre" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM.Spectre" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM64.Spectre" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM64" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.Spectre" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.x86.x64.Spectre" - "Microsoft.VisualStudio.Component.VC.14.37.17.7.x86.x64" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM.Spectre" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM64" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM64.Spectre" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM.Spectre" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM64" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM64.Spectre" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.Spectre" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM.Spectre" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM64" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM64.Spectre" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.Spectre" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64" - "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64.Spectre" - ) - [string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_} - $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache') - # should be run twice - $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden - $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden - - name: Configure Developer Command Prompt for Microsoft Visual C++ # Using microsoft/setup-msbuild is not enough. uses: ilammy/msvc-dev-cmd@v1