Skip to content

Commit 91e998c

Browse files
authored
Add support for Windows ARM64 (#90)
* Upgrade to 88.1.2+gac8e5f0+chromium-88.0.4324.27. * - Add win-arm64 artifacts to package 'chromiumembeddedframework'. - Build win-arm64 version of libcef_dll_wrapper.lib when using the v141 (VS 2017) or v142 (VS 2019) toolchain. Issue cefsharp/CefSharp#2944 * Use x64_arm64 instead of amd64_arm64 as argument for vcvarsall.bat for consistency. * PR feedback: Also build the cef.redist.arm64 package.
1 parent 5809729 commit 91e998c

File tree

7 files changed

+169
-14
lines changed

7 files changed

+169
-14
lines changed

NuGet/cef.redist.arm64.props

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<!--
4+
Files are no longer copied as part of this targets file.
5+
For projects other than CefSharp define a target to copy the files.
6+
Checkout the CefSharp.Common.targets file for an example
7+
-->
8+
9+
<!--
10+
Using wildcard matching as per https://stackoverflow.com/a/17252671
11+
-->
12+
<ItemGroup>
13+
<CefRedistArm64 Include="$(MSBuildThisFileDirectory)..\CEF\**\*.*" />
14+
</ItemGroup>
15+
</Project>

NuGet/cef.sdk.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<CefSdkVer>cef.sdk.86.0.17</CefSdkVer>
4+
<CefSdkVer>cef.sdk.88.1.2</CefSdkVer>
55
</PropertyGroup>
66
</Project>

NuGet/chromiumembeddedframework.runtime.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22
"runtimes": {
33
"win-x64": {
44
"chromiumembeddedframework.runtime": {
5-
"chromiumembeddedframework.runtime.win-x64": "86.0.20"
5+
"chromiumembeddedframework.runtime.win-x64": "88.1.2"
66
}
77
},
88
"win-x86": {
99
"chromiumembeddedframework.runtime": {
10-
"chromiumembeddedframework.runtime.win-x86": "86.0.20"
10+
"chromiumembeddedframework.runtime.win-x86": "88.1.2"
1111
}
12-
}
12+
},
13+
"win-arm64": {
14+
"chromiumembeddedframework.runtime": {
15+
"chromiumembeddedframework.runtime.win-arm64": "88.1.2"
16+
}
17+
},
1318
}
1419
}

NuGet/chromiumembeddedframework.runtime.nuspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<file src="..\cef_binary_3.y.z_windows32\$Configuration$\swiftshader\*.dll" target="CEF\win-x86\swiftshader" />
3030
<file src="..\cef_binary_3.y.z_windows64\Resources\locales\*.pak" target="CEF\win-x64\locales"/>
3131
<file src="..\cef_binary_3.y.z_windows64\$Configuration$\swiftshader\*.dll" target="CEF\win-x64\swiftshader" />
32+
<file src="..\cef_binary_3.y.z_windowsarm64\Resources\locales\*.pak" target="CEF\win-arm64\locales"/>
33+
<file src="..\cef_binary_3.y.z_windowsarm64\$Configuration$\swiftshader\*.dll" target="CEF\win-arm64\swiftshader" />
3234
<file src="..\cef_binary_3.y.z_windows32\LICENSE.txt" target="LICENSE.txt" />
3335
<file src="chromiumembeddedframework.runtime.json" target="runtime.json" />
3436
<file src="chromiumembeddedframework.runtime.props" target="buildTransitive\" />

NuGet/chromiumembeddedframework.runtime.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
<CefRuntimeWin32SwiftShader Include="$(MSBuildThisFileDirectory)..\CEF\win-x86\swiftshader\*.*" />
99
<CefRuntimeWin64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\locales\*.*" />
1010
<CefRuntimeWin64SwiftShader Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\swiftshader\*.*" />
11+
<CefRuntimeWinArm64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\locales\*.*" />
12+
<CefRuntimeWinArm64SwiftShader Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\swiftshader\*.*" />
1113
</ItemGroup>
1214
</Project>

build.ps1

