neovim/packaging/CMakeLists.txt
Henry Fraser 087aad3dcd ci: improved cpack packaging
Addresses: #12571

- Added the following installers through CMake files:
    - Windows NSIS.
    - Windows MSI.
    - Windows zip.
    - MacOs tarball.
    - Linux tarball.
    - Linux Deb package.
- Tweaked pipeline CPack commands to build using new CMakeLists.txt configuration file.
- Added icons and relevant packaging files.
- Updated notes.md to reflect new installation instructions.

This isn't meant to be the perfect solution, it's simply a first pass at using a
simple packaging system to build Windows installers. A Debian package has also
been added since it's very easy but other packages have been left out due to
limiting the scope. Hopefully we can build further upon this and improve it
over time with code signing, better icons and more user-friendly installation
graphics and so on.
2022-02-24 19:54:44 +10:00

79 lines
2.9 KiB
CMake

set(CPACK_PACKAGE_NAME "Neovim")
set(CPACK_PACKAGE_VENDOR "neovim.io")
set(CPACK_PACKAGE_FILE_NAME "nvim")
# From the GitHub About section
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Vim-fork focused on extensibility and usability.")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
# Pull the versions defined with the top level CMakeLists.txt
set(CPACK_PACKAGE_VERSION_MAJOR ${NVIM_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${NVIM_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${NVIM_VERSION_PATCH})
# CPACK_VERBATIM_VARIABLES ensures that the variables prefixed with *CPACK_*
# are correctly passed to the cpack program.
# This should always be set to true.
set(CPACK_VERBATIM_VARIABLES TRUE)
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
if(WIN32)
set(CPACK_PACKAGE_FILE_NAME "nvim-win64")
set(CPACK_GENERATOR ZIP WIX NSIS)
# WIX
# CPACK_WIX_UPGRADE_GUID should be set, but should never change.
# CPACK_WIX_PRODUCT_GUID should not be set (leave as default to auto-generate).
# The following guid is just a randomly generated guid that's been pasted here.
# It has no special meaning other than to supply it to WIX.
set(CPACK_WIX_UPGRADE_GUID "207A1A70-7B0C-418A-A153-CA6883E38F4D")
set(CPACK_WIX_PRODUCT_ICON ${CMAKE_CURRENT_LIST_DIR}/logo.ico)
# NSIS
# install icon
set(CPACK_NSIS_MUI_ICON ${CMAKE_CURRENT_LIST_DIR}/logo.ico)
# uninstall icon
set(CPACK_NSIS_MUI_UNIICON ${CMAKE_CURRENT_LIST_DIR}/logo.ico)
# icon that appears when you search in Add/Remove programs
set(CPACK_NSIS_INSTALLED_ICON_NAME ${CMAKE_CURRENT_LIST_DIR}/logo.ico)
# name that appears in the list in Add/Remove programs
set(CPACK_NSIS_DISPLAY_NAME "Neovim")
# name used in various installer UI locations, such as the title
set(CPACK_NSIS_PACKAGE_NAME "Neovim")
# Allow the user to modify their path to include neovim during
# the installation process.
set(CPACK_NSIS_MODIFY_PATH TRUE)
elseif(APPLE)
set(CPACK_PACKAGE_FILE_NAME "nvim-macos")
set(CPACK_GENERATOR TGZ)
set(CPACK_PACKAGE_ICON ${CMAKE_CURRENT_LIST_DIR}/logo.icns)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CPACK_PACKAGE_FILE_NAME "nvim-linux64")
set(CPACK_GENERATOR TGZ DEB)
set(CPACK_DEBIAN_PACKAGE_NAME "Neovim") # required
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Neovim.io") # required
# Automatically compute required shared lib dependencies.
# Unfortunately, you "just need to know" that this has a hidden
# dependency on dpkg-shlibdeps whilst using a debian based host.
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
else()
set(CPACK_GENERATOR TGZ)
endif()
# CPack variables are loaded in on the call to include(CPack). If you set
# variables *after* the inclusion, they don't get updated within the CPack
# config. Note that some CPack commands should still be run after it, such
# as cpack_add_component().
include(CPack)