forked from pietern/goestools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBuild.ps1
69 lines (59 loc) · 2.4 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
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
if(!!(Get-Command 'tf' -ErrorAction SilentlyContinue) -eq $false)
{
Write-Error "You must run this script within Developer Powershell for Visual Studio 2022"
exit
}
$vcpkg = "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\vcpkg"
if(-not $(Test-Path $vcpkg -ErrorAction SilentlyContinue))
{
Write-Error "Could not find vcpkg at $vcpkg"
exit
}
#Set up build folder
cd $(Split-Path -Parent $MyInvocation.MyCommand.Path)
Remove-Item build -Force -Recurse -ErrorAction SilentlyContinue | Out-null
mkdir build | Out-null
cd build | Out-null
#Do the builds
foreach($arch in $("win32", "x64"))
{
Write-Output "Building for $arch..."
mkdir "build-$arch" | Out-Null
cd "build-$arch"
cmake ..\.. "-DCMAKE_TOOLCHAIN_FILE=$($vcpkg.Replace("\", "/"))/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 17 2022" -A $arch
cmake --build . --config Release
#Create the bundle folder and put everything in it
Write-Output "Making $arch distributable folder..."
cd ..
mkdir "dist-$arch" | Out-Null
cd "dist-$arch"
mkdir bin | Out-Null
mkdir Saved | Out-Null
cp -Force ..\build-$arch\src\assembler\Release\*.exe bin/
cp -Force ..\build-$arch\src\dcs\Release\*.exe bin/
cp -Force ..\build-$arch\src\dcs\Release\*.dll bin/
cp -Force ..\build-$arch\src\decoder\Release\*.exe bin/
cp -Force ..\build-$arch\src\goesemwin\Release\*.exe bin/
cp -Force ..\build-$arch\src\goesemwin\Release\*.dll bin/
cp -Force ..\build-$arch\src\goeslrit\Release\*.exe bin/
cp -Force ..\build-$arch\src\goeslrit\Release\*.dll bin/
cp -Force ..\build-$arch\src\goespackets\Release\*.exe bin/
cp -Force ..\build-$arch\src\goespackets\Release\*.dll bin/
cp -Force ..\build-$arch\src\goesproc\Release\*.exe bin/
cp -Force ..\build-$arch\src\goesproc\Release\*.dll bin/
cp -Force ..\build-$arch\src\goesrecv\Release\*.exe bin/
cp -Force ..\build-$arch\src\goesrecv\Release\*.dll bin/
cp -Force ..\build-$arch\src\lib\Release\*.exe bin/
cp -Force ..\build-$arch\src\lib\Release\*.dll bin/
cp -Force ..\build-$arch\src\lrit\Release\*.exe bin/
cp -Force ..\build-$arch\src\lrit\Release\*.dll bin/
cp ..\..\README.md .
cp $vcpkg\installed\x64-windows\share\proj\proj.db bin/
cp -r ..\..\share .
cp -r ..\..\LICENSES .
cp -r ..\..\config .
cp ..\..\scripts\* .
cd ..
}
Write-Output "Done! Your build is ready at $($(pwd).path)"
pause