Skip to content

Commit ed246f2

Browse files
authored
Merge pull request #142 from libgit2/ethomson/script_fixes
Miscellaneous build script improvements
2 parents 9469eab + 8e4bb35 commit ed246f2

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

build.libgit2.ps1

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
If set, the x64 version will be built.
1212
.PARAMETER arm64
1313
If set, the arm64 version will be built.
14+
.PARAMETER arm64
15+
If set, the arm64 version will be built.
1416
#>
1517

1618
Param(
@@ -32,8 +34,8 @@ $hashFile = Join-Path $projectDirectory "nuget.package\libgit2\libgit2_hash.txt"
3234
$sha = Get-Content $hashFile
3335
$binaryFilename = "git2-" + $sha.Substring(0,7)
3436

35-
$build_clar = 'OFF'
36-
if ($test.IsPresent) { $build_clar = 'ON' }
37+
$build_tests = 'OFF'
38+
if ($test.IsPresent) { $build_tests = 'ON' }
3739

3840
$configuration = "Release"
3941
if ($debug.IsPresent) { $configuration = "Debug" }
@@ -102,6 +104,11 @@ function Assert-Consistent-Naming($expected, $path) {
102104
}
103105

104106
try {
107+
if ((!$x86.isPresent -and !$x64.IsPresent) -and !$arm64.IsPresent) {
108+
Write-Output -Stderr "Error: usage $MyInvocation.MyCommand [-x86] [-x64] [-arm64]"
109+
Exit
110+
}
111+
105112
Push-Location $libgit2Directory
106113

107114
$cmake = Find-CMake
@@ -113,7 +120,7 @@ try {
113120

114121
if ($x86.IsPresent) {
115122
Write-Output "Building x86..."
116-
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" .. }
123+
Run-Command -Fatal { & $cmake -A Win32 -D ENABLE_TRACE=ON -D USE_SSH=OFF -D "BUILD_TESTS=$build_tests" -D "BUILD_CLI=OFF" -D "LIBGIT2_FILENAME=$binaryFilename" .. }
117124
Run-Command -Fatal { & $cmake --build . --config $configuration }
118125
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
119126
cd $configuration
@@ -129,7 +136,7 @@ try {
129136
Write-Output "Building x64..."
130137
Run-Command -Quiet { & mkdir build64 }
131138
cd build64
132-
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" ../.. }
139+
Run-Command -Fatal { & $cmake -A x64 -D THREADSAFE=ON -D USE_SSH=OFF -D ENABLE_TRACE=ON -D "BUILD_TESTS=$build_tests" -D "BUILD_CLI=OFF" -D "LIBGIT2_FILENAME=$binaryFilename" ../.. }
133140
Run-Command -Fatal { & $cmake --build . --config $configuration }
134141
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
135142
cd $configuration
@@ -144,7 +151,7 @@ try {
144151
Write-Output "Building arm64..."
145152
Run-Command -Quiet { & mkdir buildarm64 }
146153
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" ../.. }
154+
Run-Command -Fatal { & $cmake -A ARM64 -D THREADSAFE=ON -D USE_SSH=OFF -D ENABLE_TRACE=ON -D "BUILD_TESTS=$build_tests" -D "BUILD_CLI=OFF" -D "LIBGIT2_FILENAME=$binaryFilename" ../.. }
148155
Run-Command -Fatal { & $cmake --build . --config $configuration }
149156
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
150157
cd $configuration

0 commit comments

Comments
 (0)