Skip to content

Commit f76b473

Browse files
committed
fix workflow run
1 parent 0480337 commit f76b473

4 files changed

Lines changed: 101 additions & 64 deletions

File tree

.github/workflows/msbuild.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Windows Build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [ "main" ]
9+
workflow_dispatch:
10+
11+
env:
12+
BUILD_CONFIGURATION: Release
13+
INSTALL_DIR: ${{ github.workspace }}\install
14+
ZIP_NAME: MHY_Scanner_${{ github.ref_name }}.zip
15+
16+
permissions:
17+
contents: write
18+
actions: write
19+
20+
jobs:
21+
build:
22+
runs-on: windows-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
submodules: recursive
29+
30+
- name: Install Qt6
31+
uses: jurplel/install-qt-action@v4
32+
with:
33+
version: '6.8.0'
34+
host: 'windows'
35+
target: 'desktop'
36+
arch: 'win64_msvc2022_64'
37+
cache: true
38+
39+
- name: Setup vcpkg
40+
uses: lukka/run-vcpkg@v11
41+
42+
- name: Configure CMake
43+
run: |
44+
cmake -B build `
45+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_CONFIGURATION }} `
46+
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}\scripts\buildsystems\vcpkg.cmake `
47+
-DVCPKG_TARGET_TRIPLET=x64-windows-static-md `
48+
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install `
49+
-DUNIT_TESTS=OFF `
50+
-DDEV=OFF
51+
52+
- name: Build
53+
run: |
54+
cmake --build build --config ${{ env.BUILD_CONFIGURATION }} --parallel
55+
56+
- name: Install
57+
run: |
58+
cmake --install build --config ${{ env.BUILD_CONFIGURATION }}
59+
60+
- name: Create ZIP
61+
run: |
62+
powershell Compress-Archive -Path "${{ env.INSTALL_DIR }}\*" -DestinationPath "${{ github.workspace }}\${{ env.ZIP_NAME }}"
63+
64+
- name: Upload artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: ${{ env.ZIP_NAME }}
68+
path: ${{ github.workspace }}\${{ env.ZIP_NAME }}
69+
retention-days: 5
70+
71+
- name: Create GitHub Release
72+
if: startsWith(github.ref, 'refs/tags/')
73+
uses: softprops/action-gh-release@v2
74+
with:
75+
name: ${{ github.ref_name }}
76+
files: ${{ github.workspace }}\${{ env.ZIP_NAME }}
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CMakeLists.txt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ if(MSVC)
2424
add_link_options(/DEBUG /OPT:REF,ICF,LBR)
2525
endif()
2626
endif()
27-
27+
2828
include(FetchContent)
2929
include(ExternalProject)
3030

31-
include(cmake/install_nuget.cmake)
3231
include(cmake/install_ffmpeg.cmake)
3332
include(cmake/build_QR-Code-generator.cmake)
3433

@@ -39,6 +38,8 @@ FetchContent_Declare(
3938
)
4039
FetchContent_MakeAvailable(nlohmann_json)
4140

41+
find_package(unofficial-webview2 CONFIG REQUIRED)
42+
4243
find_package(cpr CONFIG REQUIRED)
4344

4445
find_package(OpenCV REQUIRED opencv_world)
@@ -122,7 +123,7 @@ set(PROJECT_LIBRARIES
122123

123124
cpr::cpr
124125
QR_Code_generator
125-
WebView2LoaderStatic
126+
unofficial::webview2::webview2
126127
nlohmann_json::nlohmann_json
127128
${OpenCV_LIBS}
128129
${FFMPEG_LIBS}
@@ -131,7 +132,7 @@ set(PROJECT_LIBRARIES
131132

132133
target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_LIBRARIES})
133134

134-
file(GLOB FFMPEG_DLLS
135+
file(GLOB FFMPEG_DLL_FILES
135136
"${FFMPEG_BIN_DIR}/avcodec-*.dll"
136137
"${FFMPEG_BIN_DIR}/avformat-*.dll"
137138
"${FFMPEG_BIN_DIR}/avutil-*.dll"
@@ -141,7 +142,7 @@ file(GLOB FFMPEG_DLLS
141142

142143
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
143144
COMMAND ${CMAKE_COMMAND} -E copy_if_different
144-
${FFMPEG_DLLS}
145+
${FFMPEG_DLL_FILES}
145146
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
146147
)
147148

@@ -159,38 +160,37 @@ endif()
159160
# install
160161
set(Install_Directory "${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}_${PROJECT_VERSION}")
161162

162-
install(TARGETS ${PROJECT_NAME}
163-
RUNTIME DESTINATION ${Install_Directory}
164-
)
163+
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${Install_Directory})
164+
165+
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${Install_Directory})
165166

166167
set(QT_DLL_FILES
167-
"${QT6_INSTALL_PREFIX}/bin/Qt6Core.dll"
168-
"${QT6_INSTALL_PREFIX}/bin/Qt6Widgets.dll"
169-
"${QT6_INSTALL_PREFIX}/bin/Qt6Gui.dll"
168+
${QT6_INSTALL_PREFIX}/bin/Qt6Core.dll
169+
${QT6_INSTALL_PREFIX}/bin/Qt6Widgets.dll
170+
${QT6_INSTALL_PREFIX}/bin/Qt6Gui.dll
170171
)
171172

172173
install(
173174
FILES
174-
${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb
175175
${QT_DLL_FILES}
176-
${FFMPEG_DLLS}
176+
${FFMPEG_DLL_FILES}
177177
DESTINATION
178178
${Install_Directory}
179179
)
180180

181181
install(
182182
FILES
183-
"${QT6_INSTALL_PREFIX}/plugins/platforms/qdirect2d.dll"
184-
"${QT6_INSTALL_PREFIX}/plugins/platforms/qminimal.dll"
185-
"${QT6_INSTALL_PREFIX}/plugins/platforms/qoffscreen.dll"
186-
"${QT6_INSTALL_PREFIX}/plugins/platforms/qwindows.dll"
183+
${QT6_INSTALL_PREFIX}/plugins/platforms/qdirect2d.dll
184+
${QT6_INSTALL_PREFIX}/plugins/platforms/qminimal.dll
185+
${QT6_INSTALL_PREFIX}/plugins/platforms/qoffscreen.dll
186+
${QT6_INSTALL_PREFIX}/plugins/platforms/qwindows.dll
187187
DESTINATION
188-
"${Install_Directory}/plugins/platforms"
188+
${Install_Directory}/plugins/platforms
189189
)
190190

191191
install(
192192
FILES
193-
"${QT6_INSTALL_PREFIX}/plugins/styles/qmodernwindowsstyle.dll"
193+
${QT6_INSTALL_PREFIX}/plugins/styles/qmodernwindowsstyle.dll
194194
DESTINATION
195195
${Install_Directory}/plugins/styles
196196
)

vcpkg.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"name": "mhy-scanner",
33
"version": "1.1.14",
44
"builtin-baseline": "57987637aac17d62bac535bc839baca3754490e6",
@@ -12,6 +12,9 @@
1212
},
1313
{
1414
"name": "openssl"
15+
},
16+
{
17+
"name": "webview2"
1518
}
1619
]
1720
}

0 commit comments

Comments
 (0)