-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ps1
More file actions
69 lines (57 loc) · 2.39 KB
/
deploy.ps1
File metadata and controls
69 lines (57 loc) · 2.39 KB
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
param (
[string]$mingwFolder
)
# Define paths
$buildDir = "build"
$installDir = "install"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$innoSetupPath = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
$issScriptPath = Join-Path -Path $scriptDir -ChildPath "installer_script_updated.iss"
$UpdateISSScript = Join-Path -Path $scriptDir -ChildPath "update_iss_script.ps1"
$MoveRequiredLibsScript = Join-Path -Path $scriptDir -ChildPath "move_required_libs_for_windows.ps1"
$outputDir = "Output"
# Create build directory and navigate to it
if (-Not (Test-Path $buildDir)) {
New-Item -Path $buildDir -ItemType Directory
}
Set-Location -Path $buildDir
# Run CMake to configure the project
cmake.exe -G "MinGW Makefiles" .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install
# Build and install the project
mingw32-make.exe install
# Navigate to the install directory
$navDir = Join-Path -Path $scriptDir -ChildPath $buildDir
$navDir = Join-Path -Path $navDir -ChildPath $installDir
Set-Location -Path $navDir
# Move required libs under mingw to project install path
Write-Host "Running move_required_libs_for_windows.PS1 script..."
& $MoveRequiredLibsScript $mingwFolder
# Verify that the update script ran successfully
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to move required libs. Exiting..."
exit $LASTEXITCODE
}
# Remove unnecessary files
Remove-Item -Path .\include\ -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path .\lib\ -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path .\XNBC.desktop -Force -ErrorAction SilentlyContinue
# Remove old iss script
$oldISS = Join-Path -Path $scriptDir -ChildPath "installer_script_updated.iss"
Remove-Item $oldISS -Force -ErrorAction SilentlyContinue
# Run the PowerShell script to update the ISS script
Write-Host "Running update ISS script..."
& $UpdateISSScript
# Verify that the update script ran successfully
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to update the ISS script. Exiting."
exit $LASTEXITCODE
}
# Compile the Inno Setup script
Write-Host "Compiling Inno Setup script..."
& $innoSetupPath /O"$outputDir" $issScriptPath
# Verify that the compilation succeeded
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to compile the Inno Setup script."
exit $LASTEXITCODE
}
Write-Host "Script execution completed successfully."