-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.ps1
105 lines (102 loc) · 2.29 KB
/
make.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
98
99
100
101
102
103
104
105
function FindMSBuild
{
$msBuildVersions = @("14.0")
foreach ($msBuildVersion in $msBuildVersions)
{
$key = "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\{0}" -f $msBuildVersion
$property = Get-ItemProperty $key -ErrorAction SilentlyContinue
if ($property -eq $null -or $property.MSBuildToolsPath -eq $null)
{
continue
}
$path = Join-Path $property.MSBuildToolsPath -ChildPath "MSBuild.exe"
if (Test-Path $path)
{
return $path
}
}
return $null
}
if ($args.Length -eq 0)
{
echo "Command list:"
echo ""
echo " all Builds the game and its development tools."
echo " dependencies Thid third-party libraries."
echo ""
$command = (Read-Host "Enter command").Split(' ', 2)
}
else
{
$command = $args
}
if ($command -eq "all")
{
$msBuild = FindMSBuild
if ($msBuild -eq $null)
{
echo "Unable to locate an appropriate version of MSBuild."
}
else
{
$msBuildArguments = "Cnc.sln /t:Build /p:Configuration=Release /nr:false"
$proc = Start-Process $msbuild $msBuildArguments -NoNewWindow -PassThru -Wait
if ($proc.ExitCode -ne 0)
{
echo "Cnc build failed."
}
else
{
echo "Build succeeded."
}
}
}
elseif ($command -eq "dependencies")
{
$msBuild = FindMSBuild
if ($msBuild -eq $null)
{
echo "Unable to locate an appropriate version of MSBuild."
}
else
{
$lpngDir = "src/third_party/lpng162/projects/vstudio"
$msBuildArguments = $lpngDir + "/vstudio.sln /t:zlib;libpng /p:Configuration=Release /nr:false"
$proc = Start-Process $msbuild $msBuildArguments -NoNewWindow -PassThru -Wait
if ($proc.ExitCode -ne 0)
{
echo "lpng162 build failed."
}
else
{
$configurations = @("Debug", "Release")
foreach ($configuration in $configurations)
{
$sourceFiles = $lpngDir + "/Release/*.dll"
$destinationFolder = "bin/" + $configuration
if ((Test-Path $destinationFolder) -eq 0)
{
mkdir $destinationFolder
}
cp $sourceFiles $destinationFolder
}
echo "Dependencies build done and copied."
}
}
}
else
{
echo ("Invalid command '{0}'" -f $command)
}
if ($args.Length -eq 0)
{
echo "Press enter to continue."
while ($true)
{
if ([System.Console]::KeyAvailable)
{
break;
}
Start-Sleep -Milliseconds 50
}
}