diff --git a/resources/build.ps1 b/resources/build.ps1 index a63a33c..efddf61 100644 --- a/resources/build.ps1 +++ b/resources/build.ps1 @@ -1,4 +1,6 @@ -param($type) +param($type) + +[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 $MsvcScript = 'D:\Program Files\Microsoft Visual Studio\2022\\Community\Common7\Tools\Launch-VsDevShell.ps1' if (!(Test-Path $MsvcScript)) { $MsvcScript = 'D:\Program Files\Microsoft Visual Studio\2022\\Professional\Common7\Tools\Launch-VsDevShell.ps1' } @@ -14,8 +16,16 @@ $ffmpegRoot = "$librariesPath\ffmpeg-7.0.2-full_build-shared" $projectPath = Get-Location $buildPath = Join-Path -Path $projectPath -ChildPath "build" -$deployPath = Join-Path -Path $buildPath -ChildPath "SmartLockerTools" -$zipFilePath = Join-Path -Path $buildPath -ChildPath "SmartLockerTools.zip" + +$fileContent = (Get-Content -Path "CMakeLists.txt") -join " " +if ($fileContent -match 'project\([^\)]+VERSION\s+([0-9]+\.[0-9]+)') { + $version = $Matches[1] +} else { + Write-Output "未找到版本号" +} + +$deployPath = Join-Path -Path $buildPath -ChildPath "SmartLockerTools_v$version" +$zipFilePath = Join-Path -Path $buildPath -ChildPath "SmartLockerTools_v$version.zip" $changelogPath = Join-Path -Path $buildPath -ChildPath "CHANGELOG.txt" function Build() { @@ -41,9 +51,15 @@ function Deploy() { Copy-Item $buildPath\Analyser\Analyser.exe $deployPath\Analyser.exe Copy-Item $buildPath\OtaUpdate\SmartLockerUpdater.exe $deployPath\SmartLockerUpdater.exe - $executables = "Analyser.exe", "SmartLockerUpdater.exe" - foreach ($executable in $executables) { - & $qtHome\bin\windeployqt.exe $deployPath\$executable --qmldir=$qtHome\qml + $executables = @( + @("Analyser.exe", "掌静脉测试工具.exe"), + @("SmartLockerUpdater.exe", "掌静脉模组升级工具.exe") + ) + foreach ($executablePair in $executables) { + $oldName = $executablePair[0] + $newName = $executablePair[1] + & $qtHome\bin\windeployqt.exe $deployPath\$oldName --qmldir=$qtHome\qml + Rename-Item -Path $deployPath\$oldName -NewName $deployPath\$newName } $modules = "QmlCore" @@ -62,7 +78,7 @@ function Deploy() { Copy-Item $openSSLRoot\bin\libssl-3-x64.dll $deployPath Copy-Item $openSSLRoot\bin\libcrypto-3-x64.dll $deployPath - $boosts = "thread", "filesystem", "log" + $boosts = "thread", "filesystem", "log", "json" foreach ($boost in $boosts) { Copy-Item -Path $boostRoot\lib\boost_$boost-vc143-mt-x64-1_86.dll -Destination $deployPath }