-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
150 lines (144 loc) · 5.31 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#
# Syntax: build.ps1 [options] -m <build-mode>
# build.ps1 -c
# Options:
# -m Specify build mode. Accepted values are
# 'debug', 'debug-test',
# 'release', 'release-test',
# 'minsizerel', and 'minsizerel-test'
# -c Clean built files. Use in conjunction with '-m' to clean built files in a specific build folder.
# -h Display help and exit.
#
[CmdletBinding()] param(
[string]$m,
[switch]$c,
[switch]$h
)
if ($h.IsPresent) {
Write-Output "Syntax: build.ps1 [options] -m <build-mode>"
Write-Output " build.ps1 -c"
Write-Output "Options:"
Write-Output " -m Specify build mode. Accepted values are"
Write-Output " 'debug', 'debug-test',"
Write-Output " 'release', 'release-test',"
Write-Output " 'minsizerel', and 'minsizerel-test'"
Write-Output " -c Clean built files. Use in conjunction with '-m' to clean built files in a specific build folder."
Write-Output " -h Display this help and exit."
exit 0
}
if ( $c.IsPresent -and (!$PSBoundParameters.ContainsKey('m')) ) {
Write-Output "[ Clean | All ]"
Write-Output "cmake --build ./cmake-build-debug --target clean -j 9"
cmake --build ./cmake-build-debug --target clean -j 9
Write-Output "cmake --build ./cmake-build-release --target clean -j 9"
cmake --build ./cmake-build-release --target clean -j 9
Write-Output "cmake --build ./cmake-build-minsizerel --target clean -j 9"
cmake --build ./cmake-build-minsizerel --target clean -j 9
exit 0
}
switch ($m) {
"" {
Write-Host "Error: No build mode specified. Try 'build.ps1 -h' for more information." -ForegroundColor Red
exit 1
}
"debug" {
if ($c.IsPresent)
{
Write-Output "[ Clean | Debug ]"
Write-Output "cmake --build ./cmake-build-debug --target clean -j 9"
cmake --build ./cmake-build-debug --target clean -j 9
Write-Output "[ Clean finished ]"
}
else
{
Write-Output "[ Build | Debug ]"
Write-Output "cmake --build ./cmake-build-debug --target lodging -j 9"
cmake --build ./cmake-build-debug --target lodging -j 9
Write-Output "[ Build finished ]"
}
}
"debug-tests" {
if ($c.IsPresent)
{
Write-Output "[ Clean | Debug ]"
Write-Output "cmake --build ./cmake-build-debug --target clean -j 9"
cmake --build ./cmake-build-debug --target clean -j 9
Write-Output "[ Clean finished ]"
}
else
{
Write-Output "[ Build | Debug ]"
Write-Output "cmake --build ./cmake-build-debug --target lodging all-tests -j 9"
cmake --build ./cmake-build-debug --target lodging all-tests -j 9
Write-Output "[ Build finished ]"
}
}
"release" {
if ($c.IsPresent)
{
Write-Output "[ Clean | Release ]"
Write-Output "cmake --build ./cmake-build-release --target clean -j 9"
cmake --build ./cmake-build-release --target clean -j 9
Write-Output "[ Clean finished ]"
}
else
{
Write-Output "[ Build | Release ]"
Write-Output "cmake --build ./cmake-build-release --target lodging -j 9"
cmake --build ./cmake-build-release --target lodging -j 9
Write-Output "[ Build finished ]"
}
}
"release-tests" {
if ($c.IsPresent)
{
Write-Output "[ Clean | Release ]"
Write-Output "cmake --build ./cmake-build-release --target clean -j 9"
cmake --build ./cmake-build-release --target clean -j 9
Write-Output "[ Clean finished ]"
}
else
{
Write-Output "[ Build | Release ]"
Write-Output "cmake --build ./cmake-build-release --target lodging all-tests -j 9"
cmake --build ./cmake-build-release --target lodging all-tests -j 9
Write-Output "[ Build finished ]"
}
}
"minsizerel" {
if ($c.IsPresent)
{
Write-Output "[ Clean | Release ]"
Write-Output "cmake --build ./cmake-build-minsizerel --target clean -j 9"
cmake --build ./cmake-build-minsizerel --target clean -j 9
Write-Output "[ Clean finished ]"
}
else
{
Write-Output "[ Build | Release ]"
Write-Output "cmake --build ./cmake-build-minsizerel --target lodging -j 9"
cmake --build ./cmake-build-minsizerel --target lodging -j 9
Write-Output "[ Build finished ]"
}
}
"minsizerel-test" {
if ($c.IsPresent)
{
Write-Output "[ Clean | Release ]"
Write-Output "cmake --build ./cmake-build-minsizerel --target clean -j 9"
cmake --build ./cmake-build-minsizerel --target clean -j 9
Write-Output "[ Clean finished ]"
}
else
{
Write-Output "[ Build | Release ]"
Write-Output "cmake --build ./cmake-build-minsizerel --target lodging all-tests -j 9"
cmake --build ./cmake-build-minsizerel --target lodging all-tests -j 9
Write-Output "[ Build finished ]"
}
}
Default {
Write-Host "Invalid build mode '$m'" -ForegroundColor Red
exit 1
}
}