2022-01-17 14:19:56 +00:00
|
|
|
[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
|
2022-01-19 15:46:32 +00:00
|
|
|
New-Item -ItemType Directory $archiveName\locale
|
2022-02-11 07:58:13 +00:00
|
|
|
New-Item -ItemType Directory $archiveName\opencc
|
2022-01-17 14:19:56 +00:00
|
|
|
# 拷贝exe
|
|
|
|
Copy-Item release\$targetName $archiveName\
|
|
|
|
Write-Host "copy item finished..."
|
2023-05-01 08:01:48 +00:00
|
|
|
|
2023-05-11 23:58:56 +00:00
|
|
|
# #拷贝pdb
|
|
|
|
# Copy-Item release\*.pdb $archiveName\
|
|
|
|
# Write-Host "copy pdb finished..."
|
2022-01-17 14:19:56 +00:00
|
|
|
# 拷贝依赖
|
|
|
|
windeployqt --qmldir . --plugindir $archiveName\plugins --compiler-runtime $archiveName\$targetName
|
|
|
|
# 删除不必要的文件
|
2022-04-23 11:41:45 +00:00
|
|
|
# $excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb")
|
|
|
|
$excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib")
|
2022-01-17 14:19:56 +00:00
|
|
|
Remove-Item -Path $archiveName -Include $excludeList -Recurse -Force
|
|
|
|
Write-Host "remove item finished..."
|
|
|
|
# 拷贝vcRedist dll
|
|
|
|
$redistDll="{0}{1}\*.CRT\*.dll" -f $env:vcToolsRedistDir.Trim(),$env:msvcArch
|
|
|
|
Write-Host "redist dll $($redistDll)"
|
|
|
|
Copy-Item $redistDll $archiveName\
|
|
|
|
Write-Host "copy redist dll..."
|
2022-01-22 05:30:17 +00:00
|
|
|
Copy-Item "LICENSE.txt" $archiveName\
|
|
|
|
Write-Host "copy license.."
|
2022-02-11 07:58:13 +00:00
|
|
|
Copy-Item "opencc\*" $archiveName\opencc\
|
|
|
|
Write-Host "opencc config files.."
|
2022-08-26 12:36:01 +00:00
|
|
|
|
2022-01-17 14:19:56 +00:00
|
|
|
# 拷贝WinSDK dll
|
|
|
|
$sdkDll="{0}Redist\{1}ucrt\DLLs\{2}\*.dll" -f $env:winSdkDir.Trim(),$env:winSdkVer.Trim(),$env:msvcArch
|
|
|
|
Write-Host "copy sdk dll$($sdkDll)"
|
|
|
|
Copy-Item $sdkDll $archiveName\
|
|
|
|
Copy-Item winlibs\lib\msvc\*.dll $archiveName\
|
2023-05-20 02:29:20 +00:00
|
|
|
Copy-Item winlibs\lib\xapian\rel\*.dll $archiveName\
|
2023-05-27 04:12:16 +00:00
|
|
|
Copy-Item winlibs\lib\*.dll $archiveName\
|
2022-01-19 15:46:32 +00:00
|
|
|
Copy-Item locale\*.qm $archiveName\locale\
|
2023-04-21 01:36:26 +00:00
|
|
|
|
2022-03-11 14:30:53 +00:00
|
|
|
$webengineqm="{0}\translations\qtwebengine_*.qm" -f $env:QTDIR.Trim()
|
2022-03-06 09:05:43 +00:00
|
|
|
Write-Host "copy qtwebengine qm from $($webengineqm)"
|
|
|
|
Copy-Item $webengineqm $archiveName\locale\
|
2023-04-21 01:36:26 +00:00
|
|
|
|
2022-11-19 12:19:47 +00:00
|
|
|
# $multimedia="{0}\plugins\multimedia" -f $env:QTDIR.Trim()
|
|
|
|
# if(Test-Path $multimedia){
|
|
|
|
# Write-Host "copy multimedia $($multimedia) to plugins"
|
|
|
|
# Copy-Item -Path $multimedia -Destination $archiveName\plugins -Recurse
|
|
|
|
# }
|
2022-10-14 02:47:30 +00:00
|
|
|
|
2022-01-17 14:19:56 +00:00
|
|
|
Write-Host "compress zip..."
|
|
|
|
# 打包zip
|
|
|
|
Compress-Archive -Path $archiveName -DestinationPath $archiveName'.zip'
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($null -eq $archiveName || $null -eq $targetName) {
|
|
|
|
Write-Host "args missing, archiveName is" $archiveName ", targetName is" $targetName
|
|
|
|
return
|
|
|
|
}
|
|
|
|
Main
|
|
|
|
|
|
|
|
|