From 24f4cc689f63a4ebad8ed3d169270f690c16e6de Mon Sep 17 00:00:00 2001 From: Luca <681992+lukka@users.noreply.github.com> Date: Mon, 16 Sep 2019 22:12:36 -0700 Subject: [PATCH] add azure-pipeline for x64, arm64, x86, arm --- .gitmodules | 4 ++ azure-devops/install_msvc_preview.ps1 | 68 +++++++++++++++++++++++++++ azure-devops/run_build.yml | 51 ++++++++++++++++++++ azure-pipelines.yml | 31 ++++++++---- vcpkg | 1 + vcpkg_windows.txt | 5 ++ 6 files changed, 150 insertions(+), 10 deletions(-) create mode 100644 .gitmodules create mode 100644 azure-devops/install_msvc_preview.ps1 create mode 100644 azure-devops/run_build.yml create mode 160000 vcpkg create mode 100644 vcpkg_windows.txt diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..915667ffe5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/microsoft/vcpkg.git + fetchRecurseSubmodules = false \ No newline at end of file diff --git a/azure-devops/install_msvc_preview.ps1 b/azure-devops/install_msvc_preview.ps1 new file mode 100644 index 0000000000..2f0b5545ce --- /dev/null +++ b/azure-devops/install_msvc_preview.ps1 @@ -0,0 +1,68 @@ +$ErrorActionPreference = "Stop" + +Function InstallVS +{ + # Microsoft hosted agents do not have the required MSVC 14.23 for building MSVC STL. + # This step installs MSVC 14.23, only on Microsoft hosted agents. + + Param( + [String]$WorkLoads, + [String]$Sku, + [String]$VSBootstrapperURL) + $exitCode = -1 + try + { + Write-Host "Downloading bootstrapper ..." + [string]$bootstrapperExe = Join-Path ${env:Temp} ([System.IO.Path]::GetRandomFileName() + ".exe") + Invoke-WebRequest -Uri $VSBootstrapperURL -OutFile $bootstrapperExe + + $Arguments = ('/c', $bootstrapperExe, $WorkLoads, '--quiet', '--norestart', '--wait', '--nocache' ) + + Write-Host "Starting Install: $Arguments" + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful!' + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + } + } + catch + { + Write-Host -Object "Failed to install Visual Studio!" + Write-Host -Object $_.Exception.Message + exit $exitCode + } + + exit $exitCode +} + +# Invalidate the standard installation of VS on the hosted agent. +Move-Item "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/" "C:/Program Files (x86)/Microsoft Visual Studio/2019/nouse/" -Verbose + +$WorkLoads = '--add Microsoft.VisualStudio.Component.UWP.VC.ARM64 ' + ` + '--add Microsoft.VisualStudio.Component.VC.CLI.Support ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest ' + ` + '--add Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest ' + ` + '--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ' + ` + '--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ' + ` + '--add Microsoft.VisualStudio.Component.VC.Tools.ARM ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.18362 ' + +$ReleaseInPath = 'Preview' +$Sku = 'Enterprise' +$VSBootstrapperURL = 'https://aka.ms/vs/16/pre/vs_buildtools.exe' + +$ErrorActionPreference = 'Stop' + +# Install VS +$exitCode = InstallVS -WorkLoads $WorkLoads -Sku $Sku -VSBootstrapperURL $VSBootstrapperURL + +exit $exitCode \ No newline at end of file diff --git a/azure-devops/run_build.yml b/azure-devops/run_build.yml new file mode 100644 index 0000000000..3e9d6693e1 --- /dev/null +++ b/azure-devops/run_build.yml @@ -0,0 +1,51 @@ +parameters: + targetPlatform: 'x64' + +jobs: +- job: vs2019_hosted_${{ parameters.targetPlatform }} + pool: + #name: Hosted Windows 2019 with VS2019 + name: STL + + variables: + vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg' + vcpkgResponseFile: $(Build.SourcesDirectory)/vcpkg_windows.txt + steps: + - checkout: self + submodules: recursive + - task: BatchScript@1 + inputs: + filename: 'azure-devops/enforce-clang-format.cmd' + failOnStandardError: true + displayName: 'Enforce clang-format' + # Install VS 2019 preview on Microsoft Hosted Agents only. + - task: PowerShell@2 + displayName: 'Install MSVC preview' + condition: or(contains(variables['Agent.Name'], 'Azure Pipelines'), contains(variables['Agent.Name'], 'Hosted Agent')) + inputs: + targetType: filePath + filePath: $(Build.SourcesDirectory)/azure-devops/install_msvc_preview.ps1 + - task: CacheBeta@0 + displayName: Cache vcpkg + inputs: + key: $(vcpkgResponseFile) | $(Build.SourcesDirectory)/.git/modules/vcpkg/HEAD + path: '$(vcpkgLocation)' + - task: run-vcpkg@0 + displayName: 'Run vcpkg to install boost-build' + inputs: + vcpkgArguments: 'boost-build:x86-windows' + vcpkgDirectory: '$(vcpkgLocation)' + - task: run-vcpkg@0 + displayName: 'Run vcpkg' + inputs: + vcpkgArguments: '@$(vcpkgResponseFile)' + vcpkgDirectory: '$(vcpkgLocation)' + vcpkgTriplet: ${{ parameters.targetPlatform }}-windows + - task: run-cmake@0 + displayName: 'Run CMake with Ninja' + enabled: true + inputs: + cmakeListsTxtPath: 'CMakeSettings.json' + useVcpkgToolchainFile: true + configurationRegexFilter: '.*${{ parameters.targetPlatform }}.*' + buildDirectory: $(Build.ArtifactStagingDirectory)/${{ parameters.targetPlatform }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c0ccde8d09..331bcbf887 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,10 +1,21 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -pool: 'STL' - -steps: -- task: BatchScript@1 - inputs: - filename: 'azure-devops/enforce-clang-format.cmd' - failOnStandardError: true - displayName: 'Enforce clang-format' +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# Build STL targeting x64, arm64, x86, arm. + +jobs: +- template: azure-devops/run_build.yml + parameters: + targetPlatform: x64 + +- template: azure-devops/run_build.yml + parameters: + targetPlatform: arm64 + +- template: azure-devops/run_build.yml + parameters: + targetPlatform: x86 + +- template: azure-devops/run_build.yml + parameters: + targetPlatform: arm diff --git a/vcpkg b/vcpkg new file mode 160000 index 0000000000..8413b901d7 --- /dev/null +++ b/vcpkg @@ -0,0 +1 @@ +Subproject commit 8413b901d71ad2a1807f3bcb4dedc0835efed541 diff --git a/vcpkg_windows.txt b/vcpkg_windows.txt new file mode 100644 index 0000000000..0d2a4c5159 --- /dev/null +++ b/vcpkg_windows.txt @@ -0,0 +1,5 @@ +boost-build:x86-windows +boost-math:x64-windows +boost-math:x86-windows +boost-math:arm-windows +boost-math:arm64-windows \ No newline at end of file