diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..00d25323985 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,7 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/microsoft/vcpkg.git + fetchRecurseSubmodules = false diff --git a/azure-devops/enforce-clang-format.cmd b/azure-devops/enforce-clang-format.cmd index e229c7ec398..d1f8e1f949a 100644 --- a/azure-devops/enforce-clang-format.cmd +++ b/azure-devops/enforce-clang-format.cmd @@ -3,4 +3,4 @@ @echo off clang-format -style=file -i stl/inc/* stl/inc/cvt/* stl/inc/experimental/* stl/src/* 2>&1 echo If your build fails here, you need to format the following files with clang-format 8.0.1. -git status --porcelain 1>&2 +git status --porcelain stl 1>&2 diff --git a/azure-devops/install_msvc_preview.ps1 b/azure-devops/install_msvc_preview.ps1 new file mode 100644 index 00000000000..51f3f7c647b --- /dev/null +++ b/azure-devops/install_msvc_preview.ps1 @@ -0,0 +1,64 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +$ErrorActionPreference = "Stop" + +Function InstallVS +{ + # Microsoft hosted agents do not have the required MSVC Preview for building MSVC STL. + # This step installs MSVC Preview, 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 "Nonzero 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.VC.CLI.Support ' + ` + '--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 diff --git a/azure-devops/run_build.yml b/azure-devops/run_build.yml new file mode 100644 index 00000000000..a8379bb5eae --- /dev/null +++ b/azure-devops/run_build.yml @@ -0,0 +1,53 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +parameters: + targetPlatform: 'x64' + +jobs: +- job: ${{ parameters.targetPlatform }} + pool: + name: STL + + variables: + vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg' + vcpkgResponseFile: $(Build.SourcesDirectory)/vcpkg_windows.txt + steps: + - checkout: self + submodules: recursive + - task: BatchScript@1 + displayName: 'Enforce clang-format' + condition: eq('${{ parameters.targetPlatform }}', 'x86') + inputs: + filename: 'azure-devops/enforce-clang-format.cmd' + failOnStandardError: true + - task: PowerShell@2 + displayName: 'Install MSVC preview' + # on "Hosted" agents only: + 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 c0ccde8d09e..0ee01d6de5a 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 x86, x64, arm, arm64 + +jobs: +- template: azure-devops/run_build.yml + parameters: + targetPlatform: x86 + +- template: azure-devops/run_build.yml + parameters: + targetPlatform: x64 + +- template: azure-devops/run_build.yml + parameters: + targetPlatform: arm + +- template: azure-devops/run_build.yml + parameters: + targetPlatform: arm64 diff --git a/vcpkg b/vcpkg new file mode 160000 index 00000000000..8413b901d71 --- /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 00000000000..92889a0fe2a --- /dev/null +++ b/vcpkg_windows.txt @@ -0,0 +1,5 @@ +boost-build:x86-windows +boost-math:x86-windows +boost-math:x64-windows +boost-math:arm-windows +boost-math:arm64-windows