Merge pull request #540 from al-cheb/al-cheb/update_boost_documentation

Update boost windows documentation section to add toolset and Cmake notes, remove BOOST_ROOT variable
This commit is contained in:
Maxim Lobanov
2020-03-17 10:24:18 +03:00
committed by GitHub
6 changed files with 80 additions and 30 deletions

View File

@@ -30,7 +30,8 @@
"image_os": "win16",
"github_feed_token": "{{env `GITHUB_FEED_TOKEN`}}",
"go_versions": "1.9, 1.10, 1.11, 1.12, 1.13, 1.14",
"go_default": "1.14"
"go_default": "1.14",
"boost_default": "1.69.0"
},
"sensitive-variables": ["install_password", "ssh_password", "client_secret", "github_feed_token"],
"builders": [
@@ -516,8 +517,8 @@
{
"type": "powershell",
"environment_vars": [
"BOOST_VERSIONS=1.69.0,1.72.0",
"BOOST_DEFAULT=1.69.0"
"ROOT_FOLDER={{user `root_folder`}}",
"BOOST_DEFAULT={{user `boost_default`}}"
],
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-Boost.ps1"
@@ -651,8 +652,8 @@
{
"type": "powershell",
"environment_vars": [
"BOOST_VERSIONS=1.69.0,1.72.0",
"BOOST_DEFAULT=1.69.0"
"ROOT_FOLDER={{user `root_folder`}}",
"BOOST_DEFAULT={{user `boost_default`}}"
],
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Boost.ps1"

View File

@@ -30,7 +30,8 @@
"image_os": "win19",
"github_feed_token": "{{env `GITHUB_FEED_TOKEN`}}",
"go_versions": "1.9, 1.10, 1.11, 1.12, 1.13, 1.14",
"go_default": "1.14"
"go_default": "1.14",
"boost_default": "1.72.0"
},
"sensitive-variables": ["install_password", "ssh_password", "client_secret", "github_feed_token"],
"builders": [
@@ -497,8 +498,8 @@
{
"type": "powershell",
"environment_vars": [
"BOOST_VERSIONS=1.69.0,1.72.0",
"BOOST_DEFAULT=1.72.0"
"ROOT_FOLDER={{user `root_folder`}}",
"BOOST_DEFAULT={{user `boost_default`}}"
],
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-Boost.ps1"
@@ -638,8 +639,8 @@
{
"type": "powershell",
"environment_vars": [
"BOOST_VERSIONS=1.69.0,1.72.0",
"BOOST_DEFAULT=1.72.0"
"ROOT_FOLDER={{user `root_folder`}}",
"BOOST_DEFAULT={{user `boost_default`}}"
],
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Boost.ps1"

View File

@@ -14,6 +14,8 @@ Export-ModuleMember -Function @(
'Set-SystemVariable'
'Install-MSI'
'Install-EXE'
'Get-ToolcachePackages'
'Get-ToolsByName'
'Add-ContentToMarkdown'
'Add-SoftwareDetailsToMarkdown'
'Stop-SvcWithErrHandling'

View File

@@ -275,6 +275,28 @@ function Get-VSExtensionVersion
return $packageVersion
}
function Get-ToolcachePackages {
$toolcachePath = Join-Path $env:ROOT_FOLDER "toolcache.json"
Get-Content -Raw $toolcachePath | ConvertFrom-Json
}
function Get-ToolsByName {
param (
[Parameter(Mandatory = $True)]
[string]$SoftwareName
)
(Get-ToolcachePackages).PSObject.Properties | Where-Object { $_.Name -match $SoftwareName } | ForEach-Object {
$packageNameParts = $_.Name.Split("-")
[PSCustomObject] @{
ToolName = $packageNameParts[1]
Versions = $_.Value
Architecture = $packageNameParts[3,4] -join "-"
}
}
}
function Get-WinVersion
{
(Get-WmiObject -class Win32_OperatingSystem).Caption
@@ -289,3 +311,4 @@ function Test-IsWin16
{
(Get-WinVersion) -match "2016"
}

View File

@@ -4,8 +4,11 @@
## Desc: Install boost using tool cache
################################################################################
$BoostDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath "Boost"
$BoostVersions = $env:BOOST_VERSIONS.split(',')
Import-Module -Name ImageHelpers
$SoftwareName = "Boost"
$BoostDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $SoftwareName
$BoostVersions = (Get-ToolsByName -SoftwareName $SoftwareName).Versions | Foreach-Object {"{0}.0" -f $_}
$BoostDefault = $env:BOOST_DEFAULT
foreach($BoostVersion in $BoostVersions)
@@ -20,7 +23,5 @@ foreach($BoostVersion in $BoostVersions)
Write-Host "Adding Boost $BoostVersion to the path..."
# Add the Boost binaries to the path
Add-MachinePathItem $BoostInstallationDir | Out-Null
# Set the BOOSTROOT environment variable
setx BOOST_ROOT $BoostInstallationDir /M | Out-Null
}
}

View File

@@ -3,6 +3,8 @@
## Desc: Validate Boost
################################################################################
Import-Module -Name ImageHelpers
function Validate-BoostVersion
{
Param
@@ -37,7 +39,7 @@ else
# Adding description of the software to Markdown
$tmplMark = @"
#### {0}
#### {0} [{2}]
_Environment:_
* {1}: root directory of the Boost version {0} installation
@@ -45,31 +47,51 @@ _Environment:_
"@
$tmplMarkRoot = @"
#### {0}
#### {0} [{2}]
_Environment:_
* PATH: contains the location of Boost version {0}
* BOOST_ROOT: root directory of the Boost version {0} installation
* {1}: root directory of the Boost version {0} installation
"@
$SoftwareName = 'Boost'
$Description = New-Object System.Text.StringBuilder
$BoostRootDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath "Boost"
$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(",")
$SoftwareName = 'Boost'
$BoostRootDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $SoftwareName
$BoostTools = Get-ToolsByName -SoftwareName $SoftwareName
foreach($BoostVersion in $BoostVersionsToInstall)
foreach ($BoostTool in $BoostTools)
{
Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $BoostVersion
$BoostVersionTag = "BOOST_ROOT_{0}" -f $BoostVersion.Replace('.', '_')
$BoostToolsetName = $BoostTool.Architecture
$BoostVersionsToInstall = $BoostTool.Versions | Foreach-Object {"{0}.0" -f $_}
foreach($BoostVersion in $BoostVersionsToInstall)
{
Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $BoostVersion
$BoostVersionTag = "BOOST_ROOT_{0}" -f $BoostVersion.Replace('.', '_')
if($BoostVersion -eq $env:BOOST_DEFAULT)
{
$null = $Description.AppendLine(($tmplMarkRoot -f $BoostVersion, $BoostVersionTag))
}
else
{
$null = $Description.AppendLine(($tmplMark -f $BoostVersion, $BoostVersionTag))
if($BoostVersion -eq $env:BOOST_DEFAULT)
{
$null = $Description.AppendLine(($tmplMarkRoot -f $BoostVersion, $BoostVersionTag, $BoostToolsetName))
}
else
{
$null = $Description.AppendLine(($tmplMark -f $BoostVersion, $BoostVersionTag, $BoostToolsetName))
}
}
}
$CMakeFindBoostInfo = @"
#### _Notes:_
Link: https://cmake.org/cmake/help/latest/module/FindBoost.html
If Boost was built using the ``boost-cmake`` project or from ``Boost 1.70.0`` on it provides a package
configuration file for use with find\_package's config mode. This module looks for the package
configuration file called BoostConfig.cmake or boost-config.cmake and stores the result in CACHE entry "Boost_DIR".
If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the Boost CMake package configuration for details on what it provides.
Set ``Boost_NO_BOOST_CMAKE to ON``, to disable the search for boost-cmake.
"@
$null = $Description.AppendLine($CMakeFindBoostInfo)
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString()