-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deb packaging and move to C++17 (#336)
* change workflows * fix container names * wip * fix debian packaging * use venv for python * static-analysis with submodules * add array headers * allow misc-include * suppress alpine related error * format * fix some errors + enable C++17 * 14 -> 17 * nodiscard * fix compile error * fix endl * replace u_long * fix strerror_r for xsi version * minor format + add rocky runners * update * fix sonarcloud warnings * update readme * this should fix alpine * push more fixes * use /*unused*/ * include time headers * add zeromq port * use revision as version for prom * const * use optional * fix for sonarcloud * reduce scope * add rpm packaging * update codeql build * add ccache dir
- Loading branch information
Showing
35 changed files
with
522 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ doc | |
tests/data | ||
Testing | ||
.git | ||
.venv | ||
.vscode | ||
.sentry-native | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ option(XXX_BUILD_FUZZTESTS "Build XXX fuzz tests" OFF) | |
option(XXX_ENABLE_COVERAGE "Enables coverage report generation" OFF) | ||
option(XXX_ENABLE_MEMLEAK_CHECK "Enables Memory Leak Checker for unit tests" OFF) | ||
option(XXX_ENABLE_SYMBOL_GENERATION "Enables symbol generation for binaries (Requires breakpad)" OFF) | ||
option(XXX_ENABLE_PACKAGING "Enables RPM packaging" OFF) | ||
option(XXX_ENABLE_PACKAGING "Enables DEB/RPM packaging" OFF) | ||
|
||
# Set project properties | ||
set(PROJECT_VERSION_MAJOR 0) | ||
|
@@ -31,7 +31,7 @@ set(PROJECT_VERSION_TWEAK ${REVISION_VERSION}) | |
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-${REVISION_VERSION}") | ||
message(STATUS "Compiling Version ${PROJECT_VERSION}") | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
|
@@ -165,32 +165,54 @@ install(FILES ${CMAKE_BINARY_DIR}/config.json DESTINATION ${CMAKE_INSTALL_PREFIX | |
if(XXX_ENABLE_PACKAGING) | ||
set(EXE_PATH ${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}) | ||
set(SERVICE_NAME ${PROJECT_NAME}.service) | ||
set(POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/postinst.sh) | ||
set(POST_UNINSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/postuninst.sh) | ||
set(PRE_UNINSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/preuninst.sh) | ||
set(POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/postinst) | ||
set(PRE_UNINSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/prerm) | ||
|
||
configure_file(${PROJECT_SOURCE_DIR}/scripts/template.service.in ${CMAKE_CURRENT_BINARY_DIR}/${SERVICE_NAME} @ONLY) | ||
configure_file(${PROJECT_SOURCE_DIR}/scripts/post.sh.in ${POST_INSTALL_SCRIPT}) | ||
configure_file(${PROJECT_SOURCE_DIR}/scripts/postun.sh.in ${POST_UNINSTALL_SCRIPT}) | ||
configure_file(${PROJECT_SOURCE_DIR}/scripts/preun.sh.in ${PRE_UNINSTALL_SCRIPT}) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.service DESTINATION ${CMAKE_INSTALL_PREFIX}/share) | ||
configure_file(${PROJECT_SOURCE_DIR}/scripts/postinst.in ${POST_INSTALL_SCRIPT}) | ||
configure_file(${PROJECT_SOURCE_DIR}/scripts/prerm.in ${PRE_UNINSTALL_SCRIPT}) | ||
|
||
set(CPACK_GENERATOR "RPM") | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.service DESTINATION /lib/systemd/system) | ||
|
||
set(CPACK_PACKAGE_CONTACT "Ege Cetin <[email protected]>") | ||
set(CPACK_PACKAGE_DESCRIPTION "C++ Application Template. It has already integrated a Telnet and ZeroMQ server to \ | ||
receive commands, Crashpad handler to generate minidump, a Prometheus server to broadcast performance metrics. \ | ||
Also, it can send logs to syslog using Spdlog, to a Sentry server and Grafana Loki instance") | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Repository template for C++ applications") | ||
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") | ||
set(CPACK_PACKAGE_RELEASE 1) | ||
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") | ||
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) | ||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") | ||
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md") | ||
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) | ||
|
||
# Debian package specific parameters | ||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${POST_INSTALL_SCRIPT};${PRE_UNINSTALL_SCRIPT}") | ||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libcurl4 (>= 7.0), libspdlog1 (>= 1.8.0), libzmq5 (>= 4.0.0), systemd") | ||
set(CPACK_DEBIAN_PACKAGE_SECTION "misc") | ||
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) | ||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) | ||
|
||
# RPM package specific parameters | ||
set(CPACK_RPM_PACKAGE_LICENSE "MIT") | ||
set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "systemd") | ||
set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "systemd") | ||
set(CPACK_RPM_PACKAGE_REQUIRES_POST "systemd") | ||
set(CPACK_RPM_PACKAGE_REQUIRES "libcurl >= 7.0, spdlog >= 1.8.0, zeromq >= 4.0.0") | ||
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${POST_INSTALL_SCRIPT}) | ||
set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${POST_UNINSTALL_SCRIPT}) | ||
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${PRE_UNINSTALL_SCRIPT}) | ||
|
||
include(CPack) | ||
|
||
if(XXX_ENABLE_SYMBOL_GENERATION) | ||
# Create archive from symbols | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} | ||
POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E tar cfvz ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}-syms.tar.gz | ||
--format=gnutar ${CMAKE_BINARY_DIR}/syms | ||
COMMENT "Creating tar gz archive from ${CMAKE_BINARY_DIR}/syms" | ||
) | ||
endif() | ||
endif() | ||
|
||
# Enable test framework | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.