Skip to content

Commit d6568f7

Browse files
committed
ci: 为 vcpkg/onnxruntime 增加缓存并修复 Linux 头文件引用
1 parent 9d8d43c commit d6568f7

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/cpp-cmake-ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ jobs:
8484
"$RUNNER_TEMP/vcpkg/bootstrap-vcpkg.sh" -disableMetrics
8585
echo "VCPKG_ROOT=$RUNNER_TEMP/vcpkg" >> "$GITHUB_ENV"
8686
87+
- name: Restore vcpkg cache
88+
uses: actions/cache@v4
89+
with:
90+
path: |
91+
${{ runner.temp }}/vcpkg/downloads
92+
${{ runner.temp }}/vcpkg/packages
93+
${{ runner.temp }}/vcpkg/installed
94+
key: vcpkg-${{ runner.os }}-${{ matrix.vcpkg_triplet }}-${{ hashFiles('.github/workflows/cpp-cmake-ci.yml', 'CMakeLists.txt') }}
95+
restore-keys: |
96+
vcpkg-${{ runner.os }}-${{ matrix.vcpkg_triplet }}-
97+
8798
- name: Install ONNX Runtime on Windows
8899
if: runner.os == 'Windows'
89100
shell: pwsh

src/OnnxClassifier.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
*/
99
#include "OnnxClassifier.h"
1010

11+
#if __has_include(<onnxruntime_cxx_api.h>)
1112
#include <onnxruntime_cxx_api.h>
13+
#elif __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
14+
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
15+
#else
16+
#error "onnxruntime_cxx_api.h not found"
17+
#endif
1218
#include <QDebug>
1319
#include <algorithm>
1420
#include <array>

0 commit comments

Comments
 (0)