# CPack configuration for package generation
# This file contains all CPack settings for generating deb and rpm packages

# Set package metadata using project variables
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
    "Salmanoff - A sensor management and control system")
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."
)

# License information
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")

# Enable deb and rpm generators
set(CPACK_GENERATOR "DEB;RPM")

# DEB package specific settings
set(CPACK_DEBIAN_PACKAGE_MAINTAINER
    "Salmanoff Project <maintainer@salmanoff.org>")
set(CPACK_DEBIAN_PACKAGE_SECTION "science")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_DEPENDS
    "libboost-system1.74.0 | libboost-system1.73.0 | libboost-system1.72.0, "
    "libc6, libstdc++6")
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "libxcb1, libx11-6")
set(CPACK_DEBIAN_PACKAGE_SUGGESTS "livox-sdk")

# RPM package specific settings
set(CPACK_RPM_PACKAGE_LICENSE "Proprietary")
set(CPACK_RPM_PACKAGE_GROUP "Applications/Engineering")
set(CPACK_RPM_PACKAGE_URL "https://github.com/salmanoff/salmanoff")
set(CPACK_RPM_PACKAGE_REQUIRES "boost-system >= 1.72.0, glibc, libstdc++")
set(CPACK_RPM_PACKAGE_SUGGESTS "xcb, libX11, livox-sdk")

# Package file naming using project variables
set(CPACK_PACKAGE_FILE_NAME
    "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")

# Set compression
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_RPM_COMPONENT_INSTALL ON)
