Skip to content

Commit 9d8d43c

Browse files
committed
更新 README.md 和 package-windows.ps1,新增所需运行时 DLL 文件列表
1 parent 1041501 commit 9d8d43c

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ cmake --build build
9494
- `YOLOClassifier.exe`
9595
- `windeployqt` 部署后的 Qt 运行库
9696
- `onnxruntime*.dll`
97+
- `libprotobuf-lite.dll`
98+
- `libprotobuf.dll`
9799
- `README.md`
98100
- 示例模型 `models/cat_vs_dog/best.onnx`
99101

scripts/package-windows.ps1

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ $exePath = Join-Path $buildDir "bin\$appName.exe"
3131
$packageName = "$appName-windows-x64"
3232
$packageRoot = Join-Path $distDir $packageName
3333
$zipPath = Join-Path $distDir "$packageName.zip"
34+
$requiredRuntimeDlls = @(
35+
"onnxruntime.dll",
36+
"libprotobuf-lite.dll",
37+
"libprotobuf.dll"
38+
)
3439

3540
if (-not (Test-Path -LiteralPath $exePath)) {
3641
throw "Built executable not found: $exePath"
@@ -56,11 +61,18 @@ if (Test-Path -LiteralPath $modelPath) {
5661
Copy-Item -LiteralPath $modelPath -Destination $modelDir
5762
}
5863

59-
$onnxBinDir = Join-Path $vcpkgRoot "installed\$vcpkgTriplet\bin"
60-
if (Test-Path -LiteralPath $onnxBinDir) {
61-
Get-ChildItem -LiteralPath $onnxBinDir -Filter "onnxruntime*.dll" | ForEach-Object {
62-
Copy-Item -LiteralPath $_.FullName -Destination $packageRoot
64+
$runtimeBinDir = Join-Path $vcpkgRoot "installed\$vcpkgTriplet\bin"
65+
if (-not (Test-Path -LiteralPath $runtimeBinDir)) {
66+
throw "Runtime bin directory not found: $runtimeBinDir"
67+
}
68+
69+
foreach ($dllName in $requiredRuntimeDlls) {
70+
$sourcePath = Join-Path $runtimeBinDir $dllName
71+
if (-not (Test-Path -LiteralPath $sourcePath)) {
72+
throw "Required runtime DLL not found: $sourcePath"
6373
}
74+
75+
Copy-Item -LiteralPath $sourcePath -Destination $packageRoot
6476
}
6577

6678
$windeployqt = Get-Command windeployqt.exe -ErrorAction Stop

0 commit comments

Comments
 (0)