Packaging_linux.cmake 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. set(_cmake_package_name "cmake-${CPACK_DESIRED_CMAKE_VERSION}-linux-x86_64")
  9. set(CPACK_CMAKE_PACKAGE_FILE "${_cmake_package_name}.tar.gz")
  10. set(CPACK_CMAKE_PACKAGE_HASH "dc73115520d13bb64202383d3df52bc3d6bbb8422ecc5b2c05f803491cb215b0")
  11. set(O3DE_INCLUDE_INSTALL_IN_PACKAGE FALSE CACHE BOOL "Option to copy the contents of the most recent install from CMAKE_INSTALL_PREFIX into CPACK_PACKAGING_INSTALL_PREFIX. Useful for including a release build in a profile SDK.")
  12. if("$ENV{O3DE_PACKAGE_TYPE}" STREQUAL "SNAP")
  13. set(CPACK_GENERATOR External)
  14. set(CPACK_EXTERNAL_ENABLE_STAGING YES)
  15. set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${LY_ROOT_FOLDER}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging_Snapcraft.cmake")
  16. set(CPACK_MONOLITHIC_INSTALL 1)
  17. set(CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}")
  18. if(O3DE_INCLUDE_INSTALL_IN_PACKAGE)
  19. # Snap uses the external packaging script folder so just copy the files
  20. # into the destination root
  21. set(CPACK_INSTALLED_DIRECTORIES "${CMAKE_INSTALL_PREFIX};.")
  22. endif()
  23. elseif("$ENV{O3DE_PACKAGE_TYPE}" STREQUAL "DEB")
  24. set(CPACK_GENERATOR DEB)
  25. set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}")
  26. # Define all the debian package dependencies needed to build and run
  27. set(package_dependencies
  28. # Required Tools
  29. "cmake (>=3.22)" # Cmake required (minimum version 3.22.0)
  30. "clang (>=12.0)" # Clang required (minimum version 12.0)
  31. ninja-build
  32. # Build Libraries
  33. libglu1-mesa-dev # For Qt (GL dependency)
  34. libxcb-xinerama0 # For Qt plugins at runtime
  35. libxcb-xinput0 # For Qt plugins at runtime
  36. libfontconfig1-dev # For Qt plugins at runtime
  37. libxcb-xkb-dev # For xcb keyboard input
  38. libxkbcommon-x11-dev # For xcb keyboard input
  39. libxkbcommon-dev # For xcb keyboard input
  40. libxcb-xfixes0-dev # For mouse input
  41. libxcb-xinput-dev # For mouse input
  42. libpcre2-16-0
  43. zlib1g-dev
  44. mesa-common-dev
  45. libunwind-dev
  46. libzstd-dev
  47. pkg-config
  48. )
  49. list(JOIN package_dependencies "," CPACK_DEBIAN_PACKAGE_DEPENDS)
  50. # Post-installation and pre/post removal scripts
  51. configure_file("${LY_ROOT_FOLDER}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/postinst.in"
  52. "${CMAKE_BINARY_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/postinst"
  53. @ONLY
  54. )
  55. configure_file("${LY_ROOT_FOLDER}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/prerm.in"
  56. "${CMAKE_BINARY_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/prerm"
  57. @ONLY
  58. )
  59. configure_file("${LY_ROOT_FOLDER}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/postrm.in"
  60. "${CMAKE_BINARY_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/postrm"
  61. @ONLY
  62. )
  63. set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
  64. ${CMAKE_BINARY_DIR}/cmake/Platform/Linux/Packaging/postinst
  65. ${CMAKE_BINARY_DIR}/cmake/Platform/Linux/Packaging/prerm
  66. ${CMAKE_BINARY_DIR}/cmake/Platform/Linux/Packaging/postrm
  67. )
  68. if(O3DE_INCLUDE_INSTALL_IN_PACKAGE)
  69. set(CPACK_INSTALLED_DIRECTORIES "${CMAKE_INSTALL_PREFIX};${CPACK_PACKAGING_INSTALL_PREFIX}")
  70. endif()
  71. endif()