From df339c07fd6c5871908a61372fc44e8627767c4f Mon Sep 17 00:00:00 2001 From: Markus Fritsche Date: Tue, 26 May 2026 13:32:58 +0200 Subject: [PATCH] Install daedalus-decoder.pc for sibling consumers Adds pkg-config plumbing so consumers (daedalus-v4l2 daemon for the upcoming PR-Q3a shadow-mode wiring; the daedalus_decode_h264 CLI when built outside this tree) can locate libdaedalus_decoder.a + the public header via pkg_check_modules / pkg-config. Mirrors daedalus-fourier's relocatable-prefix scheme: prefix is derived from ${pcfiledir} so cmake --install --prefix /foo produces a .pc that resolves to /foo at lookup time. Verified across two install prefixes. daedalus-fourier is declared as a public Requires: because consumers static-linking libdaedalus_decoder.a also need libdaedalus_core.a in their link line to resolve the daedalus_ctx_* / daedalus_recipe_* symbols this archive references. Co-Authored-By: Claude Opus 4.7 (1M context) --- CMakeLists.txt | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b680a0..4fc244a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -237,12 +237,48 @@ endif() # ---- Install ------------------------------------------------------ # -# Library + public header. Stage 2/3 will add a pkg-config file and -# CMake config exports once the API stabilises; pre-0.1 the scaffold -# install just gives the static archive a home. +# Installs: +# - libdaedalus_decoder.a → ${CMAKE_INSTALL_LIBDIR} +# - include/daedalus_decoder.h → ${CMAKE_INSTALL_INCLUDEDIR} +# - daedalus-decoder.pc → ${CMAKE_INSTALL_LIBDIR}/pkgconfig +# +# The .pc lets sibling consumers (daedalus-v4l2 daemon, the +# daedalus_decode_h264 CLI when built externally) discover the static +# archive + headers via pkg-config. daedalus-fourier is declared as a +# public `Requires:` because the consumer (which static-links +# libdaedalus_decoder.a) also needs daedalus-fourier in its own link +# line to resolve the daedalus_ctx_* / daedalus_recipe_* symbols this +# archive references. +# +# Relocatable-prefix scheme mirrors daedalus-fourier's .pc generation: +# `prefix` is derived from ${pcfiledir} so `cmake --install --prefix /foo` +# produces a .pc that resolves prefix=/foo at lookup time, regardless of +# what CMAKE_INSTALL_PREFIX was at configure time. include(GNUInstallDirs) install(TARGETS daedalus_decoder ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES include/daedalus_decoder.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +file(RELATIVE_PATH PKGCONFIG_PCDIR_TO_PREFIX + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig" + "${CMAKE_INSTALL_PREFIX}") + +set(PKGCONFIG_OUT ${CMAKE_CURRENT_BINARY_DIR}/daedalus-decoder.pc) +file(WRITE ${PKGCONFIG_OUT} +"prefix=\${pcfiledir}/${PKGCONFIG_PCDIR_TO_PREFIX} +exec_prefix=\${prefix} +libdir=\${prefix}/${CMAKE_INSTALL_LIBDIR} +includedir=\${prefix}/${CMAKE_INSTALL_INCLUDEDIR} + +Name: daedalus-decoder +Description: Frame-major H.264 decoder on V3D7 via daedalus-fourier primitives +Version: ${PROJECT_VERSION} +Libs: -L\${libdir} -ldaedalus_decoder +Requires: daedalus-fourier +Cflags: -I\${includedir} +") +install(FILES ${PKGCONFIG_OUT} + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) -- 2.47.3