Initial commit
This commit is contained in:
36
payload/build_payload.ps1
Normal file
36
payload/build_payload.ps1
Normal file
@@ -0,0 +1,36 @@
|
||||
param(
|
||||
[ValidateSet("debug", "release", "size")]
|
||||
[string]$mode = "size",
|
||||
|
||||
[ValidateSet("native", "c", "js_node", "go")]
|
||||
[string]$target = "c",
|
||||
|
||||
[ValidateSet("build", "run")]
|
||||
[string]$action = "build"
|
||||
)
|
||||
|
||||
if (-not (Test-Path "build")) {
|
||||
New-Item -ItemType Directory -Path "build" | Out-Null
|
||||
}
|
||||
|
||||
if ($mode -eq "debug") {
|
||||
v -g -cg -b $target -enable-globals -o build/nude_bug .
|
||||
}
|
||||
elseif ($mode -eq "release") {
|
||||
v -prod -cflags "-O3" -Wfatal-errors -enable-globals -q -skip-unused -b $target -o build/nude_release .
|
||||
}
|
||||
elseif ($mode -eq "size") {
|
||||
v -prod -cflags "-Os -s" -Wfatal-errors -enable-globals -q -skip-unused -b $target -o build/nude_optimized .
|
||||
}
|
||||
|
||||
$exe = switch ($mode) {
|
||||
"debug" { "nude_bug.exe" }
|
||||
"release" { "nude_release.exe" }
|
||||
"size" { "nude_optimized.exe" }
|
||||
}
|
||||
|
||||
$v_output = Join-Path -Path "build" -ChildPath $exe
|
||||
|
||||
if ($action -eq "run") {
|
||||
& $v_output
|
||||
}
|
||||
Reference in New Issue
Block a user