-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.ps1
36 lines (30 loc) · 1.12 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
param(
[Parameter(
Mandatory=$true,
Position=0,
HelpMessage='Set compiler path variable')]
[string] $spCompPath,
[Parameter(
Mandatory=$true,
Position=1,
ValueFromRemainingArguments,
HelpMessage='Set source and include arguments passed to the compiler')]
[string[]] $spArgs
)
# location gets pushed on a stack since -Dpath does not work on windows.
Push-Location $PSScriptRoot
$executable = $spCompPath
$outPath = Join-Path -Path $PSScriptRoot -ChildPath '/addons/sourcemod/plugins'
$includePaths = $spArgs.Where{$_ -like '-i=*'}
$scripts = $spArgs.Where{$_ -notlike '-i=*'}
$optimization = '-O2'
$verbosity = '-v2'
foreach ($script in $scripts)
{
$outArg = [System.IO.Path]::GetFileNameWithoutExtension($script) + ".smx"
$outArg = Join-Path -Path $outPath -ChildPath $outArg
$outArg = '-o=' + $outArg
Write-Host start compiling "'$script'"
& $executable $script $outArg $includePaths $optimization $verbosity
}
Pop-Location