-
Notifications
You must be signed in to change notification settings - Fork 7
/
build-library.ps1
68 lines (55 loc) · 1.4 KB
/
build-library.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
#powershell -ExecutionPolicy ByPass -File build-library.ps1
param(
[switch] $make64bit
)
#https://gist.github.com/IlyaFinkelshteyn/79af78657660e118b15d3ab9d62ab8a1
function BuildLibrary([bool] $is64bit)
{
Write-Host "Generating CMake..."
mkdir build -Force
cd build
if ($is64bit)
{
Write-Host "Generating 64bit..."
cmake .. -DCMAKE_GENERATOR_PLATFORM=x64
Write-Host "Generating Build Target..."
#msbuild "NativeNamedPipe.sln" /p:Configuration=$target /p:Platform=x64
msbuild "NativeNamedPipe.sln" /p:Configuration=Release /p:Platform=x64
}
else
{
Write-Host "Generating 32bit..."
cmake ..
Write-Host "Generating Build Target..."
#msbuild "NativeNamedPipe.sln" /p:Configuration=$target
msbuild "NativeNamedPipe.sln" /p:Configuration=Release
}
if ($LASTEXITCODE -ne 0)
{
cd ..
throw "Error occured while building project."
}
cd ..
Write-Host "Collecting Artifacts..."
mkdir "artifacts" -Force
if ($is64bit)
{
cp "build\\UnityNamedPipe.Native\\Release\\NativeNamedPipe.dll" "artifacts\\NativeNamedPipe.dll"
}
else
{
cp "build\\UnityNamedPipe.Native\\Release\\NativeNamedPipe.dll" "artifacts\\NativeNamedPipe_x86.dll"
}
Write-Host "Cleaning Up..."
Remove-Item -path build -recurse -force
}
Write-Host "=== Unity Named Pipe Windows Build ==="
if ($make64bit)
{
BuildLibrary $true
}
else
{
BuildLibrary $false
}
Write-Host "Done!"