Skip to content

Commit 8aa4d13

Browse files
authored
Merge pull request #125 from A-Ovchinnikov-mx/mendix/windows-arm64-support
Add Windows arm64 native binaries
2 parents 8b862d4 + 58a3bc0 commit 8aa4d13

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
- os: windows-2019
2323
name: win-x64
2424
param: -x64
25+
- os: windows-2019
26+
name: win-arm64
27+
param: -arm64
2528
- os: ubuntu-20.04
2629
name: linux-x64
2730
- os: ubuntu-20.04

UpdateLibgit2ToSha.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Push-Location $libgit2Directory
109109
<ItemGroup>
110110
<ContentWithTargetPath Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\*" TargetPath="lib\win32\x86\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
111111
<ContentWithTargetPath Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\*" TargetPath="lib\win32\x64\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
112+
<ContentWithTargetPath Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\win-arm64\native\*" TargetPath="lib\win32\arm64\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
112113
<ContentWithTargetPath Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\**\*`" Exclude="`$(MSBuildThisFileDirectory)\..\..\runtimes\win-*\**\*" TargetPath="lib\%(RecursiveDir)..\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
113114
<ContentWithTargetPath Include="`$(MSBuildThisFileDirectory)\..\..\libgit2\LibGit2Sharp.dll.config" TargetPath="LibGit2Sharp.dll.config" CopyToOutputDirectory="PreserveNewest" />
114115
</ItemGroup>

build.libgit2.ps1

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66
.PARAMETER debug
77
If set, build the "Debug" configuration of libgit2, rather than "Release" (default).
88
.PARAMETER x86
9-
If set, the 32-bit version will be built.
9+
If set, the x86 version will be built.
1010
.PARAMETER x64
11-
If set, the 64-bit version will be built.
11+
If set, the x64 version will be built.
12+
.PARAMETER arm64
13+
If set, the arm64 version will be built.
1214
#>
1315

1416
Param(
1517
[switch]$test,
1618
[switch]$debug,
1719
[switch]$x86,
18-
[switch]$x64
20+
[switch]$x64,
21+
[switch]$arm64
1922
)
2023

2124
Set-StrictMode -Version Latest
@@ -24,6 +27,7 @@ $projectDirectory = Split-Path $MyInvocation.MyCommand.Path
2427
$libgit2Directory = Join-Path $projectDirectory "libgit2"
2528
$x86Directory = Join-Path $projectDirectory "nuget.package\runtimes\win-x86\native"
2629
$x64Directory = Join-Path $projectDirectory "nuget.package\runtimes\win-x64\native"
30+
$arm64Directory = Join-Path $projectDirectory "nuget.package\runtimes\win-arm64\native"
2731
$hashFile = Join-Path $projectDirectory "nuget.package\libgit2\libgit2_hash.txt"
2832
$sha = Get-Content $hashFile
2933
$binaryFilename = "git2-" + $sha.Substring(0,7)
@@ -108,7 +112,7 @@ try {
108112
cd build
109113

110114
if ($x86.IsPresent) {
111-
Write-Output "Building 32-bit..."
115+
Write-Output "Building x86..."
112116
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" .. }
113117
Run-Command -Fatal { & $cmake --build . --config $configuration }
114118
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
@@ -122,7 +126,7 @@ try {
122126
}
123127

124128
if ($x64.IsPresent) {
125-
Write-Output "Building 64-bit..."
129+
Write-Output "Building x64..."
126130
Run-Command -Quiet { & mkdir build64 }
127131
cd build64
128132
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" ../.. }
@@ -136,6 +140,21 @@ try {
136140
Run-Command -Quiet -Fatal { & copy -fo * $x64Directory -Exclude *.lib }
137141
}
138142

143+
if ($arm64.IsPresent) {
144+
Write-Output "Building arm64..."
145+
Run-Command -Quiet { & mkdir buildarm64 }
146+
cd buildarm64
147+
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" ../.. }
148+
Run-Command -Fatal { & $cmake --build . --config $configuration }
149+
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
150+
cd $configuration
151+
Assert-Consistent-Naming "$binaryFilename.dll" "*.dll"
152+
Run-Command -Quiet { & rm *.exp }
153+
Run-Command -Quiet { & rm $arm64Directory\* -ErrorAction Ignore }
154+
Run-Command -Quiet { & mkdir -fo $arm64Directory }
155+
Run-Command -Quiet -Fatal { & copy -fo * $arm64Directory -Exclude *.lib }
156+
}
157+
139158
Write-Output "Done!"
140159
}
141160
finally {

nuget.package/build/net46/LibGit2Sharp.NativeBinaries.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<ItemGroup>
88
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\*" TargetPath="lib\win32\x86\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
99
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\*" TargetPath="lib\win32\x64\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
10+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-arm64\native\*" TargetPath="lib\win32\arm64\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
1011
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)\..\..\runtimes\**\*" Exclude="$(MSBuildThisFileDirectory)\..\..\runtimes\win-*\**\*" TargetPath="lib\%(RecursiveDir)..\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
1112
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)\..\..\libgit2\LibGit2Sharp.dll.config" TargetPath="LibGit2Sharp.dll.config" CopyToOutputDirectory="PreserveNewest" />
1213
</ItemGroup>

0 commit comments

Comments
 (0)