Packaging.cmake 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # Install rules for everything but the executables (those are in src/), and the CPack configuration.
  2. #
  3. # The directories are set in InstallDirs.cmake. To make the packages, from the build directory:
  4. # cmake --build . && cpack Linux: .deb and .tar.gz. Windows and macOS: .zip.
  5. # cpack -G TGZ Only one of them.
  6. # To install without a package:
  7. # cmake --install . --prefix /usr/local
  8. # Data template. It's copied to the data directory of each user, where the data installer adds the game data.
  9. install(
  10. DIRECTORY ${CMAKE_SOURCE_DIR}/data/
  11. DESTINATION ${VGEARS_INSTALL_TEMPLATEDIR}
  12. # Ogre plugins are found in the system or next to the executable, never in the template.
  13. PATTERN "*.so" EXCLUDE
  14. PATTERN "*.so.*" EXCLUDE
  15. PATTERN "*.dll" EXCLUDE
  16. PATTERN "*.dylib" EXCLUDE
  17. )
  18. # Documentation for players. The developer guides (build, style, code notes) are left out.
  19. install(
  20. FILES
  21. ${CMAKE_SOURCE_DIR}/README.md
  22. ${CMAKE_SOURCE_DIR}/COPYING.txt
  23. ${CMAKE_SOURCE_DIR}/doc/AUTHORS.md
  24. ${CMAKE_SOURCE_DIR}/doc/HISTORY.md
  25. ${CMAKE_SOURCE_DIR}/doc/INSTALL_DATA.md
  26. ${CMAKE_SOURCE_DIR}/doc/RUN.md
  27. DESTINATION ${VGEARS_INSTALL_DOCDIR}
  28. )
  29. # Desktop integration. The icon names must match the Icon key of the desktop files, and the installer's desktop file
  30. # name must match QApplication::setDesktopFileName so the shell shows the right icon for its window.
  31. if(UNIX AND NOT APPLE)
  32. set(_vgears_desktop_files ${CMAKE_SOURCE_DIR}/v-gears.desktop)
  33. set(_vgears_icons ${CMAKE_SOURCE_DIR}/v-gears.png)
  34. if(BUILD_INSTALLER)
  35. list(APPEND _vgears_desktop_files ${CMAKE_SOURCE_DIR}/v-gears-installer.desktop)
  36. list(APPEND _vgears_icons ${CMAKE_SOURCE_DIR}/v-gears-installer.png)
  37. endif()
  38. install(FILES ${_vgears_desktop_files} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
  39. # TODO: The icons are 300x300. Add 256x256 versions so they match their hicolor folder.
  40. install(FILES ${_vgears_icons} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps)
  41. install(FILES ${_vgears_icons} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps)
  42. endif()
  43. # Packages.
  44. set(CPACK_PACKAGE_NAME "v-gears")
  45. set(CPACK_PACKAGE_VENDOR "The V-Gears Team")
  46. set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
  47. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A free Final Fantasy VII engine")
  48. set(CPACK_PACKAGE_DESCRIPTION
  49. "V-Gears is a free implementation of the Final Fantasy VII engine. It doesn't include any data of the original \
  50. game: the V-Gears installer extracts it from your own copy of the PC version.")
  51. set(CPACK_PACKAGE_HOMEPAGE_URL "https://v-gears.inigovalentin.com")
  52. set(CPACK_PACKAGE_INSTALL_DIRECTORY "V-Gears")
  53. set(CPACK_PACKAGE_EXECUTABLES "v-gears" "V-Gears" "v-gears-installer" "V-Gears Installer")
  54. set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.txt")
  55. set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
  56. set(CPACK_STRIP_FILES ON)
  57. set(CPACK_PACKAGE_CHECKSUM SHA256)
  58. set(CPACK_PACKAGE_FILE_NAME "v-gears-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
  59. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  60. string(APPEND CPACK_PACKAGE_FILE_NAME "-debug")
  61. endif()
  62. if(WIN32 OR APPLE)
  63. set(CPACK_GENERATOR "ZIP")
  64. # The ZIP has a top-level folder, so it can be extracted anywhere.
  65. set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY ON)
  66. else()
  67. set(CPACK_GENERATOR "DEB;TGZ")
  68. # The tarball has the prefix layout (bin/, share/...) in a top-level folder, so it can be extracted anywhere and
  69. # run from there. The .deb installs to /usr, the default of the DEB generator.
  70. set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY ON)
  71. endif()
  72. # Debian package.
  73. set(VGEARS_PACKAGE_MAINTAINER "Iñigo Valentin <i@inigovalentin.com>" CACHE STRING "Maintainer of the packages")
  74. set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${VGEARS_PACKAGE_MAINTAINER}")
  75. set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
  76. set(CPACK_DEBIAN_PACKAGE_SECTION "games")
  77. set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
  78. # The dependencies are taken from the libraries the executables link. The Ogre plugins come in the same package as
  79. # libOgreMain.
  80. set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
  81. # The installer uses them to convert the music and the videos.
  82. set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "ffmpeg, timidity")
  83. include(CPack)