-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmove_required_libs_for_windows.ps1
More file actions
56 lines (44 loc) · 1.81 KB
/
move_required_libs_for_windows.ps1
File metadata and controls
56 lines (44 loc) · 1.81 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
param (
[string]$sourceFolder
)
# Check source folder argument
if (-Not $sourceFolder) {
Write-Host "ERROR: Source folder argument is required." -ForegroundColor Red
exit 1
}
# Check if the source folder exists
if (-Not (Test-Path $sourceFolder)) {
Write-Host "ERROR: Source folder '$sourceFolder' does not exist." -ForegroundColor Red
exit 1
}
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$destinationFolder = Join-Path -Path $scriptDir -ChildPath "build/install"
$fileListPath = Join-Path -Path $scriptDir -ChildPath "required_libs_for_windows.txt"
$windeployqtPath = Join-Path -Path $sourceFolder -ChildPath "windeployqt.exe"
# Check if windeployqt.exe exists
if (-Not (Test-Path $windeployqtPath)) {
Write-Host "ERROR: windeployqt.exe not found in $sourceFolder" -ForegroundColor Red
exit 1
}
if (!(Test-Path $destinationFolder)) {
New-Item -ItemType Directory -Force -Path $destinationFolder | Out-Null
}
$fileList = Get-Content -Path $fileListPath
foreach ($pattern in $fileList) {
$matchedFiles = Get-ChildItem -Path $sourceFolder -Filter $pattern -File
if ($matchedFiles.Count -eq 0) {
Write-Warning "No match found for pattern '$pattern'"
continue
}
foreach ($file in $matchedFiles) {
$destinationFile = Join-Path -Path $destinationFolder -ChildPath $file.Name
Copy-Item -Path $file.FullName -Destination $destinationFile -Force
}
}
$exePath = Join-Path -Path $destinationFolder -ChildPath "XFakeContrib.exe"
& "$sourceFolder\windeployqt.exe" --no-compiler-runtime -network -concurrent $exePath
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed operation with windeployqt.exe"
exit $LASTEXITCODE
}
Write-Host "DLL files successfully moved and application deployed."