-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
28 lines (22 loc) · 844 Bytes
/
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
$gitHash = git rev-parse HEAD
$gitTag = git describe --tags --always --dirty
$vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
$vsInstallationPath = & $vswhere -latest -products * -property installationPath
$msbuildPath = Join-Path $vsInstallationPath "MSBuild\Current\Bin\MSBuild.exe"
# Check if msbuild.exe exists at the constructed path
if (Test-Path $msbuildPath) {
Write-Host "Found msbuild.exe at: $msbuildPath"
} else {
Write-Error "msbuild.exe not found at: $msbuildPath"
break
}
@"
#pragma once
#define GIT_HASH "$gitHash"
#define GIT_TAG "$gitTag"
"@ | Out-File -FilePath git_info.h -Encoding ascii
write-host "`nBuilding...`n"
# Set alias for msbuild
Set-Alias msbuild $msbuildPath
# Run msbuild with desired parameters
& MSBuild PixElv.sln -property:Configuration=Release -t:rebuild