From a1ed35d1c2121f134a06de9287cc1d42668adcee Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Tue, 3 Sep 2024 01:04:12 +0700 Subject: [PATCH] test 5 --- prboom2/CMakeLists.txt | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/prboom2/CMakeLists.txt b/prboom2/CMakeLists.txt index 6e0f37854..8afe1dec9 100644 --- a/prboom2/CMakeLists.txt +++ b/prboom2/CMakeLists.txt @@ -213,5 +213,41 @@ if(NOT CMAKE_CROSSCOMPILING) endif() if(WIN32) - include(CPack) -endif() + set(CPACK_GENERATOR ZIP) +elseif(LINUX) + set(CPACK_GENERATOR External) + set(CPACK_EXTERNAL_ENABLE_STAGING YES) + set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${PROJECT_BINARY_DIR}/appimage-generate.cmake") + + file(GENERATE + OUTPUT "${PROJECT_BINARY_DIR}/appimage-generate.cmake" + CONTENT [[ + find_program(LINUXDEPLOY_EXECUTABLE + NAMES linuxdeploy linuxdeploy-x86_64.AppImage + PATHS ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy) + + if(NOT LINUXDEPLOY_EXECUTABLE) + message(STATUS "Downloading linuxdeploy") + set(LINUXDEPLOY_EXECUTABLE ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/linuxdeploy) + file(DOWNLOAD + https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage + ${LINUXDEPLOY_EXECUTABLE} + INACTIVITY_TIMEOUT 10) + execute_process(COMMAND + chmod +x ${LINUXDEPLOY_EXECUTABLE} COMMAND_ECHO STDOUT) + endif() + + execute_process(COMMAND + ${CMAKE_COMMAND} -E env + OUTPUT=${CPACK_PACKAGE_FILE_NAME}.appimage + VERSION=$,${CPACK_PACKAGE_VERSION},0.1.0> + ${LINUXDEPLOY_EXECUTABLE} + --appimage-extract-and-run + --appdir=${CPACK_TEMPORARY_DIRECTORY} + --executable=$ + --desktop-file=${CPACK_TEMPORARY_DIRECTORY}/${CPACK_PACKAGING_INSTALL_PREFIX}/share/applications/dsda-doom.desktop + --output=appimage) + ]]) +endif() +include(CPack)