Skip to content

Commit ccdbde1

Browse files
committed
CI-windows.yml: cleaned and sped up build_qt job
1 parent 13821bb commit ccdbde1

4 files changed

Lines changed: 28 additions & 10 deletions

File tree

.github/workflows/CI-windows.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ defaults:
2121

2222
jobs:
2323

24-
# TODO: use Debug build to speed it up?
2524
build_qt:
2625
strategy:
2726
matrix:
@@ -52,24 +51,22 @@ jobs:
5251
- name: Run CMake
5352
run: |
5453
rem TODO: enable rules?
55-
rem specify Release build so matchcompiler is used
56-
cmake -S . -B build -Werror=dev --warn-uninitialized -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_TESTING=Off -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DBUILD_ONLINE_HELP=On -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel!
54+
cmake -S . -B build -Werror=dev --warn-uninitialized -DCMAKE_BUILD_TYPE=Debug -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_TESTING=Off -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DBUILD_ONLINE_HELP=On -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel!
5755
5856
- name: Build GUI release
5957
run: |
60-
cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel!
58+
cmake --build build --config Debug --target cppcheck-gui || exit /b !errorlevel!
6159
60+
# TODO: is there a way to do this in CMake
6261
- name: Deploy GUI
6362
run: |
64-
windeployqt build\bin\Release || exit /b !errorlevel!
65-
del build\bin\Release\cppcheck-gui.ilk || exit /b !errorlevel!
66-
del build\bin\Release\cppcheck-gui.pdb || exit /b !errorlevel!
63+
windeployqt --no-translations build\bin\Debug || exit /b !errorlevel!
6764
6865
# TODO: run GUI tests
6966

7067
- name: Run CMake install
7168
run: |
72-
rem TODO: this performs a Debug build
73-
rem TODO: the Qt DLLS are not being installed (because of the missing windeployqt?)
74-
cmake --build build --target install
69+
rem TODO: the Qt DLLs are not being installed
70+
cmake --build build --config Debug --target install
7571
rem TODO: validate the installed files
72+
rem TODO: the structure does not match an actual Windows installation

cmake/findDependencies.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ if(BUILD_GUI)
2626
find_program(QHELPGENERATOR qhelpgenerator HINTS ${_qt_bin_dir} REQUIRED)
2727
endif()
2828
endif()
29+
30+
if(MSVC)
31+
find_program(WINDEPLOYQT windeployqt)
32+
if(NOT WINDEPLOYQT)
33+
# TODO: how to properly get the Qt binary folder?
34+
# piggy-back off Qt::qmake for now as it should be in the same folder as the binary we are looking for
35+
get_target_property(_qmake_executable Qt::qmake IMPORTED_LOCATION)
36+
get_filename_component(_qt_bin_dir ${_qmake_executable} DIRECTORY)
37+
message(STATUS "windeployqt not found in PATH - trying ${_qt_bin_dir}")
38+
find_program(WINDEPLOYQT windeployqt HINTS ${_qt_bin_dir} REQUIRED)
39+
endif()
40+
endif()
2941
endif()
3042

3143
if(HAVE_RULES)

cmake/printInfo.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ if(BUILD_GUI)
7676
if(BUILD_ONLINE_HELP)
7777
message(STATUS "QHELPGENERATOR = ${QHELPGENERATOR}")
7878
endif()
79+
if(MSVC)
80+
message(STATUS "WINDEPLOYQT = ${WINDEPLOYQT}")
81+
endif()
7982
endif()
8083
message(STATUS)
8184
message(STATUS "HAVE_RULES = ${HAVE_RULES}")

gui/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ CheckOptions:
7171
add_dependencies(cppcheck-gui online-help.qhc)
7272
endif()
7373

74+
if(MSVC)
75+
message(STATUS "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}")
76+
add_custom_target(windeployqt ${WINDEPLOYQT} --no-translations ${CMAKE_BINARY_DIR})
77+
add_dependencies(windeployqt cppcheck-gui)
78+
endif()
79+
7480
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications)
7581
install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications)
7682

0 commit comments

Comments
 (0)