appimage.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. CPack AppImage generator
  2. ------------------------
  3. .. versionadded:: 4.2
  4. CPack `AppImage`_ generator allows to bundle an application into
  5. AppImage format. It uses ``appimagetool`` to pack the application,
  6. and ``patchelf`` to set the application ``RPATH`` to a relative path
  7. based on where the AppImage will be mounted.
  8. .. _`AppImage`: https://appimage.org
  9. The ``appimagetool`` does not scan for libraries dependencies it only
  10. packs the installed content and check if the provided ``.desktop`` file
  11. was properly created. For best compatibility it's recommended to choose
  12. some old LTS distro and built it there, as well as including most
  13. dependencies on the generated file.
  14. The snipped below can be added to your ``CMakeLists.txt`` file
  15. replacing ``my_application_target`` with your application target,
  16. it will do a best effort to scan and copy the libraries your
  17. application links to and copy to install location.
  18. .. code-block:: cmake
  19. install(CODE [[
  20. file(GET_RUNTIME_DEPENDENCIES
  21. EXECUTABLES $<TARGET_FILE:my_application_target>
  22. RESOLVED_DEPENDENCIES_VAR resolved_deps
  23. )
  24. foreach(dep ${resolved_deps})
  25. # copy the symlink
  26. file(COPY ${dep} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
  27. # Resolve the real path of the dependency (follows symlinks)
  28. file(REAL_PATH ${dep} resolved_dep_path)
  29. # Copy the resolved file to the destination
  30. file(COPY ${resolved_dep_path} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
  31. endforeach()
  32. ]])
  33. For Qt based projects it's recommended to call
  34. ``qt_generate_deploy_app_script()`` or ``qt_generate_deploy_qml_app_script()``
  35. and install the files generated by the script, this will install
  36. Qt module's plugins.
  37. You must also set :variable:`CPACK_PACKAGE_ICON` with the same value
  38. listed in the Desktop file.
  39. Variables specific to CPack AppImage generator
  40. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  41. .. variable:: CPACK_APPIMAGE_TOOL_EXECUTABLE
  42. Name of the ``appimagetool`` executable, might be located in the build dir,
  43. full path or reachable in ``PATH``.
  44. :Default: ``appimagetool`` :variable:`CPACK_PACKAGE_FILE_NAME`
  45. .. variable:: CPACK_APPIMAGE_PATCHELF_EXECUTABLE
  46. Name of the ``patchelf`` executable, might be located in the build dir,
  47. full path or reachable in ``PATH``.
  48. :Default: ``patchelf`` :variable:`CPACK_APPIMAGE_PATCHELF_EXECUTABLE`
  49. .. variable:: CPACK_APPIMAGE_DESKTOP_FILE
  50. Name of freedesktop.org desktop file installed.
  51. :Mandatory: Yes
  52. :Default: :variable:`CPACK_APPIMAGE_DESKTOP_FILE`
  53. .. variable:: CPACK_APPIMAGE_UPDATE_INFORMATION
  54. Embed update information STRING; if zsyncmake is installed,
  55. generate zsync file.
  56. :Default: :variable:`CPACK_APPIMAGE_UPDATE_INFORMATION`
  57. .. variable:: CPACK_APPIMAGE_GUESS_UPDATE_INFORMATION
  58. Guess update information based on GitHub or GitLab environment variables.
  59. :Default: :variable:`CPACK_APPIMAGE_GUESS_UPDATE_INFORMATION`
  60. .. variable:: CPACK_APPIMAGE_COMPRESSOR
  61. Squashfs compression.
  62. :Default: :variable:`CPACK_APPIMAGE_COMPRESSOR`
  63. .. variable:: CPACK_APPIMAGE_MKSQUASHFS_OPTIONS
  64. Arguments to pass through to mksquashfs.
  65. :Default: :variable:`CPACK_APPIMAGE_MKSQUASHFS_OPTIONS`
  66. .. variable:: CPACK_APPIMAGE_NO_APPSTREAM
  67. Do not check AppStream metadata.
  68. :Default: :variable:`CPACK_APPIMAGE_NO_APPSTREAM`
  69. .. variable:: CPACK_APPIMAGE_EXCLUDE_FILE
  70. Uses given file as exclude file for mksquashfs,
  71. in addition to .appimageignore.
  72. :Default: :variable:`CPACK_APPIMAGE_EXCLUDE_FILE`
  73. .. variable:: CPACK_APPIMAGE_RUNTIME_FILE
  74. Runtime file to use, if not set a bash script will be generated.
  75. :Default: :variable:`CPACK_APPIMAGE_RUNTIME_FILE`
  76. .. variable:: CPACK_APPIMAGE_SIGN
  77. Sign with gpg[2].
  78. :Default: :variable:`CPACK_APPIMAGE_SIGN`
  79. .. variable:: CPACK_APPIMAGE_SIGN_KEY
  80. Key ID to use for gpg[2] signatures.
  81. :Default: :variable:`CPACK_APPIMAGE_SIGN_KEY`