Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CPack, allowing easy creation of RPM and DEB packages #536

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

Edward-Elric233
Copy link
Contributor

I have been considering manually packaging libhv into RPM and DEB packages for a while. Recently, due to work requirements, I learned about the Infinity project and discovered that CMake can directly use CPack for packaging. By adding just a few descriptive statements in the CMakeLists.txt file, RPM, DEB, and TGZ packages can be generated in the build directory by executing the cpack command. These packages can be placed in the Release section, allowing users to install and use libhv easily through their package manager, eliminating the need for manual compilation.

$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
$ cpack
$ ls libhv-*
libhv-1.0.0-x86_64.deb  libhv-1.0.0-x86_64.rpm  libhv-1.0.0-x86_64.tar.gz

Users can download the packages. For example, on Fedora/RHEL/CentOS/OpenSUSE systems:

wget https://github.com/Edward-Elric233/libhv/releases/download/v1.3.3/libhv-1.0.0-x86_64.rpm
sudo rpm -ivh libhv-1.0.0-x86_64.rpm

After installation, users can utilize the libhv headers and libraries for development.

I would be sincerely grateful if you could review this PR and provide any feedback or suggestions for improvement. Thank you for your time and attention.

CMakeLists.txt Outdated

# CPack settings
set(CPACK_PACKAGE_NAME "libhv")
set(CPACK_PACKAGE_VERSION "1.0.0")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend using ${PROJECT_VERSION} here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll update the CMakeLists.txt to use ${PROJECT_VERSION} for the CPACK_PACKAGE_VERSION. Thanks for the recommendation!

@ithewei ithewei merged commit f561857 into ithewei:master Apr 28, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants