-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild_boost_1_67_0_Visual Studio 15 2017 Win64.ps1
65 lines (48 loc) · 2.19 KB
/
Build_boost_1_67_0_Visual Studio 15 2017 Win64.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
. ".\Invoke-CmdScript.ps1" # Need for calling commands
# We expect PowerShell Version 5
if(-Not $PSVersionTable.PSVersion.Major -eq 5) {
Write-Host "Expecting PowerShell Version 5"
return
}
# Create target dir folder if it does not exist
$TARGETDIR = "C:\thirdparty\vs2017\x64"
if( -Not (Test-Path -Path $TARGETDIR ) ) {
New-Item -ItemType directory -Path $TARGETDIR
}
# Now download library
Invoke-WebRequest https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.zip -OutFile C:\thirdparty\vs2017\x64\boost_1_67_0.zip
# Check file hash
$value = Get-FileHash C:\thirdparty\vs2017\x64\boost_1_67_0.zip -Algorithm SHA256
if($value.Hash -ne "e1c55ebb00886c1a96528e4024be98a38b815115f62ecfe878fcf587ba715aad") {
Write-Host "boost archive seems to be corrupted"
return
}
# Extract file
$strFileName="$env:ProgramFiles\7-Zip\7z.exe"
If (Test-Path $strFileName){
# Use 7-zip
if (-not (test-path "$env:ProgramFiles\7-Zip\7z.exe")) {throw "$env:ProgramFiles\7-Zip\7z.exe needed"}
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
sz x C:\thirdparty\vs2017\x64\boost_1_67_0.zip -oC:\thirdparty\vs2017\x64
} Else {
Write-Host "Please install 7zip."
return
}
# Removed downloaded zip archive
Remove-Item C:\thirdparty\vs2017\x64\boost_1_67_0.zip
# Setup VS2017 x64 environment
Invoke-CmdScript -script "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" -parameters amd64
# Build
cd C:\thirdparty\vs2017\x64\boost_1_67_0
$sw = [Diagnostics.Stopwatch]::StartNew()
Invoke-CmdScript -script "bootstrap.bat"
$cpuInfo = Get-CimInstance -ClassName 'Win32_Processor' `
| Select-Object -Property 'DeviceID', 'Name', 'NumberOfCores', 'NumberOfLogicalProcessors';
Write-Host $cpuInfo.NumberOfLogicalProcessors
.\b2.exe --toolset=msvc-14.1 address-model=64 --build-type=complete stage -j $cpuInfo.NumberOfLogicalProcessors
$sw.Stop()
$ElapsedTime = $sw.Elapsed
write-host $([string]::Format("`rBuild Time (hh:mm:ss): {0:d2}:{1:d2}:{2:d2}",
$ElapsedTime.hours,
$ElapsedTime.minutes,
$ElapsedTime.seconds)) -nonewline