diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d29de4ce1..9e70d9ef6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1ece6f57b..53926bbcc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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). diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt index 93b74a924..5a115da1f 100644 --- a/src/cli/CMakeLists.txt +++ b/src/cli/CMakeLists.txt @@ -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=$ @@ -98,6 +99,25 @@ if (LINUXDEPLOY) --icon-file "${CMAKE_CURRENT_SOURCE_DIR}/dokit.png" --output appimage --plugin qt - DEPENDS dokit QtPokit + COMMENT "Bundling AppImage" + DEPENDS cli 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 "$" "${PROJECT_BINARY_DIR}/portable" + COMMAND ${CMAKE_COMMAND} -E copy "$" "${PROJECT_BINARY_DIR}/portable" + COMMAND ${WINDEPLOYQT} --compiler-runtime --release --verbose 2 + "$" + "$" + COMMENT "Bundling portable version" + DEPENDS cli QtPokit + VERBATIM + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/portable) +endif()