Lines changed: 141 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ param(
1414
[string] $CefBinaryDir = "../cefsource/chromium/src/cef/binary_distrib/",
1515

1616
[Parameter(Position = 3)]
17-
$CefVersion = "86.0.20+gf2039ae+chromium-86.0.4240.111",
17+
$CefVersion = "88.1.2+gac8e5f0+chromium-88.0.4324.27",
1818

1919
[ValidateSet("tar.bz2","zip","7z")]
2020
[Parameter(Position = 4)]
@@ -58,6 +58,8 @@ try
5858
$Cef32vcx = Join-Path (Join-Path $Cef32 'libcef_dll_wrapper') 'libcef_dll_wrapper.vcxproj'
5959
$Cef64 = Join-Path $WorkingDir 'cef_binary_3.y.z_windows64'
6060
$Cef64vcx = Join-Path (Join-Path $Cef64 'libcef_dll_wrapper') 'libcef_dll_wrapper.vcxproj'
61+
$CefArm64 = Join-Path $WorkingDir 'cef_binary_3.y.z_windowsarm64'
62+
$CefArm64vcx = Join-Path (Join-Path $CefArm64 'libcef_dll_wrapper') 'libcef_dll_wrapper.vcxproj'
6163

6264
function Write-Diagnostic
6365
{
@@ -218,6 +220,13 @@ try
218220
md 'cef\x64\release\VS2015' | Out-Null
219221
md 'cef\x64\release\VS2017' | Out-Null
220222
md 'cef\x64\release\VS2019' | Out-Null
223+
md 'cef\arm64' | Out-Null
224+
md 'cef\arm64\debug' | Out-Null
225+
md 'cef\arm64\debug\VS2017' | Out-Null
226+
md 'cef\arm64\debug\VS2019' | Out-Null
227+
md 'cef\arm64\release' | Out-Null
228+
md 'cef\arm64\release\VS2017' | Out-Null
229+
md 'cef\arm64\release\VS2019' | Out-Null
221230
}
222231

223232
function Msvs
@@ -232,7 +241,7 @@ try
232241
[string] $Configuration,
233242

234243
[Parameter(Position = 2, ValueFromPipeline = $true)]
235-
[ValidateSet('x86', 'x64')]
244+
[ValidateSet('x86', 'x64', 'arm64')]
236245
[string] $Platform
237246
)
238247

@@ -327,10 +336,21 @@ try
327336
Die 'Error unable to find any visual studio environment'
328337
}
329338

330-
$CefProject = TernaryReturn ($Platform -eq 'x86') $Cef32vcx $Cef64vcx
331-
$CefDir = TernaryReturn ($Platform -eq 'x86') $Cef32 $Cef64
332-
333-
$Arch = TernaryReturn ($Platform -eq 'x64') 'x64' 'win32'
339+
$CefProject = $Cef32vcx
340+
$CefDir = $Cef32
341+
$Arch = 'win32'
342+
if ($Platform -eq 'x64')
343+
{
344+
$CefProject = $Cef64vcx
345+
$CefDir = $Cef64
346+
$Arch = 'x64'
347+
}
348+
elseif ($Platform -eq 'arm64')
349+
{
350+
$CefProject = $CefArm64vcx
351+
$CefDir = $CefArm64
352+
$Arch = 'arm64'
353+
}
334354

335355
$VCVarsAll = Join-Path $VXXCommonTools vcvarsall.bat
336356
if (-not (Test-Path $VCVarsAll))
@@ -340,15 +360,22 @@ try
340360
}
341361

342362
$VCXProj = $Cef32vcx
363+
$VCVarsAllArch = 'x86'
343364
if ($Platform -eq 'x64')
344365
{
345366
$VCXProj = $Cef64vcx
367+
$VCVarsAllArch = 'x64'
368+
}
369+
elseif ($Platform -eq 'arm64')
370+
{
371+
$VCXProj = $CefArm64vcx
372+
$VCVarsAllArch = 'x64_arm64'
346373
}
347374

348375
# Only configure build environment once
349376
if ($env:CEFSHARP_BUILD_IS_BOOTSTRAPPED -ne "$Toolchain$Platform")
350377
{
351-
Invoke-BatchFile $VCVarsAll $Platform
378+
Invoke-BatchFile $VCVarsAll $VCVarsAllArch
352379
Write-Diagnostic "pushd $CefDir"
353380
pushd $CefDir
354381
# Remove previously generated CMake data for the different platform/toolchain
@@ -433,6 +460,15 @@ try
433460
}
434461
Msvs "$Toolchain" 'Release' 'x64'
435462

463+
if ($Toolchain -eq 'v141' -or $Toolchain -eq 'v142')
464+
{
465+
if (! $NoDebugBuild)
466+
{
467+
Msvs "$Toolchain" 'Debug' 'arm64'
468+
}
469+
Msvs "$Toolchain" 'Release' 'arm64'
470+
}
471+
436472
Write-Diagnostic "Finished build targeting toolchain $Toolchain"
437473
}
438474

@@ -448,7 +484,7 @@ try
448484
[string] $Configuration,
449485

