Skip to content

Commit

Permalink
build: Last attempts to get 32-bit ARM working
Browse files Browse the repository at this point in the history
Rely on the 22621 SDK for 32-bit ARM support on VS 2022.
Also modified the `setup.ps1` script to always fetch this SDK version.
  • Loading branch information
trungnt2910 committed Nov 17, 2024
1 parent cc4c47a commit 28a15d8
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 7 deletions.
5 changes: 5 additions & 0 deletions lxmonika.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
<MaTargetPlatformVersion Condition="'$(MaTargetPlatformVersion)' == ''">10.0.17134.0</MaTargetPlatformVersion>
</PropertyGroup>

<PropertyGroup Label="Monika" Condition="'$(Platform)' == 'ARM' and '$(MaLatestTargetPlatformVersion)' > '10.0.22621.0'">
<!-- Last SDK/WDK version to support 32-bit ARM. -->
<MaLatestTargetPlatformVersion>10.0.22621.0</MaLatestTargetPlatformVersion>
</PropertyGroup>

<PropertyGroup Label="WDK">
<WDKContentRoot Condition="'$(WDKContentRoot)' == ''">$(MaWindowsKitsRoot)</WDKContentRoot>
<WDKBuildFolder Condition="'$(WDKBuildFolder)' == ''">$(MaLatestTargetPlatformVersion)</WDKBuildFolder>
Expand Down
64 changes: 57 additions & 7 deletions setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,33 @@ curl.exe `
Start-Process .\wdksetup_17134.exe -Wait -ArgumentList '/ceip off /features + /q'
Remove-Item wdksetup_17134.exe

curl.exe `
-SL https://download.microsoft.com/download/3/b/d/3bd97f81-3f5b-4922-b86d-dc5145cd6bfe/windowssdk/winsdksetup.exe `
-o sdksetup_22621.exe
Start-Process .\sdksetup_22621.exe -Wait -ArgumentList '/ceip off /features + /q'
Remove-Item sdksetup_22621.exe

curl.exe `
-SL https://download.microsoft.com/download/7/b/f/7bfc8dbe-00cb-47de-b856-70e696ef4f46/wdk/wdksetup.exe `
-o wdksetup_22621.exe
Start-Process .\wdksetup_22621.exe -Wait -ArgumentList '/ceip off /features + /q'
Remove-Item wdksetup_22621.exe

# Hacks to enable ARM32 builds

$vsPath = (vswhere -property installationPath | Out-String).Trim();

$arm64Path = (Join-Path $vsPath "\MSBuild\Microsoft\VC\v170\Platforms\ARM64");
$armPath = (Join-Path $vsPath "\MSBuild\Microsoft\VC\v170\Platforms\ARM")
$vcArm64Path = (Join-Path $vsPath "\MSBuild\Microsoft\VC\v170\Platforms\ARM64");
$vcArmPath = (Join-Path $vsPath "\MSBuild\Microsoft\VC\v170\Platforms\ARM")

if (Test-Path $arm64Path)
if (Test-Path $vcArm64Path)
{
Push-Location $arm64Path
foreach ($file in (Get-ChildItem -Recurse $arm64Path -File))
Push-Location $vcArm64Path
foreach ($file in (Get-ChildItem -Recurse $vcArm64Path -File))
{
$relativePath = Resolve-Path -Path $file.FullName -Relative
$armFilePath = Join-Path $armPath $relativePath
if (Test-Path (Join-Path $armPath $relativePath))
$armFilePath = Join-Path $vcArmPath $relativePath
if (Test-Path (Join-Path $vcArmPath $relativePath))
{
continue;
}
Expand All @@ -47,3 +59,41 @@ if (Test-Path $arm64Path)
}
Pop-Location
}

$kitPath = (Get-ItemPropertyValue `
"Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots" `
-Name KitsRoot10 | `
Out-String).Trim();

foreach ($sdkDir in (Get-ChildItem (Join-Path $kitPath "build") -Directory -Filter "10.0.*"))
{
$sdkPath = $sdkDir.FullName

$sdkArm64Path = (Join-Path $sdkPath "ARM64")
$sdkArmPath = (Join-Path $sdkPath "ARM")

if ((Test-Path $sdkArmPath) -or !(Test-Path $sdkArm64Path))
{
continue;
}

Push-Location $sdkArm64Path
foreach ($file in (Get-ChildItem -Recurse $sdkArm64Path -File))
{
$relativeArm64Path = Resolve-Path -Path $file.FullName -Relative
$relativeArmPath = $relativeArm64Path.Replace("arm64", "arm").Replace("Arm64", "Arm");
$fileArmPath = (Join-Path $sdkArmPath $relativeArmPath)
if (Test-Path $fileArmPath)
{
continue;
}
New-Item -ItemType File -Path $fileArmPath -Force
$fileContent = (Get-Content $relativeArm64Path | Out-String).Replace( `
"arm64", "arm" `
).Replace( `
"Arm64", "Arm" `
)
Set-Content $fileArmPath -Value $fileContent
}
Pop-Location
}

0 comments on commit 28a15d8

Please sign in to comment.