Skip to content

Commit

Permalink
Promote the execution of windeployqt to CMake build files
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolby committed Oct 11, 2024
1 parent a2956c1 commit aefa00c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,7 @@ jobs:
if-no-files-found: error
- name: Make portable
if: matrix.arch != 'arm64'
run: |
mkdir portable
copy /v /b src\lib\${{ matrix.dll }} /b portable
copy /v /b src\cli\dokit.exe /b portable
cd portable
windeployqt --compiler-runtime --release --verbose 2 dokit.exe ${{ matrix.dll }}
:: dokit.exe --version # This would hang the job, because Qt will show a message box.
working-directory: ${{ runner.temp }}
run: cmake --build "%RUNNER_TEMP%" --target cli-portable
- name: Check portable version
if: matrix.arch != 'arm64'
shell: bash
Expand Down
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ if (ENABLE_GUI)
message(STATUS "Enabling experimental GUI app")
add_subdirectory(gui)
endif()

# \todo Add windeployqt target (w/ both CLI and GUI).
22 changes: 21 additions & 1 deletion src/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ find_program(LINUXDEPLOY NAMES linuxdeploy linuxdeploy-x86_64.AppImage)
if (LINUXDEPLOY)
message(STATUS "Found linuxdeploy: ${LINUXDEPLOY}")
configure_file(desktop.in dokit.desktop)
add_custom_target(cli-appimage
add_custom_target(
cli-appimage
COMMAND ${CMAKE_COMMAND} -E env
OUTPUT=${CMAKE_BINARY_DIR}/dokit-${PROJECT_VERSION}${PROJECT_VERSION_SUFFIX}.AppImage
QMAKE=$<TARGET_FILE:Qt${QT_VERSION_MAJOR}::qmake>
Expand All @@ -98,6 +99,25 @@ if (LINUXDEPLOY)
--icon-file "${CMAKE_CURRENT_SOURCE_DIR}/dokit.png"
--output appimage
--plugin qt
COMMENT "Bundling AppImage"
DEPENDS dokit QtPokit
VERBATIM
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()

find_program(WINDEPLOYQT NAMES windeployqt windeployqt.exe)
if (WINDEPLOYQT)
message(STATUS "Found windeployqt: ${WINDEPLOYQT}")
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/portable)
add_custom_target(
cli-portable
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:cli>" "${PROJECT_BINARY_DIR}/portable"
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:tgt>" "${PROJECT_BINARY_DIR}/portable"
COMMAND ${WINDEPLOYQT} --compiler-runtime --release --verbose 2
"$<TARGET_FILE_NAME:cli>"
"$<TARGET_FILE_NAME:QtPokit>"
COMMENT "Bundling portable version"
DEPENDS dokit QtPokit
VERBATIM
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/portable)
endif()

0 comments on commit aefa00c

Please sign in to comment.