-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
install.ps1
71 lines (54 loc) · 2.45 KB
/
install.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
66
67
68
69
70
71
# Usage .\install.ps1 -cleanGdalBuild:$true -cleanGdalIntermediate:$true -cleanProjBuild:$true -bootstrapVcpkg:$true
param (
[bool] $cleanGdalBuild = $true, # clean gdal build files
[bool] $cleanGdalIntermediate = $true, # clean gdal intermediate files
[bool] $cleanProjBuild = $true, # clean proj build files
[bool] $cleanProjIntermediate = $true, # clean proj intermediate files
[bool] $fetchGdal = $true, # fetch gdal from git, otherwise use local copy
[bool] $bootstrapVcpkg = $true, # bootstrap vcpkg, otherwise use local copy
[bool] $installVcpkgPackages = $true, # install vcpkg packages, otherwise use local copy
[bool] $preRelease = $false, # build preRelease version of csharp bindings
[int] $buildNumberTail = 10 # build number for csharp bindings
)
# using predefined set of helper functions
Import-Module (Resolve-Path "functions.psm1") -Force
Import-Module (Resolve-Path "partials.psm1") -Force
Push-Location -StackName "gdal.netcore|root"
#$existingVariables = Get-Variable
try {
$ErrorActionPreference = 'Stop'
# $ConfirmPreference = 'Low'
# $VerbosePreference = Continue
Install-PwshModuleRequirements
$env:BUILD_ROOT = (Get-ForceResolvePath "$PSScriptRoot\..\build-win")
$env:7Z_ROOT = (Get-ForceResolvePath "$env:BUILD_ROOT\7z")
Add-EnvPath $env:7Z_ROOT
$env:VCPKG_ROOT = (Get-ForceResolvePath "$env:BUILD_ROOT\vcpkg")
Add-EnvPath $env:VCPKG_ROOT
Get-7ZipInstallation
Get-VcpkgInstallation -bootstrapVcpkg $bootstrapVcpkg
Set-GdalVariables
Get-VisualStudioVars
Install-VcpkgPackagesSharedConfig $installVcpkgPackages
Get-GdalSdkIsAvailable
Resolve-GdalThidpartyLibs
Install-Proj -cleanProjBuild $cleanProjBuild -cleanProjIntermediate $cleanProjIntermediate
Get-ProjDatum
Reset-GdalSourceBindings
$env:INCLUDE = Add-EnvVar $env:INCLUDE "$env:SDK_PREFIX\include"
$env:LIB = Add-EnvVar $env:LIB "$env:SDK_PREFIX\lib"
Build-Gdal -cleanGdalBuild $cleanGdalBuild -cleanGdalIntermediate $cleanGdalIntermediate -fetchGdal $fetchGdal
$env:GDAL_VERSION = Get-GdalVersion
Build-CsharpBindings -isDebug $preRelease -packageVersion $buildNumberTail
}
catch
{
Write-BuildError "Something threw an exception"
Write-Output $_
$host.SetShouldExit(-1)
throw
}
finally {
Pop-Location -StackName "gdal.netcore|root"
#Get-Variable | Where-Object Name -notin $existingVariables.Name | Remove-Variable -ErrorAction SilentlyContinue
}