Improve CPack deb generation

This commit is contained in:
2026-03-06 01:12:46 -04:00
parent c90f974bcb
commit a1fd39eb05
11 changed files with 135 additions and 23 deletions
+21 -5
View File
@@ -5,6 +5,7 @@ include(CMakeDependentOption)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DAPSS.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DebugOpts.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/VerifyBoostDynamic.cmake)
include(GNUInstallDirs)
# Set C++ standard
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@@ -19,6 +20,13 @@ endif()
# Compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
# Ensure installed directories use Debian-standard permissions instead of
# inheriting group-writable bits from the build tree.
set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
# Mind oscillator configuration
set(MIND_VOSCILLATOR_PERIOD_MS 33 CACHE STRING "Mind's virtual osc clock rate (ms)")
if(NOT MIND_VOSCILLATOR_PERIOD_MS GREATER 0)
@@ -210,21 +218,29 @@ if(ENABLE_TESTS)
add_subdirectory(tests)
endif()
install(TARGETS salmanoff DESTINATION bin)
install(TARGETS salmanoff DESTINATION ${CMAKE_INSTALL_BINDIR})
# Install device configuration files (preprocessed .daps files)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/devices/
DESTINATION share/salmanoff/devices
DESTINATION ${CMAKE_INSTALL_DATADIR}/salmanoff/devices
DIRECTORY_PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
FILE_PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ
FILES_MATCHING PATTERN "*.daps"
)
# Install documentation
install(FILES README.md DESTINATION share/doc/salmanoff)
install(FILES LICENSE DESTINATION share/doc/salmanoff)
install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
# Install example configurations if they exist
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples")
install(DIRECTORY examples/ DESTINATION share/salmanoff/examples)
install(DIRECTORY examples/ DESTINATION ${CMAKE_INSTALL_DATADIR}/salmanoff/examples)
endif()
# Include CPack configuration
+62 -12
View File
@@ -5,22 +5,48 @@
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"Salmanoff - A sensor management and control system")
"Cognitive robotics runtime")
set(CPACK_PACKAGE_VENDOR "Salmanoff Project")
set(CPACK_PACKAGE_CONTACT "maintainer@salmanoff.org")
# Set package description
set(CPACK_PACKAGE_DESCRIPTION
"Salmanoff is a comprehensive sensor management and control system that\n"
"provides unified interfaces for various sensor devices including LiDAR\n"
"systems. It features modular architecture with support for multiple\n"
"device types, asynchronous processing, and real-time data handling."
)
# Set package description.
# Use a single joined string so CMake does not serialize it as a semicolon list
# in the generated Debian control file.
string(JOIN "\n "
CPACK_PACKAGE_DESCRIPTION
"Comprehensive sensor management and control runtime."
""
"Salmanoff provides unified interfaces for various sensor devices,"
"including LiDAR systems."
"It features modular architecture with support for multiple device"
"types, asynchronous processing, and real-time data handling.")
# License information
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
# Debian-specific packaged documentation.
set(SALMANOFF_CHANGELOG_TXT "${CMAKE_CURRENT_BINARY_DIR}/changelog")
set(SALMANOFF_CHANGELOG_GZ "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz")
file(WRITE "${SALMANOFF_CHANGELOG_TXT}"
"salmanoff (${PROJECT_VERSION}) unstable; urgency=medium\n\n"
" * Package release.\n\n"
" -- Salmanoff Project <maintainer@salmanoff.org> Fri, 06 Mar 2026 00:00:00 +0000\n")
execute_process(
COMMAND gzip -n -9 -c "${SALMANOFF_CHANGELOG_TXT}"
OUTPUT_FILE "${SALMANOFF_CHANGELOG_GZ}"
)
set(SALMANOFF_MANPAGE_GZ "${CMAKE_CURRENT_BINARY_DIR}/salmanoff.1.gz")
execute_process(
COMMAND gzip -n -9 -c "${CMAKE_CURRENT_SOURCE_DIR}/docs/salmanoff.1"
OUTPUT_FILE "${SALMANOFF_MANPAGE_GZ}"
)
install(FILES "${SALMANOFF_CHANGELOG_GZ}" DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES "${SALMANOFF_MANPAGE_GZ}" DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR} RENAME copyright)
# Enable deb and rpm generators
set(CPACK_GENERATOR "DEB;RPM")
@@ -36,9 +62,12 @@ set(CPACK_DEBIAN_PACKAGE_DISTRIBUTION "ubuntu")
set(CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS
"build-essential, cmake (>= 3.16), libboost-all-dev, flex, bison, ocl-icd-opencl-dev, liburing-dev")
# Runtime dependencies (from builddeps file - runtime equivalents)
set(CPACK_DEBIAN_PACKAGE_DEPENDS
"libboost-system1.74.0 | libboost-system1.73.0 | libboost-system1.72.0, libboost-log1.74.0 | libboost-log1.73.0 | libboost-log1.72.0, libc6, libstdc++6, ocl-icd-libopencl1 | libopencl1, liburing2 | liburing1")
# Runtime dependencies.
# Let dpkg-shlibdeps derive the actual ELF dependencies from the built
# binaries/libraries. Hard-coding old Boost soname packages here makes the
# package unnecessarily pull obsolete runtimes on newer distros, and in this
# tree the generated binaries are not currently linked against Boost DSOs.
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "libxcb1, libx11-6")
set(CPACK_DEBIAN_PACKAGE_SUGGESTS "livox-sdk")
@@ -49,9 +78,19 @@ set(CPACK_RPM_PACKAGE_URL "https://github.com/salmanoff/salmanoff")
set(CPACK_RPM_PACKAGE_REQUIRES "boost-system >= 1.72.0, boost-log >= 1.72.0, glibc, libstdc++, ocl-icd, liburing")
set(CPACK_RPM_PACKAGE_SUGGESTS "xcb, libX11, livox-sdk")
# Package file naming using Debian's architecture naming when available.
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
if(EXISTS "/usr/bin/dpkg")
execute_process(
COMMAND /usr/bin/dpkg --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
# Package file naming using project variables
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
# Enable automatic dependency detection for Debian packages
# This uses dpkg-shlibdeps to automatically detect shared library dependencies
@@ -60,3 +99,14 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
# Set compression
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_RPM_COMPONENT_INSTALL ON)
# Generate standard Debian shared-library metadata and use triggers instead of
# maintainer scripts for ldconfig handling.
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postrm"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/triggers")
# Ship stripped binaries in the primary package.
set(CPACK_STRIP_FILES ON)
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
set -e
# ldconfig is handled via the package trigger.
exit 0
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
set -e
# ldconfig is handled via the package trigger.
exit 0
+1
View File
@@ -0,0 +1 @@
activate-noawait ldconfig
+8 -1
View File
@@ -4,6 +4,11 @@ add_library(attachmentSupport SHARED
stagingBuffer.cpp
)
set_target_properties(attachmentSupport PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
target_include_directories(attachmentSupport PUBLIC
${Boost_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/include
@@ -24,4 +29,6 @@ add_custom_command(TARGET attachmentSupport POST_BUILD
)
# Install rules
install(TARGETS attachmentSupport DESTINATION lib)
install(TARGETS attachmentSupport
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP
)
+8 -1
View File
@@ -10,6 +10,11 @@ if(ENABLE_LIB_livoxProto1)
udpCommandDemuxer.cpp
)
set_target_properties(livoxProto1 PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
# Set config define for header generation
add_compile_definitions(CONFIG_LIB_LIVOXPROTO1_ENABLED)
target_include_directories(livoxProto1 PUBLIC ${Boost_INCLUDE_DIRS})
@@ -25,5 +30,7 @@ if(ENABLE_LIB_livoxProto1)
)
# Install rules
install(TARGETS livoxProto1 DESTINATION lib)
install(TARGETS livoxProto1
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP
)
endif()
+8 -1
View File
@@ -10,11 +10,18 @@ if(ENABLE_LIB_xcbXorg)
xcbXorg.cpp
)
set_target_properties(xcbXorg PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
# Set config define for header generation
add_compile_definitions(CONFIG_LIB_XCBXORG_ENABLED)
target_include_directories(xcbXorg PUBLIC ${XCB_INCLUDE_DIRS})
target_link_libraries(xcbXorg ${XCB_LIBRARIES} attachmentSupport)
# Install rules
install(TARGETS xcbXorg DESTINATION lib)
install(TARGETS xcbXorg
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP
)
endif()
+8 -1
View File
@@ -20,6 +20,11 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
openClKernels.cl.S
)
set_target_properties(livoxGen1 PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
# Set assembler working directory so .incbin can find the .cl file
# Also declare dependency on collateDgrams.cl and slotCompactor.cl
set_source_files_properties(openClKernels.cl.S PROPERTIES
@@ -54,5 +59,7 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
)
# Install rules
install(TARGETS livoxGen1 DESTINATION lib)
install(TARGETS livoxGen1
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP
)
endif()
+8 -1
View File
@@ -11,6 +11,11 @@ if(ENABLE_STIMBUFFAPI_xcbWindow)
xcbWindow.cpp
)
set_target_properties(xcbWindow PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
target_include_directories(xcbWindow PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../../include
@@ -26,5 +31,7 @@ if(ENABLE_STIMBUFFAPI_xcbWindow)
attachmentSupport)
# Install rules
install(TARGETS xcbWindow DESTINATION lib)
install(TARGETS xcbWindow
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP
)
endif()