-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5249d41
commit d35087b
Showing
3 changed files
with
113 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[string] $archiveName, [string] $targetName | ||
) | ||
# 外部环境变量包括: | ||
# archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }} | ||
# winSdkDir: ${{ steps.build.outputs.winSdkDir }} | ||
# winSdkVer: ${{ steps.build.outputs.winSdkVer }} | ||
# vcToolsInstallDir: ${{ steps.build.outputs.vcToolsInstallDir }} | ||
# vcToolsRedistDir: ${{ steps.build.outputs.vcToolsRedistDir }} | ||
# msvcArch: ${{ matrix.msvc_arch }} | ||
|
||
|
||
# winSdkDir: C:\Program Files (x86)\Windows Kits\10\ | ||
# winSdkVer: 10.0.19041.0\ | ||
# vcToolsInstallDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\ | ||
# vcToolsRedistDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.28.29325\ | ||
# archiveName: 5.9.9-win32_msvc2015 | ||
# msvcArch: x86 | ||
|
||
$scriptDir = $PSScriptRoot | ||
$currentDir = Get-Location | ||
Write-Host "currentDir" $currentDir | ||
Write-Host "scriptDir" $scriptDir | ||
|
||
function Main() { | ||
|
||
New-Item -ItemType Directory $archiveName | ||
|
||
# 拷贝exe | ||
Copy-Item .\App\release\$targetName $archiveName\ | ||
Write-Host "[INFO] Copy-Item from .\App\release\" $targetName " to " $archiveName "done" | ||
|
||
# 拷贝依赖 | ||
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName | ||
Write-Host "[INFO] windeployqt done" | ||
|
||
# 删除不必要的文件 | ||
$excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb") | ||
Remove-Item -Path $archiveName -Include $excludeList -Recurse -Force | ||
Write-Host "[INFO] Remove-Item done" | ||
|
||
# 拷贝vcRedist dll | ||
$redistDll="{0}{1}\*.CRT\*.dll" -f $env:vcToolsRedistDir.Trim(),$env:msvcArch | ||
Copy-Item $redistDll $archiveName\ | ||
Write-Host "[INFO] Copy-Item vcRedist dll done" | ||
|
||
# 拷贝WinSDK dll | ||
$sdkDll="{0}Redist\{1}ucrt\DLLs\{2}\*.dll" -f $env:winSdkDir.Trim(),$env:winSdkVer.Trim(),$env:msvcArch | ||
Copy-Item $sdkDll $archiveName\ | ||
Write-Host "[INFO] Copy-Item WinSDK dll done" | ||
|
||
# 打包zip | ||
Compress-Archive -Path $archiveName $archiveName'.zip' | ||
Write-Host "[INFO] Compress-Archive done" | ||
} | ||
|
||
if ($null -eq $archiveName || $null -eq $targetName) { | ||
Write-Host "args missing, archiveName is" $archiveName ", targetName is" $targetName | ||
return | ||
} | ||
Main | ||
|
||
|