From 41a40999689593e03374a35b8cf247006425780a Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 16 Jun 2023 23:14:03 +0200 Subject: [PATCH] Use a different MSVC version (#3347) --- .github/templates/test-weaver.yml | 2 +- .github/templates/wrappers.yml | 14 +++++++++++--- .github/workflows/test-weaver.yml | 2 +- .github/workflows/wrappers.yml | 14 ++++++++++++-- wrappers/build.ps1 | 9 ++++++--- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/templates/test-weaver.yml b/.github/templates/test-weaver.yml index 8552a8806f..e523536ab7 100644 --- a/.github/templates/test-weaver.yml +++ b/.github/templates/test-weaver.yml @@ -22,7 +22,7 @@ jobs: runtime: osx-x64 runs-on: ${{ matrix.os.runner }} name: Weaver - timeout-minutes: 15 + timeout-minutes: 30 steps: - #@ template.replace(checkoutCode()) - #@ setupWorkloads("android ${{ (matrix.os.runner != 'ubuntu-latest' && 'tvos ios maccatalyst') || '' }}") diff --git a/.github/templates/wrappers.yml b/.github/templates/wrappers.yml index 24fb93c3dd..3d3ffcd51c 100644 --- a/.github/templates/wrappers.yml +++ b/.github/templates/wrappers.yml @@ -27,7 +27,15 @@ with: path: #@ "./" + path key: #@ key #@ end - +--- +#@ def setupMSVC(): + - name: Setup MSVC + run: | + Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" --quiet --add Microsoft.VisualStudio.Component.VC.14.35.17.5.${{ startswith(matrix.arch, 'ARM') && matrix.arch || 'x86.x64' }}' -Wait -PassThru + shell: pwsh + if: #@ wrappersCacheCondition +#@ end +--- #@ def buildWrappers(cmd, outputVar, intermediateSteps = [], enableLto = True, artifactsPath = "wrappers/build/**", cacheVariable = ""): #@ if cacheVariable == "": #@ cacheVariable = outputVar @@ -135,7 +143,7 @@ jobs: strategy: matrix: arch: #@ windowsArchs - _: #@ template.replace(buildWrappers("pwsh ./wrappers/build.ps1 Windows -Platforms ${{ matrix.arch }}", "wrappers-windows-${{ matrix.arch }}", cacheVariable = "wrappers-windows")) + _: #@ template.replace(buildWrappers("pwsh ./wrappers/build.ps1 Windows -Platforms ${{ matrix.arch }} -ExtraCMakeArgs \"-T v143,version=14.35\"", "wrappers-windows-${{ matrix.arch }}", cacheVariable = "wrappers-windows", intermediateSteps = [setupMSVC()])) #@yaml/map-key-override if: #@ " || ".join([ "needs.check-cache.outputs.wrappers-windows-" + x + " != 'true'" for x in windowsArchs ]) uwp: @@ -144,6 +152,6 @@ jobs: strategy: matrix: arch: #@ windowsUWPArchs - _: #@ template.replace(buildWrappers("pwsh ./wrappers/build.ps1 WindowsStore -Platforms ${{ matrix.arch }}", "wrappers-windows-uwp-${{ matrix.arch }}", cacheVariable = "wrappers-uwp")) + _: #@ template.replace(buildWrappers("pwsh ./wrappers/build.ps1 WindowsStore -Platforms ${{ matrix.arch }} -ExtraCMakeArgs \"-T v143,version=14.35\"", "wrappers-windows-uwp-${{ matrix.arch }}", cacheVariable = "wrappers-uwp", intermediateSteps = [setupMSVC()])) #@yaml/map-key-override if: #@ " || ".join([ "needs.check-cache.outputs.wrappers-windows-uwp-" + x + " != 'true'" for x in windowsUWPArchs ]) diff --git a/.github/workflows/test-weaver.yml b/.github/workflows/test-weaver.yml index eaba7939fc..54f3e53f0e 100755 --- a/.github/workflows/test-weaver.yml +++ b/.github/workflows/test-weaver.yml @@ -17,7 +17,7 @@ jobs: runtime: osx-x64 runs-on: ${{ matrix.os.runner }} name: Weaver - timeout-minutes: 15 + timeout-minutes: 30 steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/.github/workflows/wrappers.yml b/.github/workflows/wrappers.yml index b70b3a5950..fe45ebe2c2 100755 --- a/.github/workflows/wrappers.yml +++ b/.github/workflows/wrappers.yml @@ -583,8 +583,13 @@ jobs: with: path: ./wrappers/build/** key: wrappers-windows-${{ matrix.arch }}-Release-${{hashFiles('./wrappers/**')}} + - name: Setup MSVC + run: | + Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" --quiet --add Microsoft.VisualStudio.Component.VC.14.35.17.5.${{ startswith(matrix.arch, 'ARM') && matrix.arch || 'x86.x64' }}' -Wait -PassThru + shell: pwsh + if: steps.check-cache.outputs.cache-hit != 'true' - name: Build wrappers - run: pwsh ./wrappers/build.ps1 Windows -Platforms ${{ matrix.arch }} -Configuration Release -EnableLTO + run: pwsh ./wrappers/build.ps1 Windows -Platforms ${{ matrix.arch }} -ExtraCMakeArgs "-T v143,version=14.35" -Configuration Release -EnableLTO if: steps.check-cache.outputs.cache-hit != 'true' - name: Store artifacts for wrappers-windows-${{ matrix.arch }} uses: actions/upload-artifact@v3 @@ -619,8 +624,13 @@ jobs: with: path: ./wrappers/build/** key: wrappers-windows-uwp-${{ matrix.arch }}-Release-${{hashFiles('./wrappers/**')}} + - name: Setup MSVC + run: | + Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" --quiet --add Microsoft.VisualStudio.Component.VC.14.35.17.5.${{ startswith(matrix.arch, 'ARM') && matrix.arch || 'x86.x64' }}' -Wait -PassThru + shell: pwsh + if: steps.check-cache.outputs.cache-hit != 'true' - name: Build wrappers - run: pwsh ./wrappers/build.ps1 WindowsStore -Platforms ${{ matrix.arch }} -Configuration Release -EnableLTO + run: pwsh ./wrappers/build.ps1 WindowsStore -Platforms ${{ matrix.arch }} -ExtraCMakeArgs "-T v143,version=14.35" -Configuration Release -EnableLTO if: steps.check-cache.outputs.cache-hit != 'true' - name: Store artifacts for wrappers-windows-uwp-${{ matrix.arch }} uses: actions/upload-artifact@v3 diff --git a/wrappers/build.ps1 b/wrappers/build.ps1 index 62af6f5ea8..8b662858e0 100644 --- a/wrappers/build.ps1 +++ b/wrappers/build.ps1 @@ -19,12 +19,14 @@ param( [string[]]$Platforms = ('Win32'), [ValidateSet('Windows', 'WindowsStore')] - [Parameter(Position=0)] + [Parameter(Position = 0)] [string]$Target = 'Windows', [Switch]$Incremental, - [Switch]$EnableLTO + [Switch]$EnableLTO, + + [string]$ExtraCMakeArgs = '' ) Push-Location $PSScriptRoot @@ -72,8 +74,9 @@ foreach ($platform in $Platforms) { } New-Item .\cmake\$Target\$Configuration-$platform -ItemType "Directory" | Out-Null Push-Location .\cmake\$Target\$Configuration-$platform + if (-Not $Incremental) { - & $cmake $PSScriptRoot $cmakeArgs -DCMAKE_GENERATOR_PLATFORM="$platform" + & $cmake $PSScriptRoot $cmakeArgs -DCMAKE_GENERATOR_PLATFORM="$platform" $ExtraCMakeArgs } & $cmake --build . --target install --config $Configuration