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
1416Param (
1517 [switch ]$test ,
1618 [switch ]$debug ,
1719 [switch ]$x86 ,
1820 [switch ]$x64
21+ [switch ]$arm64
1922)
2023
2124Set-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 )
@@ -113,7 +117,7 @@ try {
113117 cd build
114118
115119 if ($x86.IsPresent ) {
116- Write-Output " Building 32-bit ..."
120+ Write-Output " Building x86 ..."
117121 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 " .. }
118122 Run- Command - Fatal { & $cmake -- build . -- config $configuration }
119123 if ($test.IsPresent ) { Run- Command - Quiet - Fatal { & $ctest - V . } }
@@ -127,7 +131,7 @@ try {
127131 }
128132
129133 if ($x64.IsPresent ) {
130- Write-Output " Building 64-bit ..."
134+ Write-Output " Building x64 ..."
131135 Run- Command - Quiet { & mkdir build64 }
132136 cd build64
133137 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 {
141145 Run- Command - Quiet - Fatal { & copy - fo * $x64Directory - Exclude * .lib }
142146 }
143147
148+ if ($arm64.IsPresent ) {
149+ Write-Output " Building arm64..."
150+ Run- Command - Quiet { & mkdir buildarm64 }
151+ cd buildarm64
152+ 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 " ../ .. }
153+ Run- Command - Fatal { & $cmake -- build . -- config $configuration }
154+ if ($test.IsPresent ) { Run- Command - Quiet - Fatal { & $ctest - V . } }
155+ cd $configuration
156+ Assert-Consistent - Naming " $binaryFilename .dll" " *.dll"
157+ Run- Command - Quiet { & rm * .exp }
158+ Run- Command - Quiet { & rm $arm64Directory \* - ErrorAction Ignore }
159+ Run- Command - Quiet { & mkdir - fo $arm64Directory }
160+ Run- Command - Quiet - Fatal { & copy - fo * $arm64Directory - Exclude * .lib }
161+ }
162+
144163 Write-Output " Done!"
145164}
146165finally {
0 commit comments