-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
97 lines (94 loc) · 3.28 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
#
# Syntax: build.ps1 [Options] -m <build-mode>
# Options:
# -m Specify build mode. Accepted values are 'debug', 'debug-test', 'release', and 'release-test'
# -c (Optional) Clean built files. Use in conjunction with '-m'
# -h (Optional) 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 "Options:"
Write-Output " -m Specify build mode. Accepted values are 'debug', 'debug-tests', 'release', and 'release-tests'"
Write-Output " -c (Optional) Clean built files. Use in conjunction with '-m'"
Write-Output " -h (Optional) Display this help and exit."
exit 0
}
switch ($m) {
"" {
Write-Host "Error: No build mode specified. Try 'build.sh -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 dsvcol -j 9"
cmake --build ./cmake-build-debug --target dsvcol -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 all-tests -j 9"
cmake --build ./cmake-build-debug --target 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 dsvcol -j 9"
cmake --build ./cmake-build-release --target dsvcol -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 all-tests -j 9"
cmake --build ./cmake-build-release --target all-tests -j 9
Write-Output "[ Build finished ]"
}
}
Default {
Write-Host "Invalid build mode '$m'" -ForegroundColor Red
exit 1
}
}