450486
[Parameter(Position = 2, ValueFromPipeline = $true)]
451-
[ValidateSet('x86', 'x64')]
487+
[ValidateSet('x86', 'x64', 'arm64')]
452488
[string] $Platform
453489
)
454490

@@ -476,8 +512,18 @@ try
476512
$VisualStudioVersion = "VS2013"
477513
}
478514

479-
$Arch = TernaryReturn ($Platform -eq 'x64') 'x64' 'win32'
480-
$CefArchDir = TernaryReturn ($Platform -eq 'x64') $Cef64 $Cef32
515+
$Arch = 'win32'
516+
$CefArchDir = $Cef32
517+
if ($Platform -eq 'x64')
518+
{
519+
$Arch = 'x64'
520+
$CefArchDir = $Cef64
521+
}
522+
elseif ($Platform -eq 'arm64')
523+
{
524+
$Arch = 'arm64'
525+
$CefArchDir = $CefArm64
526+
}
481527

482528
# cef_binary_3.y.z_windows32\out\debug\lib -> cef\win32\debug\vs2013
483529
Copy-Item $CefArchDir\libcef_dll_wrapper\$Configuration\libcef_dll_wrapper.lib $Cef\$Arch\$Configuration\$VisualStudioVersion | Out-Null
@@ -504,6 +550,10 @@ try
504550
. $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;Platform=x64;CPlatform=windows64;' -OutputDirectory nuget
505551
. $Nuget pack nuget\chromiumembeddedframework.runtime.win.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;Platform=x64;CPlatform=windows64;' -OutputDirectory nuget
506552

553+
# Build arm64 packages
554+
. $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;Platform=arm64;CPlatform=windowsarm64;' -OutputDirectory nuget
555+
. $Nuget pack nuget\chromiumembeddedframework.runtime.win.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;Platform=arm64;CPlatform=windowsarm64;' -OutputDirectory nuget
556+
507557
# Meta Package
508558
. $Nuget pack nuget\chromiumembeddedframework.runtime.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;' -OutputDirectory nuget
509559

@@ -518,8 +568,10 @@ try
518568
{
519569
appveyor PushArtifact "nuget\cef.redist.x86.$CefPackageVersion.nupkg"
520570
appveyor PushArtifact "nuget\cef.redist.x64.$CefPackageVersion.nupkg"
571+
appveyor PushArtifact "nuget\cef.redist.arm64.$CefPackageVersion.nupkg"
521572
appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.win-x86.$CefPackageVersion.nupkg"
522573
appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.win-x64.$CefPackageVersion.nupkg"
574+
appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.win-arm64.$CefPackageVersion.nupkg"
523575
appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.$CefPackageVersion.nupkg"
524576
appveyor PushArtifact "nuget\cef.sdk.$CefPackageVersion.nupkg"
525577
}
@@ -551,19 +603,27 @@ try
551603
$CefBuildsJson = Invoke-WebRequest -Uri $CefBuildServerJsonPackageList | ConvertFrom-Json
552604
$CefWin32CefVersion = $CefBuildsJson.windows32.versions | Where-Object {$_.cef_version -eq $CefVersion}
553605
$CefWin64CefVersion = $CefBuildsJson.windows64.versions | Where-Object {$_.cef_version -eq $CefVersion}
606+
$CefWinArm64CefVersion = $CefBuildsJson.windowsarm64.versions | Where-Object {$_.cef_version -eq $CefVersion}
554607

