Skip to content

Commit 584c744

Browse files
authored
Merge pull request #1 from lukka/azure-pipeline
add an azure pipeline build definition for the MSVC STL, with caching of vcpkg artifacts
2 parents 7f65140 + 083af1a commit 584c744

File tree

6 files changed

+140
-0
lines changed

6 files changed

+140
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vcpkg"]
2+
path = vcpkg
3+
url = https://github.com/microsoft/vcpkg.git

ado/install_msvc_preview.ps1

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
$ErrorActionPreference = "Stop"
2+
3+
Function InstallVS
4+
{
5+
# Microsoft hosted agents do not have the required MSVC 14.23 for building MSVC STL.
6+
# This step installs MSVC 14.23, only on Microsoft hosted agents.
7+
8+
Param(
9+
[String]$WorkLoads,
10+
[String]$Sku,
11+
[String]$VSBootstrapperURL)
12+
$exitCode = -1
13+
try
14+
{
15+
Write-Host "Downloading bootstrapper ..."
16+
[string]$bootstrapperExe = Join-Path ${env:Temp} ([System.IO.Path]::GetRandomFileName() + ".exe")
17+
Invoke-WebRequest -Uri $VSBootstrapperURL -OutFile $bootstrapperExe
18+
19+
$Arguments = ('/c', $bootstrapperExe, $WorkLoads, '--quiet', '--norestart', '--wait', '--nocache' )
20+
21+
Write-Host "Starting Install: $Arguments"
22+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru
23+
$exitCode = $process.ExitCode
24+
25+
if ($exitCode -eq 0 -or $exitCode -eq 3010)
26+
{
27+
Write-Host -Object 'Installation successful!'
28+
}
29+
else
30+
{
31+
Write-Host -Object "Non zero exit code returned by the installation process : $exitCode."
32+
}
33+
}
34+
catch
35+
{
36+
Write-Host -Object "Failed to install Visual Studio!"
37+
Write-Host -Object $_.Exception.Message
38+
exit $exitCode
39+
}
40+
41+
exit $exitCode
42+
}
43+
44+
# Invalidate the standard installation of VS on the hosted agent.
45+
Move-Item "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/" "C:/Program Files (x86)/Microsoft Visual Studio/2019/nouse/" -Verbose
46+
47+
$WorkLoads = '--add Microsoft.VisualStudio.Component.UWP.VC.ARM64 ' + `
48+
'--add Microsoft.VisualStudio.Component.VC.CLI.Support ' + `
49+
'--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ' + `
50+
'--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ' + `
51+
'--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre ' + `
52+
'--add Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest ' + `
53+
'--add Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest ' + `
54+
'--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ' + `
55+
'--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ' + `
56+
'--add Microsoft.VisualStudio.Component.VC.Tools.ARM ' + `
57+
'--add Microsoft.VisualStudio.Component.Windows10SDK.18362 '
58+
59+
$ReleaseInPath = 'Preview'
60+
$Sku = 'Enterprise'
61+
$VSBootstrapperURL = 'https://aka.ms/vs/16/pre/vs_buildtools.exe'
62+
63+
$ErrorActionPreference = 'Stop'
64+
65+
# Install VS
66+
$exitCode = InstallVS -WorkLoads $WorkLoads -Sku $Sku -VSBootstrapperURL $VSBootstrapperURL
67+
68+
exit $exitCode

ado/run_build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
parameters:
2+
targetPlatform: 'x64'
3+
4+
jobs:
5+
- job: vs2019_hosted_${{ parameters.targetPlatform }}
6+
pool:
7+
name: Hosted Windows 2019 with VS2019
8+
#name: Default
9+
10+
variables:
11+
vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg'
12+
vcpkgResponseFile: $(Build.SourcesDirectory)/vcpkg_windows.txt
13+
steps:
14+
- checkout: self
15+
submodules: recursive
16+
- task: PowerShell@2
17+
displayName: 'Install MSVC preview'
18+
condition: or(contains(variables['Agent.Name'], 'Azure Pipelines'), contains(variables['Agent.Name'], 'Hosted Agent'))
19+
inputs:
20+
targetType: filePath
21+
filePath: $(Build.SourcesDirectory)/ado/install_msvc_preview.ps1
22+
- task: CacheBeta@0
23+
displayName: Cache vcpkg
24+
inputs:
25+
key: $(vcpkgResponseFile) | $(Build.SourcesDirectory)/.git/modules/vcpkg/HEAD
26+
path: '$(vcpkgLocation)'
27+
- task: lucappa.cmake-ninja-vcpkg-tasks.d855c326-b1c0-4d6f-b1c7-440ade6835fb.run-vcpkg@0
28+
displayName: 'Run vcpkg to install boost-build'
29+
inputs:
30+
vcpkgArguments: 'boost-build:x86-windows'
31+
vcpkgDirectory: '$(vcpkgLocation)'
32+
- task: lucappa.cmake-ninja-vcpkg-tasks.d855c326-b1c0-4d6f-b1c7-440ade6835fb.run-vcpkg@0
33+
displayName: 'Run vcpkg'
34+
inputs:
35+
vcpkgArguments: '@$(vcpkgResponseFile)'
36+
vcpkgDirectory: '$(vcpkgLocation)'
37+
vcpkgTriplet: ${{ parameters.targetPlatform }}-windows
38+
- task: lucappa.cmake-ninja-vcpkg-tasks.f2b1ec7d-bc54-4cc8-b9ed-1bc7f37c9dc6.run-cmake@0
39+
displayName: 'Run CMake with Ninja'
40+
enabled: true
41+
inputs:
42+
cmakeListsTxtPath: 'CMakeSettings.json'
43+
useVcpkgToolchainFile: true
44+
configurationRegexFilter: '.*${{ parameters.targetPlatform }}.*'
45+
buildDirectory: $(Build.ArtifactStagingDirectory)/${{ parameters.targetPlatform }}

azure-pipelines.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Build STL targeting x64, arm64, x86, arm.
2+
3+
jobs:
4+
- template: ado/run_build.yml
5+
parameters:
6+
targetPlatform: x64
7+
8+
- template: ado/run_build.yml
9+
parameters:
10+
targetPlatform: arm64
11+
12+
- template: ado/run_build.yml
13+
parameters:
14+
targetPlatform: x86
15+
16+
- template: ado/run_build.yml
17+
parameters:
18+
targetPlatform: arm

vcpkg

Submodule vcpkg added at 8413b90

vcpkg_windows.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
boost-build:x86-windows
2+
boost-math:x64-windows
3+
boost-math:x86-windows
4+
boost-math:arm-windows
5+
boost-math:arm64-windows

0 commit comments

Comments
 (0)