From e55d53af78cd0b04093522c662c7552dd78bf80a Mon Sep 17 00:00:00 2001 From: Baptiste PETIT Date: Fri, 10 Sep 2021 10:21:55 +0200 Subject: [PATCH] Add a cpack configuration for library packaging --- CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++++++++++++++++ README.md | 7 ++++--- debian/triggers | 1 + 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 debian/triggers diff --git a/CMakeLists.txt b/CMakeLists.txt index 2330ac81..2384f11b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,3 +133,49 @@ if(AMQP-CPP_LINUX_TCP) find_package(OpenSSL REQUIRED) target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIR}) endif() + +# software packaging +# ------------------------------------------------------------------------------------------------------ + +# if unix use deb and rpm generators, else default to .tar.gz +if (UNIX) + set(CPACK_GENERATOR DEB RPM) +endif (UNIX) + +# general cpack settings +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ library for communicating with a RabbitMQ message broker") +set(CPACK_PACKAGE_VENDOR "Coppernica Marketing Software") +set(CPACK_PACKAGE_CONTACT "Copernica ") +set(CPACK_PACKAGE_DESCRIPTION + "AMQP-CPP is a C++ library for communicating with a RabbitMQ message broker. The + library can be used to parse incoming data from a RabbitMQ server, and to + generate frames that can be sent to a RabbitMQ server." +) +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/CopernicaMarketingSoftware/AMQP-CPP") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) +set(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + GROUP_READ + GROUP_EXECUTE + WORLD_READ + WORLD_EXECUTE +) +set(CPACK_STRIP_FILES ON) + +# deb generator related +set(CPACK_DEBIAN_PACKAGE_NAME "amqpcpp-dev") +set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/debian/triggers") + +# rpm generator related +set(CPACK_RPM_PACKAGE_NAME "amqpcpp-devel") +set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION}) +set(CPACK_RPM_PACKAGE_LICENSE "ASL 2.0") + +# create package target +include(CPack) diff --git a/README.md b/README.md index 68184758..cd1bdd21 100644 --- a/README.md +++ b/README.md @@ -86,9 +86,10 @@ On Windows you are required to define `NOMINMAX` when compiling code that includ ## Using cmake -The CMake file supports both building and installing. You can choose not to use -the install functionality, and instead manually use the build output at `build/bin/`. Keep -in mind that the TCP module is only supported for Linux. An example install method +The CMake file supports building, packaging, and installing. You can choose not to use +the install functionality, and instead manually use the build output at `build/bin/`. +You can also choose to generate packages for your system with the target `package` and install those. +Keep in mind that the TCP module is only supported for Linux. An example install method would be: ```bash diff --git a/debian/triggers b/debian/triggers new file mode 100644 index 00000000..dd866036 --- /dev/null +++ b/debian/triggers @@ -0,0 +1 @@ +activate-noawait ldconfig