forked from ModOrganizer2/mob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.ps1
55 lines (44 loc) · 1.28 KB
/
bootstrap.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
param(
[switch]
$Verbose,
[ValidateSet("Debug", "RelWithDebInfo", "Release")]
[string]
$Config = "Release"
)
$root = $PSScriptRoot
if (!$root) {
$root = "."
}
$output = if ($Verbose) { "Out-Default" } else { "Out-Null" }
cmake -B $root/build $root | & $output
$installationPath = & $root\third-party\bin\vswhere.exe -products * -nologo -prerelease -latest -property installationPath
if (! $?) {
Write-Error "vswhere returned $LastExitCode"
exit $LastExitCode
}
if (! $installationPath) {
Write-Error "Empty installation path"
exit 1
}
$opts = ""
$opts += " $root\build\mob.sln"
$opts += " -m"
$opts += " -p:Configuration=${Config}"
$opts += " -noLogo"
$opts += " -p:UseMultiToolTask=true"
$opts += " -p:EnforceProcessCountAcrossBuilds=true"
if (!$Verbose) {
$opts += " -clp:ErrorsOnly;Verbosity=minimal"
}
$vsDevCmd = "$installationPath\Common7\Tools\VsDevCmd.bat"
if (!(Test-Path "$vsDevCmd")) {
Write-Error "VdDevCmd.bat not found at $vsDevCmd"
exit 1
}
& "${env:COMSPEC}" /c "`"$vsDevCmd`" -no_logo -arch=amd64 -host_arch=amd64 && msbuild $opts"
if (! $?) {
Write-Error "Build failed"
exit $LastExitCode
}
Copy-Item "$root\build\src\${Config}\mob.exe" "$root\mob.exe"
Write-Output "run ``.\mob -d prefix/path build`` to start building"