Files
qt5/coin/provisioning/common/windows/zlib-helpers.ps1
Pavel Dubsky 837922faee Build zlib while provisioning on Windows
Task-number: QTBUG-103332
Pick-to: 6.9 6.8 6.5
Change-Id: I65289d393f3085c9a3ebc5bbbb1805490d270125
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit 97e80c1538)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-07-26 00:01:13 +00:00

81 lines
1.8 KiB
PowerShell

# Copyright (C) 2025 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
. "$PSScriptRoot\helpers.ps1"
function CpuArchToString {
param (
[Parameter(Mandatory)]
[CpuArch] $Architecture
)
$arhitecture = switch ($Architecture) {
([CpuArch]::arm64) {
'arm64'
}
([CpuArch]::x64) {
'amd64'
}
default {
throw "Unsupported architecture: '$Architecture'"
}
}
return $arhitecture
}
function StringToCpuArch {
param (
[Parameter(Mandatory)]
[string] $Architecture
)
$arhitecture = switch ($Architecture) {
'arm64' {
[CpuArch]::arm64
}
'amd64' {
[CpuArch]::x64
}
default {
throw "Unsupported architecture: '$Architecture'"
}
}
return $arhitecture
}
function GetZlibEnvironmentVariableName {
param (
[Parameter(Mandatory)]
[CpuArch] $TargetArchitecture
)
$architecture = CpuArchToString -Architecture $TargetArchitecture
$environmentVariableName = "ZLIB_PATH_$architecture".ToUpper()
return $environmentVariableName
}
function GetZlibPathByCpuArch {
param (
[Parameter(Mandatory)]
[CpuArch] $TargetArchitecture
)
$environmentVariableName = GetZlibEnvironmentVariableName -TargetArchitecture $TargetArchitecture
return [System.Environment]::GetEnvironmentVariable($environmentVariableName, [System.EnvironmentVariableTarget]::Machine)
}
function GetZlibPathByString {
param (
[Parameter(Mandatory)]
[string] $TargetArchitecture
)
$targetArchitecture = StringToCpuArch -Architecture $TargetArchitecture
return GetZlibPathByCpuArch -TargetArchitecture $targetArchitecture
}