-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_and_run.ps1
More file actions
80 lines (72 loc) · 2.65 KB
/
Copy pathbuild_and_run.ps1
File metadata and controls
80 lines (72 loc) · 2.65 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
70
71
72
73
74
75
76
77
78
79
80
# CTracker Build and Run unified script
Write-Host "=========================================" -ForegroundColor Cyan
Write-Host "CTracker Build and Run" -ForegroundColor Cyan
Write-Host "=========================================" -ForegroundColor Cyan
Write-Host ""
# 1. Build the application
Write-Host "Building CTracker..." -ForegroundColor Cyan
cmake -B CTracker/build -S CTracker
if ($LASTEXITCODE -ne 0) {
Write-Host "CMake configuration failed!" -ForegroundColor Red
exit $LASTEXITCODE
}
cmake --build CTracker/build
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit $LASTEXITCODE
}
Write-Host "Build completed successfully." -ForegroundColor Green
Write-Host ""
# 2. Extract Qt deploy function
Write-Host "Deploying Qt DLLs..." -ForegroundColor Cyan
$qtPaths = @(
"$env:QTDIR",
"E:\Qt\6.8.0\msvc2022_64",
"E:\Qt\6.7.0\msvc2022_64",
"E:\Qt\6.8.0\mingw_64",
"E:\Qt\6.7.0\mingw_64",
"C:\Qt\6.8.0\msvc2022_64",
"C:\Qt\6.7.0\msvc2022_64",
"C:\Qt\6.8.0\mingw_64",
"C:\Qt\6.7.0\mingw_64",
"$env:ProgramFiles\Qt\6.8.0\msvc2022_64"
)
$qtDir = $null
foreach ($path in $qtPaths) {
if ($path -and (Test-Path "$path\bin\Qt6Core.dll")) {
$qtDir = $path
Write-Host "Found Qt at: $qtDir" -ForegroundColor Green
break
}
}
if ($qtDir) {
$windeployqt = "$qtDir\bin\windeployqt.exe"
if (Test-Path $windeployqt) {
Write-Host "Running windeployqt..." -ForegroundColor Yellow
& $windeployqt "CTracker\build\CTracker.exe" --no-translations --no-system-d3d-compiler --no-opengl-sw
$platformDir = "CTracker\build\platforms"
if (-not (Test-Path $platformDir)) {
New-Item -ItemType Directory -Path $platformDir | Out-Null
}
foreach ($platformPlugin in @("qoffscreen.dll", "qminimal.dll")) {
$source = "$qtDir\plugins\platforms\$platformPlugin"
if (Test-Path $source) {
Copy-Item $source "$platformDir\$platformPlugin" -Force
}
}
} else {
Write-Host "Skipping auto-deployment as windeployqt wasn't found." -ForegroundColor Yellow
}
} else {
Write-Host "Qt installation not found for DLL deployment. You might need to manually set it up if the app fails to start." -ForegroundColor Yellow
}
Write-Host ""
# 3. Launch application
Write-Host "Starting CTracker..." -ForegroundColor Green
$exePath = "CTracker/build/CTracker.exe"
if (Test-Path $exePath) {
Start-Process $exePath
Write-Host "CTracker launched successfully!" -ForegroundColor Green
} else {
Write-Host "Error: CTracker executable not found at $exePath" -ForegroundColor Red
}