From c14c2bbf4228cb034ad05b49114e608b2dec4f48 Mon Sep 17 00:00:00 2001 From: Alexander Ovchinnikov Date: Tue, 24 Aug 2021 17:40:47 +0200 Subject: [PATCH 1/3] Add Windows arm64 native binaries --- .github/workflows/ci.yml | 3 +++ build.libgit2.ps1 | 27 ++++++++++++++++--- .../net46/LibGit2Sharp.NativeBinaries.props | 1 + 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 837be068..466fce59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,9 @@ jobs: - os: windows-2019 name: win-x64 param: -x64 + - os: windows-2019 + name: win-arm64 + param: -arm64 - os: ubuntu-20.04 name: linux-x64 - os: ubuntu-20.04 diff --git a/build.libgit2.ps1 b/build.libgit2.ps1 index a68a38a3..0cbe4129 100644 --- a/build.libgit2.ps1 +++ b/build.libgit2.ps1 @@ -6,9 +6,11 @@ .PARAMETER debug If set, build the "Debug" configuration of libgit2, rather than "Release" (default). .PARAMETER x86 - If set, the 32-bit version will be built. + If set, the x86 version will be built. .PARAMETER x64 - If set, the 64-bit version will be built. + If set, the x64 version will be built. +.PARAMETER arm64 + If set, the arm64 version will be built. #> Param( @@ -16,6 +18,7 @@ Param( [switch]$debug, [switch]$x86, [switch]$x64 + [switch]$arm64 ) Set-StrictMode -Version Latest @@ -24,6 +27,7 @@ $projectDirectory = Split-Path $MyInvocation.MyCommand.Path $libgit2Directory = Join-Path $projectDirectory "libgit2" $x86Directory = Join-Path $projectDirectory "nuget.package\runtimes\win-x86\native" $x64Directory = Join-Path $projectDirectory "nuget.package\runtimes\win-x64\native" +$arm64Directory = Join-Path $projectDirectory "nuget.package\runtimes\win-arm64\native" $hashFile = Join-Path $projectDirectory "nuget.package\libgit2\libgit2_hash.txt" $sha = Get-Content $hashFile $binaryFilename = "git2-" + $sha.Substring(0,7) @@ -113,7 +117,7 @@ try { cd build if ($x86.IsPresent) { - Write-Output "Building 32-bit..." + Write-Output "Building x86..." Run-Command -Fatal { & $cmake -G "Visual Studio 16 2019" -A Win32 -D ENABLE_TRACE=ON -D USE_SSH=OFF -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" .. } Run-Command -Fatal { & $cmake --build . --config $configuration } if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } } @@ -127,7 +131,7 @@ try { } if ($x64.IsPresent) { - Write-Output "Building 64-bit..." + Write-Output "Building x64..." Run-Command -Quiet { & mkdir build64 } cd build64 Run-Command -Fatal { & $cmake -G "Visual Studio 16 2019" -A x64 -D THREADSAFE=ON -D USE_SSH=OFF -D ENABLE_TRACE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" ../.. } @@ -141,6 +145,21 @@ try { Run-Command -Quiet -Fatal { & copy -fo * $x64Directory -Exclude *.lib } } + if ($arm64.IsPresent) { + Write-Output "Building arm64..." + Run-Command -Quiet { & mkdir buildarm64 } + cd buildarm64 + Run-Command -Fatal { & $cmake -G "Visual Studio 16 2019" -A ARM64 -D THREADSAFE=ON -D USE_SSH=OFF -D ENABLE_TRACE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" ../.. } + Run-Command -Fatal { & $cmake --build . --config $configuration } + if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } } + cd $configuration + Assert-Consistent-Naming "$binaryFilename.dll" "*.dll" + Run-Command -Quiet { & rm *.exp } + Run-Command -Quiet { & rm $arm64Directory\* -ErrorAction Ignore } + Run-Command -Quiet { & mkdir -fo $arm64Directory } + Run-Command -Quiet -Fatal { & copy -fo * $arm64Directory -Exclude *.lib } + } + Write-Output "Done!" } finally { diff --git a/nuget.package/build/net46/LibGit2Sharp.NativeBinaries.props b/nuget.package/build/net46/LibGit2Sharp.NativeBinaries.props index 1da2c35c..3edceee5 100644 --- a/nuget.package/build/net46/LibGit2Sharp.NativeBinaries.props +++ b/nuget.package/build/net46/LibGit2Sharp.NativeBinaries.props @@ -7,6 +7,7 @@ + From 51cd81ae9f4a3d904142b469d6b2d3681eb6df71 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Wed, 15 Sep 2021 19:42:32 -0400 Subject: [PATCH 2/3] Add missing comma --- build.libgit2.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.libgit2.ps1 b/build.libgit2.ps1 index 0cbe4129..c428c4f9 100644 --- a/build.libgit2.ps1 +++ b/build.libgit2.ps1 @@ -17,7 +17,7 @@ Param( [switch]$test, [switch]$debug, [switch]$x86, - [switch]$x64 + [switch]$x64, [switch]$arm64 ) From 58a3bc014218369342e99599fa0fdcf9e551081d Mon Sep 17 00:00:00 2001 From: Alexander Ovchinnikov Date: Thu, 16 Sep 2021 10:45:53 +0200 Subject: [PATCH 3/3] Include arm64 in UpdateLibgit2ToSha.ps1 --- UpdateLibgit2ToSha.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/UpdateLibgit2ToSha.ps1 b/UpdateLibgit2ToSha.ps1 index bf6ead69..e78cd534 100644 --- a/UpdateLibgit2ToSha.ps1 +++ b/UpdateLibgit2ToSha.ps1 @@ -109,6 +109,7 @@ Push-Location $libgit2Directory +