1
1
<#
2
2
. SYNOPSIS
3
3
Builds a version of libgit2 and copies it to the nuget packaging directory.
4
- . PARAMETER vs
5
- Version of Visual Studio project files to generate. Cmake supports "10" (default), "11" and "12".
6
4
. PARAMETER test
7
5
If set, run the libgit2 tests on the desired version.
8
6
. PARAMETER debug
9
- If set, build the "Debug" configuration of libgit2, rather than "RelWithDebInfo " (default).
7
+ If set, build the "Debug" configuration of libgit2, rather than "Release " (default).
10
8
#>
11
9
12
10
Param (
13
- [string ]$vs = ' 10' ,
14
11
[string ]$libgit2Name = ' ' ,
15
12
[switch ]$test ,
16
- [switch ]$debug
13
+ [switch ]$debug ,
14
+ [switch ]$x86 ,
15
+ [switch ]$x64
17
16
)
18
17
19
18
Set-StrictMode - Version Latest
@@ -34,7 +33,7 @@ if (![string]::IsNullOrEmpty($libgit2Name)) {
34
33
$build_clar = ' OFF'
35
34
if ($test.IsPresent ) { $build_clar = ' ON' }
36
35
37
- $configuration = " RelWithDebInfo "
36
+ $configuration = " Release "
38
37
if ($debug.IsPresent ) { $configuration = " Debug" }
39
38
40
39
function Run-Command ([scriptblock ]$Command , [switch ]$Fatal , [switch ]$Quiet ) {
@@ -106,33 +105,38 @@ try {
106
105
$cmake = Find-CMake
107
106
$ctest = Join-Path (Split-Path - Parent $cmake ) " ctest.exe"
108
107
109
- Write-Output " Building 32-bit..."
110
- Run- Command - Quiet { & remove-item build - recurse - force }
108
+ Run- Command - Quiet { & remove-item build - recurse - force - ErrorAction Ignore }
111
109
Run- Command - Quiet { & mkdir build }
112
110
cd build
113
- Run- Command - Quiet - Fatal { & $cmake - G " Visual Studio $vs " - D ENABLE_TRACE= ON - D " BUILD_CLAR=$build_clar " - D " LIBGIT2_FILENAME=$binaryFilename " .. }
114
- Run- Command - Quiet - Fatal { & $cmake -- build . -- config $configuration }
115
- if ($test.IsPresent ) { Run- Command - Quiet - Fatal { & $ctest - V . } }
116
- cd $configuration
117
- Assert-Consistent - Naming " $binaryFilename .dll" " *.dll"
118
- Run- Command - Quiet { & rm * .exp }
119
- Run- Command - Quiet { & rm $x86Directory \* }
120
- Run- Command - Quiet { & mkdir - fo $x86Directory }
121
- Run- Command - Quiet - Fatal { & copy - fo * $x86Directory - Exclude * .lib }
122
-
123
- Write-Output " Building 64-bit..."
124
- cd ..
125
- Run- Command - Quiet { & mkdir build64 }
126
- cd build64
127
- Run- Command - Quiet - Fatal { & $cmake - G " Visual Studio $vs " - A x64 - D THREADSAFE= ON - D ENABLE_TRACE= ON - D " BUILD_CLAR=$build_clar " - D " LIBGIT2_FILENAME=$binaryFilename " ../ .. }
128
- Run- Command - Quiet - Fatal { & $cmake -- build . -- config $configuration }
129
- if ($test.IsPresent ) { Run- Command - Quiet - Fatal { & $ctest - V . } }
130
- cd $configuration
131
- Assert-Consistent - Naming " $binaryFilename .dll" " *.dll"
132
- Run- Command - Quiet { & rm * .exp }
133
- Run- Command - Quiet { & rm $x64Directory \* }
134
- Run- Command - Quiet { & mkdir - fo $x64Directory }
135
- Run- Command - Quiet - Fatal { & copy - fo * $x64Directory - Exclude * .lib }
111
+
112
+ if ($x86.IsPresent ) {
113
+ Write-Output " Building 32-bit..."
114
+ Run- Command - Fatal { & $cmake - G " Visual Studio 16 2019" - D ENABLE_TRACE= ON - D USE_SSH= OFF - D " BUILD_CLAR=$build_clar " - D " LIBGIT2_FILENAME=$binaryFilename " .. }
115
+ Run- Command - Fatal { & $cmake -- build . -- config $configuration }
116
+ if ($test.IsPresent ) { Run- Command - Quiet - Fatal { & $ctest - V . } }
117
+ cd $configuration
118
+ Assert-Consistent - Naming " $binaryFilename .dll" " *.dll"
119
+ Run- Command - Quiet { & rm * .exp }
120
+ Run- Command - Quiet { & rm $x86Directory \* - ErrorAction Ignore }
121
+ Run- Command - Quiet { & mkdir - fo $x86Directory }
122
+ Run- Command - Quiet - Fatal { & copy - fo * $x86Directory - Exclude * .lib }
123
+ cd ..
124
+ }
125
+
126
+ if ($x64.IsPresent ) {
127
+ Write-Output " Building 64-bit..."
128
+ Run- Command - Quiet { & mkdir build64 }
129
+ cd build64
130
+ 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 " ../ .. }
131
+ Run- Command - Fatal { & $cmake -- build . -- config $configuration }
132
+ if ($test.IsPresent ) { Run- Command - Quiet - Fatal { & $ctest - V . } }
133
+ cd $configuration
134
+ Assert-Consistent - Naming " $binaryFilename .dll" " *.dll"
135
+ Run- Command - Quiet { & rm * .exp }
136
+ Run- Command - Quiet { & rm $x64Directory \* - ErrorAction Ignore }
137
+ Run- Command - Quiet { & mkdir - fo $x64Directory }
138
+ Run- Command - Quiet - Fatal { & copy - fo * $x64Directory - Exclude * .lib }
139
+ }
136
140
137
141
Write-Output " Done!"
138
142
}
0 commit comments