Skip to content

Commit

Permalink
deps.qt: Add support for Windows ARM64
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyvct committed Feb 27, 2023
1 parent 4fd89ba commit bbd723f
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 7 deletions.
7 changes: 6 additions & 1 deletion Build-Dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ param(
[switch] $SkipAll,
[switch] $SkipBuild,
[switch] $SkipDeps,
[switch] $SkipUnpack
[switch] $SkipUnpack,
[string] $QtHostPath = $Env:Qt6_DIR
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -170,6 +171,10 @@ function Build-Main {
$script:PackageName = 'qt5'
} elseif ( $Dependencies -eq 'qt6' ) {
$script:PackageName = 'qt6'

if ( $Target -eq 'arm64' ) {
$script:QtHostPath = $QtHostPath
}
}

$UtilityFunctions = Get-ChildItem -Path $PSScriptRoot/utils.pwsh/*.ps1 -Recurse
Expand Down
42 changes: 40 additions & 2 deletions deps.qt/qt5.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ param(
PatchFile = "${PSScriptRoot}/patches/Qt5/win/0001-QTBUG-74606.patch"
HashSum = "BAE8765FC74FB398BC3967AD82760856EE308E643A8460C324D36A4D07063001"
}
)
),
[array] $Targets = @('x86', 'x64')
)

# References:
Expand Down Expand Up @@ -96,7 +97,44 @@ function Configure {
$QtBuildConfiguration = '-release'
}

$BuildCommand = "..\..\..\qt5\configure -opensource -confirm-license ${QtBuildConfiguration} -no-strip -nomake examples -nomake tests -no-compile-examples -schannel -no-dbus -no-freetype -no-harfbuzz -no-icu -no-feature-itemmodeltester -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sql -no-feature-sqlmodel -no-feature-testlib -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite2 -no-sql-sqlite -no-sql-tds -DQT_NO_PDF -DQT_NO_PRINTER -mp -prefix ${BuildPath}"
$BuildCommand = @(
"..\..\..\qt5\configure",
"-opensource",
"-confirm-license",
"${QtBuildConfiguration}",
"-no-strip",
"-nomake",
"examples",
"-nomake",
"tests",
"-no-compile-examples",
"-schannel",
"-no-dbus",
"-no-freetype",
"-no-harfbuzz",
"-no-icu",
"-no-feature-itemmodeltester",
"-no-feature-printdialog",
"-no-feature-printer",
"-no-feature-printpreviewdialog",
"-no-feature-printpreviewwidget",
"-no-feature-sql",
"-no-feature-sqlmodel",
"-no-feature-testlib",
"-no-sql-db2",
"-no-sql-ibase",
"-no-sql-mysql",
"-no-sql-oci",
"-no-sql-odbc",
"-no-sql-psql",
"-no-sql-sqlite2",
"-no-sql-sqlite",
"-no-sql-tds",
"-DQT_NO_PDF",
"-DQT_NO_PRINTER",
"-mp",
"-prefix", "${BuildPath}"
)

$Params = @{
BasePath = (Get-Location | Convert-Path)
Expand Down
41 changes: 37 additions & 4 deletions deps.qt/qt6.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function Setup {
'--force'
)
Invoke-External perl init-repository @Options

if ( (${Target} -eq "arm64") -and [string]::IsNullOrWhiteSpace($script:QtHostPath) ) {
throw "Qt $($Version) must be installed and QtHostPath argument must be passed to cross-compile to Windows ARM64."
}
}

function Clean {
Expand Down Expand Up @@ -88,14 +92,43 @@ function Configure {
$QtBuildConfiguration = '-release'
}

$BuildCommand = "..\..\..\qt6\configure -opensource -confirm-license ${QtBuildConfiguration} -nomake examples -nomake tests -schannel -no-dbus -no-freetype -no-icu -no-openssl -no-feature-androiddeployqt -no-feature-pdf -no-feature-printsupport -no-feature-qmake -no-feature-sql -no-feature-testlib -no-feature-windeployqt -qt-doubleconversion -qt-pcre -qt-zlib -qt-libjpeg -qt-libpng -qt-libmd4c -qt-tiff -qt-webp -DQT_NO_PDF -DCMAKE_IGNORE_PREFIX_PATH=C:/Strawberry/c -prefix ${BuildPath}"
$BuildCommand = @("..\..\..\qt6\configure")

if (${Target} -eq "ARM64") {
$BuildCommand += @("-platform win32-msvc -xplatform win32-arm64-msvc -qt-host-path '$($script:QtHostPath)'")
}

$BuildCommand += @(
"-opensource",
"-confirm-license",
"${QtBuildConfiguration}",
"-nomake",
"examples",
"-nomake",
"tests",
"-schannel",
"-no-dbus",
"-no-freetype",
"-no-icu",
"-no-openssl",
"-no-feature-androiddeployqt",
"-no-feature-pdf",
"-no-feature-printsupport",
"-no-feature-qmake",
"-no-feature-sql",
"-no-feature-testlib",
"-no-feature-windeployqt",
"-DQT_NO_PDF",
"-prefix", "${BuildPath}"
)


$Params = @{
BasePath = (Get-Location | Convert-Path)
BuildPath = "."
BuildCommand = "${BuildCommand}"
Target = $Target
HostArchitecture = $Target
HostArchitecture = ($Target, 'x64')[$Target -eq 'ARM64']
}

Invoke-DevShell @Params
Expand All @@ -112,7 +145,7 @@ function Build {
BuildPath = "."
BuildCommand = "cmake --build . --parallel"
Target = $Target
HostArchitecture = $Target
HostArchitecture = ($Target, 'x64')[$Target -eq 'ARM64']
}

Invoke-DevShell @Params
Expand All @@ -131,7 +164,7 @@ function Install {
BuildPath = "."
BuildCommand = "${BuildCommand}"
Target = $Target
HostArchitecture = $Target
HostArchitecture = ($Target, 'x64')[$Target -eq 'ARM64']
}

Invoke-DevShell @Params
Expand Down

0 comments on commit bbd723f

Please sign in to comment.