diff --git a/INSTALLER.md b/INSTALLER.md index de1345bd5c..8af5c973dd 100644 --- a/INSTALLER.md +++ b/INSTALLER.md @@ -145,6 +145,16 @@ Overte Interface AppImages are built using [linuxdeploy](https://github.com/linu cmake --preset conan-release -DOVERTE_CPU_ARCHITECTURE=-msse3 ``` +3. Create AppImage + ```bash + cmake --build --preset conan-release --target package + ``` + CPack will build target ALL instead of INTERFACE, which is a limitation of CPack. + +4. Lint with [appimagelint](https://github.com/TheAssassin/appimagelint) to check which Linux distributions the AppImage will likely be able to run on. + +**Alternatively**, you can also create the AppImage manually: + 3. Build Interface ```bash cmake --build --preset conan-release --target interface @@ -160,7 +170,6 @@ Overte Interface AppImages are built using [linuxdeploy](https://github.com/linu ~/temp/linuxdeploy-x86_64.AppImage --appdir build/AppDir --executable build/interface/interface --output appimage --plugin qt --icon-file interface/icon/interface.svg --desktop-file interface/org.overte.interface.desktop ``` -7. Lint with [appimagelint](https://github.com/TheAssassin/appimagelint) to check which Linux distributions the AppImage will likely be able to run on. #### Server diff --git a/cmake/macros/GenerateInstallers.cmake b/cmake/macros/GenerateInstallers.cmake index 564475f406..9862ecc290 100644 --- a/cmake/macros/GenerateInstallers.cmake +++ b/cmake/macros/GenerateInstallers.cmake @@ -5,7 +5,7 @@ # Created by Leonardo Murillo on 12/16/2015. # Copyright 2015 High Fidelity, Inc. # Copyright 2021 Vircadia contributors. -# Copyright 2022-2024 Overte e.V. +# Copyright 2022-2025 Overte e.V. # # Distributed under the Apache License, Version 2.0. # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -111,7 +111,22 @@ macro(GENERATE_INSTALLERS) # hide the special Icon? file install(CODE "execute_process(COMMAND SetFile -a V \${CMAKE_INSTALL_PREFIX}/${ESCAPED_DMG_SUBFOLDER_NAME}/Icon\\r)") endif () + elseif (LINUX) + # Produce Interface AppImage using our own scripts. + set(CPACK_GENERATOR "External") + set(CPACK_EXTERNAL_ENABLE_STAGING YES) + set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${HF_CMAKE_DIR}/modules/GenerateAppImage.cmake") + set(CPACK_CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}") + + # Guard against packaging an AppImage with native optimization. + string(FIND "${CMAKE_CXX_FLAGS}" "native" HAS_NATIVE_OPTIMIZATION) + if ((NOT HAS_NATIVE_OPTIMIZATION EQUAL -1) AND (NOT APPIMAGE_IGNORE_OPTIMIZATION)) + message(FATAL_ERROR + "Binaries appear to have been built with native optimization. " + "The resulting AppImage will not be able to run on most machines. " + "Set APPIMAGE_IGNORE_OPTIMIZATION to continue anyway.") + endif() endif () # configure a cpack properties file for custom variables in template diff --git a/cmake/modules/GenerateAppImage.cmake b/cmake/modules/GenerateAppImage.cmake new file mode 100644 index 0000000000..f064820b6f --- /dev/null +++ b/cmake/modules/GenerateAppImage.cmake @@ -0,0 +1,67 @@ +# +# GenerateAppImage.cmake +# cmake/modules +# +# This gets called by cmake/macros/GenerateInstaller.cmake and is intended to package Interface AppImages only. +# +# Created by Julian Groß on 2025-04-12. +# Copyright 2025 Overte e.V. +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +set(APPIMAGE_DESKTOP_FILE ${CPACK_CMAKE_SOURCE_DIR}/interface/org.overte.interface.desktop) +set(APPIMAGE_ICON_FILE ${CPACK_CMAKE_SOURCE_DIR}/interface/icon/interface.svg) + +find_program(LINUXDEPLOY_EXECUTABLE + NAMES linuxdeploy linuxdeploy-${CMAKE_SYSTEM_PROCESSOR}.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-${CMAKE_SYSTEM_PROCESSOR}.AppImage + ${LINUXDEPLOY_EXECUTABLE} + LOG ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/linuxdeploy-download.log + STATUS LINUXDEPLOY_DOWNLOAD) + execute_process(COMMAND chmod +x ${LINUXDEPLOY_EXECUTABLE} COMMAND_ECHO STDOUT) +endif() + +find_program(LINUXDEPLOY_PLUGIN_QT_EXECUTABLE + NAMES linuxdeploy-plugin-qt linuxdeploy-plugin-qt-${CMAKE_SYSTEM_PROCESSOR}.AppImage + PATHS ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy) + +if (NOT LINUXDEPLOY_PLUGIN_QT_EXECUTABLE) + message(STATUS "Downloading linuxdeploy-plugin-qt") + set(LINUXDEPLOY_PLUGIN_QT_EXECUTABLE ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/linuxdeploy-plugin-qt) + file(DOWNLOAD + https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-${CMAKE_SYSTEM_PROCESSOR}.AppImage + ${LINUXDEPLOY_PLUGIN_QT_EXECUTABLE} + LOG ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/linuxdeploy-plugin-qt-download.log + STATUS LINUXDEPLOY-PLUGIN-QT_DOWNLOAD) + execute_process(COMMAND chmod +x ${LINUXDEPLOY_PLUGIN_QT_EXECUTABLE} COMMAND_ECHO STDOUT) +endif() + + +file(COPY ${CPACK_CMAKE_SOURCE_DIR}/interface/org.overte.interface.appdata.xml DESTINATION ${CPACK_TEMPORARY_DIRECTORY}/usr/share/metainfo/) +file(COPY ${CPACK_PACKAGE_DIRECTORY}/interface/plugins DESTINATION ${CPACK_TEMPORARY_DIRECTORY}/usr/bin/) +file(COPY ${CPACK_PACKAGE_DIRECTORY}/interface/scripts DESTINATION ${CPACK_TEMPORARY_DIRECTORY}/usr/bin/) +file(COPY ${CPACK_PACKAGE_DIRECTORY}/interface/resources DESTINATION ${CPACK_TEMPORARY_DIRECTORY}/usr/bin/) +file(COPY ${CPACK_PACKAGE_DIRECTORY}/interface/resources.rcc DESTINATION ${CPACK_TEMPORARY_DIRECTORY}/usr/bin/) + +execute_process( + COMMAND + ${CMAKE_COMMAND} -E env + OUTPUT=${CPACK_PACKAGE_FILE_NAME}.AppImage + VERSION=${CPACK_PACKAGE_VERSION} + QML_SOURCES_PATHS=${CPACK_CMAKE_SOURCE_DIR}/interface/resources/qml/ + ${LINUXDEPLOY_EXECUTABLE} + --appdir=${CPACK_TEMPORARY_DIRECTORY} + --executable=${CPACK_PACKAGE_DIRECTORY}/interface/interface + --desktop-file=${APPIMAGE_DESKTOP_FILE} + --icon-file=${APPIMAGE_ICON_FILE} + --plugin qt + --output=appimage +)