555608
$Cef32FileName = ($CefWin32CefVersion.files | Where-Object {$_.type -eq "standard"}).name
556609
$Cef32FileHash = ($CefWin32CefVersion.files | Where-Object {$_.type -eq "standard"}).sha1
557610
$Cef32FileSize = (($CefWin32CefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB)
558611
$Cef64FileName = ($CefWin64CefVersion.files | Where-Object {$_.type -eq "standard"}).name
559612
$Cef64FileHash = ($CefWin64CefVersion.files | Where-Object {$_.type -eq "standard"}).sha1
560613
$Cef64FileSize = (($CefWin64CefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB)
614+
$CefArm64FileName = ($CefWinArm64CefVersion.files | Where-Object {$_.type -eq "standard"}).name
615+
$CefArm64FileHash = ($CefWinArm64CefVersion.files | Where-Object {$_.type -eq "standard"}).sha1
616+
$CefArm64FileSize = (($CefWinArm64CefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB)
561617

562618
# Make sure there is a 32bit and 64bit version for the specified build
563619
if ($CefWin32CefVersion.cef_version -ne $CefWin64CefVersion.cef_version)
564620
{
565621
Die 'Win32 version is $CefWin32CefVersion.cef_version and Win64 version is $CefWin64CefVersion.cef_version - both must be the same'
566622
}
623+
if ($CefWin32CefVersion.cef_version -ne $CefWinArm64CefVersion.cef_version)
624+
{
625+
Die 'Win32 version is $CefWin32CefVersion.cef_version and WinArm64 version is $CefWinArm64CefVersion.cef_version - both must be the same'
626+
}
567627

568628
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
569629

@@ -644,6 +704,45 @@ try
644704
Move-Item ($Folder + '\*') $Cef64 -force
645705
Remove-Item $Folder
646706
}
707+
708+
$LocalFile = Join-Path $WorkingDir $CefArm64FileName
709+
710+
if (-not (Test-Path $LocalFile))
711+
{
712+
Write-Diagnostic "Downloading $CefArm64FileName; this will take a while as the file is $CefArm64FileSize MB."
713+
$Client.DownloadFile($CefBuildServerUrl + [System.Web.HttpUtility]::UrlEncode($CefArm64FileName), $LocalFile);
714+
715+
$CefArm64LocalFileHash = (Get-FileHash -Path $LocalFile -Algorithm SHA1).Hash
716+
717+
Write-Diagnostic "Download $CefArm64FileName complete"
718+
Write-Diagnostic "Expected SHA1 for $CefArm64FileName $CefArm64FileHash"
719+
Write-Diagnostic "Actual SHA1 for $CefArm64FileName $CefArm64LocalFileHash"
720+
721+
if($CefArm64LocalFileHash -ne $CefArm64FileHash)
722+
{
723+
Die "SHA1 hash did not match"
724+
}
725+
}
726+
727+
if (-not (Test-Path (Join-Path $CefArm64 '\include\cef_version.h')))
728+
{
729+
# Extract bzip file
730+
sz e $LocalFile
731+
732+
# Extract tar file
733+
$TarFile = ($LocalFile).Substring(0, $LocalFile.length - 4)
734+
sz x $TarFile
735+
736+
# Sleep for a short period to allow 7z to release it's file handles
737+
sleep -m 2000
738+
739+
# Remove tar file
740+
Remove-Item $TarFile
741+
742+
$Folder = Join-Path $WorkingDir ($CefArm64FileName.Substring(0, $CefArm64FileName.length - 8))
743+
Move-Item ($Folder + '\*') $CefArm64 -force
744+
Remove-Item $Folder
745+
}
647746
}
648747

649748
function CopyFromLocalCefBuild()
@@ -656,6 +755,7 @@ try
656755

657756
$Cef32FileName = "cef_binary_$($CefVersion)_windows32." + $Extension;
658757
$Cef64FileName = "cef_binary_$($CefVersion)_windows64." + $Extension;
758+
$CefArm64FileName = "cef_binary_$($CefVersion)_windowsarm64." + $Extension;
659759

660760
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
661761

@@ -730,6 +830,37 @@ try
730830
Move-Item ($Folder + '\*') $Cef64 -force
731831
Remove-Item $Folder
732832
}
833+
834+
$LocalFile = Join-Path $WorkingDir $CefArm64FileName
835+
836+
if (-not (Test-Path $LocalFile))
837+
{
838+
Write-Diagnostic "Copy $CefArm64FileName (approx 200mb)"
839+
Copy-Item ($CefBuildDir+$CefArm64FileName) $LocalFile;
840+
Write-Diagnostic "Copy of $CefArm64FileName complete"
841+
}
842+
843+
if (-not (Test-Path (Join-Path $CefArm64 '\include\cef_version.h')))
844+
{
845+
# Extract bzip file
846+
sz x $LocalFile;
847+
848+
if ($Extension -eq "tar.bz2")
849+
{
850+
# Extract tar file
851+
$TarFile = ($LocalFile).Substring(0, $LocalFile.length - 4)
852+
sz x $TarFile
853+
854+
# Sleep for a short period to allow 7z to release it's file handles
855+
sleep -m 2000
856+
857+
# Remove tar file
858+
Remove-Item $TarFile
859+
}
860+
$Folder = Join-Path $WorkingDir ($CefArm64FileName.Substring(0, $CefArm64FileName.length - ($Extension.Length+1)))
861+
Move-Item ($Folder + '\*') $CefArm64 -force
862+
Remove-Item $Folder
863+
}
733864
}
734865

735866
function WriteVersionToRuntimeJson

cef_binary_3.y.z_windowsarm64/.empty

Whitespace-only changes.

0 commit comments

Comments
 (0)