Packaging.cmake 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.md
  26. ${CMAKE_SOURCE_DIR}/doc/INSTALL_DATA.md
  27. ${CMAKE_SOURCE_DIR}/doc/RUN.md
  28. DESTINATION ${VGEARS_INSTALL_DOCDIR}
  29. )
  30. # Desktop integration. The icon names must match the Icon key of the desktop files, and the installer's desktop file
  31. # name must match QApplication::setDesktopFileName so the shell shows the right icon for its window.
  32. if(UNIX AND NOT APPLE)
  33. set(_vgears_desktop_files ${CMAKE_SOURCE_DIR}/v-gears.desktop)
  34. set(_vgears_icons ${CMAKE_SOURCE_DIR}/v-gears.png)
  35. if(BUILD_INSTALLER)
  36. list(APPEND _vgears_desktop_files ${CMAKE_SOURCE_DIR}/v-gears-installer.desktop)
  37. list(APPEND _vgears_icons ${CMAKE_SOURCE_DIR}/v-gears-installer.png)
  38. endif()
  39. install(FILES ${_vgears_desktop_files} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
  40. # TODO: The icons are 300x300. Add 256x256 versions so they match their hicolor folder.
  41. install(FILES ${_vgears_icons} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps)
  42. install(FILES ${_vgears_icons} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps)
  43. endif()
  44. # Packages.
  45. set(CPACK_PACKAGE_NAME "v-gears")
  46. set(CPACK_PACKAGE_VENDOR "The V-Gears Team")
  47. set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
  48. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A free Final Fantasy VII engine")
  49. set(CPACK_PACKAGE_DESCRIPTION
  50. "V-Gears is a free implementation of the Final Fantasy VII engine. It doesn't include any data of the original \
  51. game: the V-Gears installer extracts it from your own copy of the PC version.")
  52. set(CPACK_PACKAGE_HOMEPAGE_URL "https://v-gears.inigovalentin.com")
  53. set(CPACK_PACKAGE_INSTALL_DIRECTORY "V-Gears")
  54. set(CPACK_PACKAGE_EXECUTABLES "v-gears" "V-Gears" "v-gears-installer" "V-Gears Installer")
  55. set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.txt")
  56. set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
  57. set(CPACK_STRIP_FILES ON)
  58. set(CPACK_PACKAGE_CHECKSUM SHA256)
  59. set(CPACK_PACKAGE_FILE_NAME "v-gears-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
  60. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  61. string(APPEND CPACK_PACKAGE_FILE_NAME "-debug")
  62. endif()
  63. if(WIN32 OR APPLE)
  64. set(CPACK_GENERATOR "ZIP")
  65. # The ZIP has a top-level folder, so it can be extracted anywhere.
  66. set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY ON)
  67. else()
  68. set(CPACK_GENERATOR "DEB;TGZ")
  69. # The tarball has the prefix layout (bin/, share/...) in a top-level folder, so it can be extracted anywhere and
  70. # run from there. The .deb installs to /usr, the default of the DEB generator.
  71. set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY ON)
  72. endif()
  73. # Debian package.
  74. set(VGEARS_PACKAGE_MAINTAINER "Iñigo Valentin <i@inigovalentin.com>" CACHE STRING "Maintainer of the packages")
  75. set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${VGEARS_PACKAGE_MAINTAINER}")
  76. set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
  77. set(CPACK_DEBIAN_PACKAGE_SECTION "games")
  78. set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
  79. # The dependencies are taken from the libraries the executables link. The Ogre plugins come in the same package as
  80. # libOgreMain.
  81. set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
  82. # The installer uses them to convert the music and the videos.
  83. set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "ffmpeg, timidity")
  84. include(CPack)