chore(pack): add CPack configuration to build a deb package

Add install rules and CPack settings so cpack produces an installable
.deb. Dependencies are derived with dpkg-shlibdeps, so they follow the
binaries. The sherpa-onnx runtime the streaming backend needs is bundled
because no distro package provides it. The fetch-models script now also
locates its registry when installed system-wide.

增加 CPack 配置,可直接用 cpack 打出 deb:安装规则含桌面入口、应用图标、
模型注册表与下载脚本、用户文档;依赖由 dpkg-shlibdeps 自动推导;流式后端
需要的 sherpa-onnx 运行时(发行版无对应包)随包携带;fetch-models 脚本
装到系统后也能找到注册表。
This commit is contained in:
blumia committed 2026-10-13 11:53:07 +08:00
1 parent 898763eb74
commit 8b9a8c420e
9 files changed
+401 -5

No files matched your search

+24 -1
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.24)
project(live-caption LANGUAGES CXX)
project(live-caption VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -153,8 +153,31 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
endforeach()
endif()
# ---------------------------------------------------------------------------
# 安装后的 RPATH
#
# 1) $ORIGIN/../<私有库目录>:打包时随包携带的 sherpa-onnx 运行时(lib/ 下的相对路径);
# 2) llama / mtmd:发行版把这两个库放在 .../llama 子目录,而该目录不在 ld 的默认搜索
# 路径里(ldconfig -p 里看不到),所以必须显式写进 RPATH,否则安装后起不来。
# ---------------------------------------------------------------------------
set(LC_PRIVATE_LIBDIR "lib/live-caption")
set(_lc_install_rpath "\$ORIGIN/../${LC_PRIVATE_LIBDIR}")
get_filename_component(_lc_llama_dir "${LC_MTMD_LIB}" DIRECTORY)
if(IS_DIRECTORY "${_lc_llama_dir}")
list(APPEND _lc_install_rpath "${_lc_llama_dir}")
endif()
set_target_properties(live-caption live-caption-cli PROPERTIES
INSTALL_RPATH "${_lc_install_rpath}"
INSTALL_RPATH_USE_LINK_PATH OFF)
message(STATUS "安装后 RPATH: ${_lc_install_rpath}")
# ---------------------------------------------------------------------------
if(LC_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
# ---------------------------------------------------------------------------
# 安装与打包(CPack → .deb)
# ---------------------------------------------------------------------------
include(cmake/Packaging.cmake)