Provisioning: Install OpenSSL via Vcpkg on Windows

- Add a custom triplets for building dynamic android libraries
- Set `ANDROID_NDK_HOME` environment variable, as it is needed when
  vcpkg builds for Android.
- Install openSSL for x64-windows, arm64-windows, and
  armeabi-v7a-android-qt. The android triplet has been renamed from
  vcpkg's official `arm-neon-android.cmake` triplet to further clarify
  the android abi.
- The version of the libraries installed via vcpkg is being written to
  versions.txt as `vpckg <library-name> = <library-version>`

Task-number: QTBUG-115715
Change-Id: I4a17bf00e59c3c90968941be6a21c1d961ba3d97
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Amir Masoud Abdol 2023-11-30 10:52:44 +01:00
parent 9e1b456953
commit a1b278c3a3
11 changed files with 97 additions and 1 deletions

View File

@ -0,0 +1,7 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
# Default settings of the triplet from the official vcpkg registry
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
# Qt custom per-port customizations

View File

@ -0,0 +1,15 @@
set(VCPKG_TARGET_ARCHITECTURE arm)
# Default settings of the triplet from the official vcpkg registry
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
# Qt custom per-port customizations
if(PORT MATCHES "openssl")
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
set(VCPKG_CMAKE_SYSTEM_NAME Android)
set(VCPKG_MAKE_BUILD_TRIPLET "--host=armv7a-linux-androideabi")
set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DANDROID_ABI=armeabi-v7a -DANDROID_ARM_NEON=ON)

View File

@ -0,0 +1,7 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
# Default settings of the triplet from the official vcpkg registry
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
# Qt custom per-port customizations

View File

@ -50,6 +50,9 @@ function Install($1, $2, $3, $4) {
Write-Host "Installing Android NDK $ndkVersionDefault"
Install $ndkCachedUrlDefault $ndkZip $ndkChecksumDefault $ndkOfficialUrlDefault
Set-EnvironmentVariable "ANDROID_NDK_ROOT_DEFAULT" $ndkFolderDefault
# To be used by vcpkg
Set-EnvironmentVariable "ANDROID_NDK_HOME" $ndkFolderDefault
$env:ANDROID_NDK_HOME = "$ndkFolderDefault"
if (Test-Path -Path $ndkFolderLatest) {
Write-Host "Android Latest version is the same than Default. NDK installation done."

View File

@ -0,0 +1,23 @@
# Copyright (C) 2023 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"
Write-Host "Installing vcpkg android ports"
$vcpkgExe = "$env:VCPKG_ROOT\vcpkg.exe"
$vcpkgRoot = "$env:VCPKG_ROOT"
Set-Location -Path "$PSScriptRoot\vcpkg"
Copy-Item "$PSScriptRoot\..\shared\vcpkg-configuration.json" -Destination "$PSScriptRoot\vcpkg"
Run-Executable "$vcpkgExe" "install --triplet armeabi-v7a-android-qt --x-install-root armeabi-v7a-android-qt-tmp --debug"
New-Item -Path "$vcpkgRoot" -Name "installed" -ItemType "directory" -Force
Copy-Item -Path "armeabi-v7a-android-qt-tmp\*" -Destination "$vcpkgRoot\installed" -Recurse -Force
$versions = jq.exe -r '.overrides[] | \"vcpkg \(.name) for android = \(.version)\"' vcpkg.json
$versions = $versions.Replace("vcpkg", "`nvcpkg")
Write-Output "$versions" >> ~/versions.txt
Remove-Item -Path "armeabi-v7a-android-qt-tmp" -Recurse -Force
Set-Location "$PSScriptRoot"

View File

@ -0,0 +1,26 @@
# Copyright (C) 2023 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"
Write-Host "Installing vcpkg ports"
$vcpkgExe = "$env:VCPKG_ROOT\vcpkg.exe"
$vcpkgRoot = "$env:VCPKG_ROOT"
Set-Location -Path "$PSScriptRoot\vcpkg"
Copy-Item "$PSScriptRoot\..\shared\vcpkg-configuration.json" -Destination "$PSScriptRoot\vcpkg"
Run-Executable "$vcpkgExe" "install --triplet x64-windows-qt --x-install-root x64-windows-qt-tmp --debug"
Run-Executable "$vcpkgExe" "install --triplet arm64-windows-qt --x-install-root arm64-windows-qt-tmp --debug"
New-Item -Path "$vcpkgRoot" -Name "installed" -ItemType "directory" -Force
Copy-Item -Path "x64-windows-qt-tmp\*" -Destination "$vcpkgRoot\installed" -Recurse -Force
Copy-Item -Path "arm64-windows-qt-tmp\*" -Destination "$vcpkgRoot\installed" -Recurse -Force
$versions = jq.exe -r '.overrides[] | \"vcpkg \(.name) = \(.version)\"' vcpkg.json
$versions = $versions.Replace("vcpkg", "`nvcpkg")
Write-Output "$versions" >> ~/versions.txt
Remove-Item -Path "x64-windows-qt-tmp" -Recurse -Force
Remove-Item -Path "arm64-windows-qt-tmp" -Recurse -Force
Set-Location "$PSScriptRoot"

View File

@ -1,3 +1,12 @@
{
"overrides": [
{
"name": "openssl",
"version": "3.0.7",
"port-version": 2
}
],
"dependencies": [
"openssl"
]
}

View File

@ -0,0 +1 @@
. "$PSScriptRoot\..\common\windows\install-vcpkg-ports.ps1"

View File

@ -0,0 +1,3 @@
. "$PSScriptRoot\..\common\windows\install-vcpkg-ports.ps1"
. "$PSScriptRoot\..\common\windows\install-vcpkg-ports-android.ps1"

View File

@ -0,0 +1 @@
. "$PSScriptRoot\..\common\windows\install-vcpkg-ports.ps1"

View File

@ -0,0 +1 @@
. "$PSScriptRoot\..\common\windows\install-vcpkg-ports.ps1"